Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/.options4
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/META-INF/MANIFEST.MF57
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/plugin.properties10
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/plugin.xml74
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/property_files/jpt_common_core.properties11
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/schema/resourceLocators.exsd7
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/schema/resourceTypes.exsd173
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/ContentTypeReference.java (renamed from jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaXmlStructureNode.java)33
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/JptCommonCorePlugin.java145
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/JptResourceModel.java11
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/JptResourceType.java127
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/JptResourceTypeManager.java63
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/JptResourceTypeReference.java44
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/JptWorkspace.java46
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/InternalJptResourceType.java132
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/InternalJptResourceTypeManager.java321
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/InternalJptWorkspace.java74
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/JptCommonCoreMessages.java18
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/JptPlugin.java280
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/JptResourceTypeReferencePropertyTester.java79
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/LibraryProviderPropertyTester.java2
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/WorkspaceAdapterFactory.java51
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/content/IndeterminateContentDescriber.java41
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/gen/AbstractJptGenerator.java24
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/libprov/JptOsgiBundlesLibraryProviderInstallOperationConfig.java20
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/libprov/JptUserLibraryProviderInstallOperationConfig.java20
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/libval/LibValUtil.java26
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/libval/LibraryValidatorManager.java13
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/operations/AbstractJptFileCreationDataModelProvider.java24
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/plugin/JptCommonCorePlugin.java88
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/ModuleResourceLocator.java4
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/PluginResourceLocator.java4
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/ProjectAdapterFactory.java2
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/ResourceLocatorManager.java16
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/SimpleJavaResourceLocator.java10
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryAbstractType.java4
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryAnnotatedElement.java5
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryAttribute.java4
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryClassFile.java6
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryEnum.java6
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryEnumConstant.java4
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryField.java4
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryMember.java14
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryMethod.java8
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryNode.java8
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryPackageFragment.java4
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryType.java14
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryTypeCache.java6
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/RootBinaryNode.java7
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourcePackageInfoCompilationUnit.java4
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceTypeCompilationUnit.java4
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/JDTTools.java18
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/JptPlugin.java1874
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/PlatformTools.java22
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/ProjectTools.java73
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/XPointTools.java205
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/command/RepeatingJobCommandWrapper.java4
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/resource/ProjectResourceLocator.java2
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/resource/java/JavaResourceCompilationUnit.java19
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/resource/java/JavaResourcePackageFragmentRoot.java16
-rw-r--r--common/plugins/org.eclipse.jpt.common.eclipselink.core/.classpath2
-rw-r--r--common/plugins/org.eclipse.jpt.common.eclipselink.core/META-INF/MANIFEST.MF6
-rw-r--r--common/plugins/org.eclipse.jpt.common.eclipselink.core/src/org/eclipse/jpt/common/eclipselink/core/JptCommonEclipseLinkCorePlugin.java90
-rw-r--r--common/plugins/org.eclipse.jpt.common.eclipselink.core/src/org/eclipse/jpt/common/eclipselink/core/internal/libval/EclipseLinkLibValUtil.java38
-rw-r--r--common/plugins/org.eclipse.jpt.common.eclipselink.core/src/org/eclipse/jpt/common/eclipselink/core/internal/plugin/JptCommonEclipseLinkCorePlugin.java40
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/.options7
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/META-INF/MANIFEST.MF4
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/plugin.properties8
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/plugin.xml30
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/gen/AbstractJptGenerateJob.java16
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/JptUIPlugin.java440
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/Tracing.java161
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/AbstractItemStructuredStateProviderManager.java3
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/ArchiveFileViewerFilter.java21
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/ItemTreeStateProviderManager.java3
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/SimpleMessageTreeContent.java3
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/StaticItemTreeContentProvider.java3
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/StructuredContentProvider.java5
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/TreeContentProvider.java3
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/plugin/JptCommonUiPlugin.java (renamed from common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/JptCommonUiPlugin.java)44
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/properties/JptProjectPropertiesPage.java19
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/SWTUtil.java26
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/ClassChooserPane.java10
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/ComboPane.java5
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/FileChooserPane.java10
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/IntegerCombo.java4
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/PackageChooserPane.java6
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/Pane.java46
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/ItemStructuredContentProvider.java9
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/ItemTreeContentProvider.java5
-rw-r--r--common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/StructuredStateProvider.java5
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/META-INF/MANIFEST.MF4
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ArrayTools.java7
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/NullList.java5
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ReflectionTools.java15
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ReverseComparator.java19
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/StackTrace.java47
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Tools.java4
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/VersionComparator.java53
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/ChangeSupport.java1
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AspectListValueModelAdapter.java8
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/BufferedModifiablePropertyValueModel.java (renamed from common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/BufferedWritablePropertyValueModel.java)8
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/FilteringModifiablePropertyValueModel.java (renamed from common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/FilteringWritablePropertyValueModel.java)10
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/NullListValueModel.java8
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/PropertyListValueModelAdapter.java5
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ReadOnlyModifiablePropertyValueModelWrapper.java (renamed from common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ReadOnlyWritablePropertyValueModelWrapper.java)6
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/TransformationModifiablePropertyValueModel.java (renamed from common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/TransformationWritablePropertyValueModel.java)8
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/ObjectListSelectionModel.java3
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/RadioButtonModelAdapter.java8
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/node/AbstractNode.java4
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/FilteringListBrowser.java11
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/MultiMethodReflectiveChangeListener.java10
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/ReflectiveChangeListener.java4
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/SingleMethodReflectiveChangeListener.java7
-rw-r--r--common/tests/org.eclipse.jpt.common.core.tests/META-INF/MANIFEST.MF6
-rw-r--r--common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/BundleActivatorTest.java69
-rw-r--r--common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/CoreTestTools.java49
-rw-r--r--common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/PreferencesTests.java148
-rw-r--r--common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/JptCommonCoreTests.java5
-rw-r--r--common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/utility/jdt/AnnotationTestCase.java22
-rw-r--r--common/tests/org.eclipse.jpt.common.core.tests/test.xml9
-rw-r--r--common/tests/org.eclipse.jpt.common.ui.tests/META-INF/MANIFEST.MF6
-rw-r--r--common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/JptCommonUiTests.java9
-rw-r--r--common/tests/org.eclipse.jpt.common.utility.tests/META-INF/MANIFEST.MF4
-rw-r--r--common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/TestTools.java16
-rw-r--r--common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/VersionComparatorTests.java71
-rw-r--r--common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/BufferedModifiablePropertyValueModelTests.java (renamed from common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/BufferedWritablePropertyValueModelTests.java)30
-rw-r--r--common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/FilteringPropertyValueModelTests.java4
-rw-r--r--common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/JptUtilityModelValueTests.java6
-rw-r--r--common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ReadOnlyModifiablePropertyValueModelWrapperTests.java (renamed from common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ReadOnlyWritablePropertyValueModelWrapperTests.java)12
-rw-r--r--common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/TransformationModifiablePropertyValueModelTests.java (renamed from common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CachingTransformationWritablePropertyValueModelTests.java)12
-rw-r--r--common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/TransformationPropertyValueModelTests.java4
-rw-r--r--jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/META-INF/MANIFEST.MF4
-rw-r--r--jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/.classpath2
-rw-r--r--jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/META-INF/MANIFEST.MF3
-rw-r--r--jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/JptDbwsUiPlugin.java111
-rw-r--r--jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/DbwsGeneratorUi.java8
-rw-r--r--jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/plugin/JptDbwsEclipseLinkUiPlugin.java40
-rw-r--r--jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/DbwsGeneratorWizard.java22
-rw-r--r--jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/JdbcDriverWizardPage.java20
-rw-r--r--jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/SelectFileOrXMLCatalogIdPanel.java5
-rw-r--r--jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/SelectXMLCatalogIdPanel.java8
-rw-r--r--jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/XMLCatalogTableViewer.java10
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/META-INF/MANIFEST.MF2
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/GenericJaxbProjectManager.java10
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JaxbFacet.java18
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JptJaxbCorePlugin.java212
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbContextNode.java11
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/AbstractJaxbProject.java26
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/JavaElementAdapterFactory.java2
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/JavaPackageInfoResourceModelProvider.java7
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/JavaResourceModelProvider.java5
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/ResourceAdapterFactory.java2
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/JaxbPackageAdapterFactory.java18
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaContextNode.java23
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetDataModelProvider.java18
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetVersionChangeDelegate.java11
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/jaxb21/GenericJaxb_2_1_PlatformDefinition.java13
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libprov/JaxbJreLibraryProviderInstallOperationConfig.java20
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libprov/JaxbLibraryProviderInstallOperationConfigAdapterFactory.java2
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libval/GenericJaxbUserLibraryValidator.java26
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libval/JaxbJreLibraryValidator.java28
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/platform/JaxbPlatformManagerImpl.java30
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/platform/JaxbPlatformTester.java2
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/prefs/JaxbPreferencesManager.java35
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/AbstractJaxbFileResourceModel.java4
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/jaxbindex/JaxbIndexResourceImpl.java3
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/jaxbindex/JaxbIndexResourceModelProvider.java20
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/jaxbprops/JaxbPropertiesResourceImpl.java3
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/jaxbprops/JaxbPropertiesResourceModelProvider.java20
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/validation/DefaultValidationMessages.java6
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/validation/JaxbValidator.java14
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/jaxbindex/JaxbIndexResource.java31
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/jaxbprops/JaxbPropertiesResource.java30
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/xsd/XsdUtil.java26
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/META-INF/MANIFEST.MF2
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/.classpath1
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/META-INF/MANIFEST.MF2
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/JptJaxbEclipseLinkCorePlugin.java73
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/libval/ELJaxbUserLibraryValidator.java24
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/plugin/JptJaxbEclipseLinkCorePlugin.java39
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/validation/ELJaxbValidationMessageBuilder.java4
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/.classpath2
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/META-INF/MANIFEST.MF6
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/Activator.java30
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/JptJaxbEclipseLinkUiPlugin.java105
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/ELJaxbMappingImageHelper.java20
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/commands/AddEclipseLinkJaxbPropertyCommandHandler.java43
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/plugin/JptJaxbEclipseLinkUiPlugin.java47
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/META-INF/MANIFEST.MF7
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/wizban/new_jaxb_prj_wiz.pngbin0 -> 2505 bytes
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/JptJaxbUiPlugin.java117
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/ClassesGeneratorUi.java23
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JaxbJavaCompletionProposalComputer.java26
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JaxbMappingImageHelper.java21
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/commands/CreatePackageInfoCommandHandler.java22
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/gen/GenerateJaxbClassesJob.java20
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/GenericJaxb_2_1_NavigatorItemLabelProviderFactory.java8
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbClassItemLabelProvider.java8
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbEnumItemLabelProvider.java6
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorContentProvider.java10
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorItemLabelProviderFactory.java2
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorTreeItemContentProviderFactory.java2
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/platform/JaxbPlatformUiManagerImpl.java26
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/plugin/JptJaxbUiPlugin.java56
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbProjectModel.java6
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbProjectPropertiesPage.java14
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbSchemasPropertiesPage.java24
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorExtensionOptionsWizardPage.java20
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorWizard.java27
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorWizardPage.java25
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/SelectFileOrXMLCatalogIdPanel.java5
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/SelectXMLCatalogIdPanel.java7
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/XMLCatalogTableViewer.java10
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/JaxbFacetPage.java20
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/proj/JaxbProjectWizard.java20
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/SchemaGeneratorWizard.java23
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/platform/JaxbPlatformUiManager.java18
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/.settings/org.eclipse.jdt.core.prefs1
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/META-INF/MANIFEST.MF8
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/JaxbCoreMiscTests.java32
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/JaxbCoreTests.java7
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/plugin/JptJaxbCoreTestsPlugin.java (renamed from jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/JptJaxbCoreTestsPlugin.java)37
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/projects/TestJaxbProject.java12
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/JaxbCoreResourceModelTests.java22
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/test.xml9
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/.settings/org.eclipse.jdt.core.prefs1
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/META-INF/MANIFEST.MF8
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/src/org/eclipse/jpt/jaxb/eclipselink/core/tests/JptJaxbEclipseLinkCoreTestsPlugin.java59
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/src/org/eclipse/jpt/jaxb/eclipselink/core/tests/internal/ELJaxbCoreMiscTests.java (renamed from jpa/tests/org.eclipse.jpt.jpa.ui.tests/src/org/eclipse/jpt/jpa/ui/tests/JptUiTests.java)26
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/src/org/eclipse/jpt/jaxb/eclipselink/core/tests/internal/ELJaxbCoreTests.java24
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/src/org/eclipse/jpt/jaxb/eclipselink/core/tests/internal/context/ELJaxbCoreContextModelTests.java21
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/src/org/eclipse/jpt/jaxb/eclipselink/core/tests/internal/plugin/JptJaxbEclipseLinkCoreTestsPlugin.java36
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/src/org/eclipse/jpt/jaxb/eclipselink/core/tests/internal/resource/ELJaxbCoreResourceModelTests.java22
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/src/org/eclipse/jpt/jaxb/eclipselink/core/tests/internal/resource/java/ELJaxbJavaResourceModelTestCase.java18
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/test.xml20
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/.options7
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/META-INF/MANIFEST.MF10
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/build.properties5
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/plugin.properties13
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/plugin.xml105
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/property_files/jpa_core.properties3
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaDataSource.java9
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaFacet.java55
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaFactory.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaFile.java14
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaNode.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatform.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatformProvider.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatformVariation.java43
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPreferences.java314
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaProject.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaProjectManager.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaResourceModelProvider.java14
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaStructureNode.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaWorkspace.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JptJpaCorePlugin.java533
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/ResourceDefinition.java10
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JpaContextNode.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFile.java110
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFilePersistenceUnitDefaults.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFilePersistenceUnitMetadata.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFileRoot.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/XmlContextNode.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/XmlFile.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/EntityMappings.java55
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistenceUnitDefaults.java3
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistenceUnitMetadata.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistentType.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmXml.java18
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/ClassRef.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/MappingFileRef.java93
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/Persistence.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceUnit.java78
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceXml.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceXmlContextNodeFactory.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaFactory.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaNode.java16
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaPlatformProvider.java76
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaProject.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/FileAdapterFactory.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatform.java51
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatformFactory.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatformProvider.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/InternalJpaProjectManager.java294
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/InternalJpaWorkspace.java104
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JarResourceModelProvider.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JavaPackageInfoResourceModelProvider.java3
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JavaResourceModelProvider.java3
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JpaContextNodePropertyTester.java39
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JpaPreferenceInitializer.java (renamed from jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/prefs/JpaPreferenceInitializer.java)17
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JptCoreMessages.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JptResourceModelPropertyTester.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/OrmResourceModelProvider.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/PersistenceResourceModelProvider.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/WorkspaceAdapterFactory.java24
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/AbstractJpaContextNode.java10
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/PersistentAttributePropertyTester.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/XmlFilePropertyTester.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaJpaContextNode.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentAttribute.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentType.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JarDefinition.java54
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaSourceFileDefinition.java54
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/PackageInfoDefinition.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractEntityMappings.java10
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmXmlContextNode.java26
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmXmlDefinition.java20
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/SpecifiedOrmPersistentType.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractJarFileRef.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractMappingFileRef.java84
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractOrmXmlRef.java71
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceUnit.java11
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceXmlContextNodeFactory.java18
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceXmlDefinition.java17
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetActionDelegate.java44
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetDataModelProvider.java93
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetInstallDataModelProvider.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetInstallDelegate.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetUninstallDelegate.java10
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetVersionChangeDataModelProvider.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetVersionChangeDelegate.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/RuntimeChangedListener.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/GenericJpaDataSource.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericRootContextNode.java10
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJarFile.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmXml.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmXmlDefinition.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericClassRef.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericOrmXmlRef.java (renamed from jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericMappingFileRef.java)10
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistence.java3
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceXml.java65
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceXmlDefinition.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/VirtualOrmXmlRef.java (renamed from jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/ImpliedMappingFileRef.java)12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaPlatformFactory.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaPlatformProvider.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericJpaDatabaseIdentifierAdapter.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericMetamodelSynchronizer.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmXml2_0Definition.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/GenericPersistenceXml2_0Definition.java (renamed from jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/Generic2_0PersistenceXmlDefinition.java)13
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libprov/JpaLibraryProviderInstallOperationConfigAdapterFactory.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libprov/LegacyJpaLibraryProviderDetector.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libval/AbstractOsgiBundlesLibraryValidator.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libval/GenericEclipseLinkBundlesLibraryValidator.java23
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libval/GenericJpaUserLibraryValidator.java20
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/AbstractJpaFileCreationDataModelProvider.java76
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/AbstractJpaFileCreationOperation.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/OrmFileCreationDataModelProvider.java58
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/OrmFileCreationOperation.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/PersistenceFileCreationDataModelProvider.java42
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/PersistenceFileCreationOperation.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/InternalJpaPlatformDescription.java115
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/InternalJpaPlatformGroupDescription.java70
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/InternalJpaPlatformManager.java458
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JavaElementAdapterFactory.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JpaPlatformDescriptionImpl.java109
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JpaPlatformDescriptionPropertyTester.java (renamed from jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JpaPlatformTester.java)22
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JpaPlatformGroupDescriptionImpl.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JpaPlatformManagerImpl.java243
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/ResourceAdapterFactory.java18
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/plugin/JptJpaCorePlugin.java108
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/prefs/JpaPreferencesManager.java402
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaDeleteTypeParticipant.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaMoveJavaElementParticipant.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaRenameJavaElementParticipant.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaDeleteMappingFileParticipant.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaDeletePackageOrFolderParticipant.java14
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveFolderParticipant.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveMappingFileParticipant.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveTypeParticipant.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameFolderParticipant.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameMappingFileParticipant.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameTypeParticipant.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/contenttypes/IndeterminateContentDescriber.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/orm/OrmXmlResourceProvider.java11
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/persistence/PersistenceXmlResourceProvider.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/xml/AbstractJpaXmlResourceProvider.java (renamed from jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/AbstractXmlResourceProvider.java)52
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/DefaultJpaValidationMessages.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaValidator.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/JpaProject2_0.java16
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/persistence/Persistence2_0.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/persistence/PersistenceXml2_0.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/JpaJpqlQueryHelper.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaType.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/platform/GenericPlatform.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/platform/JpaPlatformDescription.java91
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/platform/JpaPlatformGroupDescription.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/platform/JpaPlatformManager.java102
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/prefs/JpaEntityGenPreferencesManager.java76
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/prefs/JpaJpqlPreferencesManager.java78
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/prefs/JpaValidationPreferencesManager.java134
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/ResourceMappingFile.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/OrmXmlResourceFactory.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlEntityMappings.java99
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/PersistenceXmlResourceFactory.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlPersistence.java79
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/xml/JpaXmlResource.java42
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/xml/JpaXmlResourceProvider.java (renamed from jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/JpaXmlResourceProvider.java)13
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.db.ui/META-INF/MANIFEST.MF3
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.db/META-INF/MANIFEST.MF8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.db/plugin.xml29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/ConnectionProfileFactory.java24
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/JptJpaDbPlugin.java140
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/DTPConnectionProfileFactory.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/WorkspaceAdapterFactory.java51
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/driver/AbstractDTPDriverAdapter.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/plugin/JptJpaDbPlugin.java78
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core.ddlgen/META-INF/MANIFEST.MF2
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/.classpath1
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/META-INF/MANIFEST.MF2
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/plugin.properties4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/plugin.xml108
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/EclipseLinkJpaPreferences.java101
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/EclipseLinkJpaProject.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/JptJpaEclipseLinkCorePlugin.java215
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/builder/EclipseLinkStaticWeavingBuilder.java20
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/builder/EclipseLinkStaticWeavingBuilderConfigurator.java78
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkPersistenceUnit.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/AbstractEclipseLink2_0JpaPlatformProvider.java178
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/DefaultEclipseLinkJpaValidationMessages.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_1JpaPlatformFactory.java16
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_1JpaPlatformProvider.java50
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_2JpaPlatformFactory.java17
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_2JpaPlatformProvider.java50
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_0JpaPlatformFactory.java36
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_0JpaPlatformProvider.java169
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_1JpaPlatformFactory.java56
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_1JpaPlatformProvider.java155
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_2JpaPlatformFactory.java50
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_2JpaPlatformProvider.java98
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_3JpaPlatformFactory.java49
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_3JpaPlatformProvider.java101
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_4JpaPlatformFactory.java49
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_4JpaPlatformProvider.java97
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaPlatformFactory.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaPlatformProvider.java50
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaProjectImpl.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkOrmResourceModelProvider.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkEntityImpl.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkMappedSuperclassImpl.java11
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkMultitenancyImpl2_3.java14
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkEntityMappingsImpl.java3
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmElementCollectionMapping2_0.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmPersistentTypeImpl.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml1_1Definition.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml1_2Definition.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml2_0Definition.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml2_1Definition.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml2_2Definition.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml2_3Definition.java24
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml2_4Definition.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXmlDefinition.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkEntityImpl.java11
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkMappedSuperclassImpl.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkMultitenancyImpl2_3.java10
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/VirtualJavaPersistentAttribute.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLink2_0PersistenceXmlDefinition.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLink2_4PersistenceXmlDefinition.java9
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceXmlDefinition.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/ddlgen/AbstractEclipseLinkDDLGenerator.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/operations/EclipseLinkOrmFileCreationDataModelProvider.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/operations/EclipseLinkOrmFileCreationOperation.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/plugin/JptJpaEclipseLinkCorePlugin.java39
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/orm/EclipseLinkOrmXmlResourceProvider.java11
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/platform/EclipseLinkPlatform.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/EclipseLinkOrmXmlResourceFactory.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlEntityMappings.java67
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/.classpath1
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/META-INF/MANIFEST.MF8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/plugin.xml4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/JptJpaEclipseLinkUiPlugin.java117
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/EclipseLinkHelpContextIds.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/ddlgen/EclipseLinkDDLGeneratorUi.java18
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/ddlgen/wizards/GenerateDDLWizard.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/AbstractEclipseLinkArrayMapping2_3UiDefinition.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/AbstractEclipseLinkBasicCollectionMappingUiDefinition.java20
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/AbstractEclipseLinkBasicMapMappingUiDefinition.java20
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/AbstractEclipseLinkStructureMapping2_3UiDefinition.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/AbstractEclipseLinkTransformationMappingUiDefinition.java20
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/AbstractEclipseLinkVariableOneToOneMappingUiDefinition.java20
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLink2_4ProjectFlagModel.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkMultitenancyComposite.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/java/DefaultJavaEclipseLinkOneToManyMappingUiDefinition.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/java/DefaultJavaEclipseLinkOneToOneMappingUiDefinition.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/java/DefaultJavaEclipseLinkVariableOneToOneMappingUiDefinition.java19
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/java/EclipseLink1_2JavaResourceUiDefinition.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkEntityMappings2_0DetailsProvider.java10
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkEntityMappings2_3DetailsProvider.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkEntityMappingsDetailsProvider.java10
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkEntityMappingsTenantDiscriminatorColumnsComposite.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkOrmXml1_1UiDefinition.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkOrmXml1_2UiDefinition.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkOrmXml2_0UiDefinition.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkOrmXml2_1UiDefinition.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkOrmXml2_2UiDefinition.java9
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkOrmXml2_3UiDefinition.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkOrmXml2_4UiDefinition.java24
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkOrmXmlUiDefinition.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/dialogs/AddVirtualAttributeDialog.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/entity/data/model/DynamicEntityDataModelProvider.java119
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/entity/data/model/DynamicEntityTemplateModel.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/entity/data/operation/NewDynamicEntityClassOperation.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/EclipseLinkPersistenceXmlUiDefinition.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/caching/EntityListComposite.java20
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/connection/JdbcConnectionPropertiesComposite.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/customization/EntityListComposite.java20
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/customization/SessionCustomizersComposite.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/general/EclipseLinkPersistenceUnitJarFilesComposite.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/plugin/JptJpaEclipseLinkUiPlugin.java44
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/persistence/EclipseLinkPersistenceXml2_0UiDefinition.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/persistence/EclipseLinkPersistenceXml2_4UiDefinition.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/persistence/PersistenceXmlOptions2_0Tab.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/weave/EclipselinkPreferencePage.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/DynamicEntityClassWizardPage.java26
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/DynamicEntityFieldTableSection.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/DynamicEntityFieldsWizardPage.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/EclipseLinkDynamicEntityWizard.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/conversion/java/EclipseLinkJavaConverterConversionWizardPage.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/conversion/java/EclipseLinkJavaMetadataConversionWizardPage.java9
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/gen/DynamicDefaultTableGenerationWizardPage.java20
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/gen/GenerateDynamicEntitiesFromSchemaWizard.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/gen/PromptEclipseLinkProjectWizardPage.java18
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.gen/META-INF/MANIFEST.MF9
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.gen/property_files/jpt_gen.properties4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.gen/src/org/eclipse/jpt/jpa/gen/internal/BaseEntityGenCustomizer.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.gen/src/org/eclipse/jpt/jpa/gen/internal/JptJpaGenPlugin.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.gen/src/org/eclipse/jpt/jpa/gen/internal/ORMGenCustomizer.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.gen/src/org/eclipse/jpt/jpa/gen/internal/PackageGenerator.java22
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.gen/src/org/eclipse/jpt/jpa/gen/internal/plugin/JptJpaGenPlugin.java39
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.gen/src/org/eclipse/jpt/jpa/gen/internal/util/EntityGenTools.java25
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/.classpath2
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/META-INF/MANIFEST.MF3
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/ExtensionTestPlugin.java55
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestExtensionPlugin.java39
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestJpaPlatformFactory.java6
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestJpaPlatformProvider.java39
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/META-INF/MANIFEST.MF9
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/JpaPreferencesTests.java153
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/JptJpaCoreMiscTests.java30
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/JptJpaCoreTests.java16
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/MiscTests.java (renamed from jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/MiscTests.java)4
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/ContextModelTestCase.java32
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/JpaFileTests.java12
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/JpaProjectTests.java55
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/GenericJavaPersistentTypeTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaBasicMappingTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaEntityTests.java6
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaTableGeneratorTests.java6
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaTableTests.java8
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/EntityMappingsTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/GenericOrmPersistentAttributeTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/GenericOrmPersistentTypeTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmAssociationOverrideTests.java6
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmAttributeOverrideTests.java6
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmBasicMappingTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmCascadeTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmColumnTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmDiscriminatorColumnTests.java6
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmEmbeddableTests.java6
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmEmbeddedIdMappingTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmEmbeddedMappingTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmEntityTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmGeneratedValueTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmIdMappingTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmJoinColumnTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmJoinTableTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmManyToManyMappingTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmManyToOneMappingTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmMappedSuperclassTests.java6
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmNamedNativeQueryTests.java6
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmNamedQueryTests.java6
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmOneToManyMappingTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmOneToOneMappingTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmPrimaryKeyJoinColumnTests.java6
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmQueryHintTests.java6
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmSecondaryTableTests.java6
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmSequenceGeneratorTests.java6
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmTableGeneratorTests.java6
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmTableTests.java6
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmTransientMappingTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmVersionMappingTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmXmlTests.java5
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/PersistenceUnitDefaultsTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/PersistenceUnitMetadataTests.java6
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/persistence/PersistenceTests.java6
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/persistence/PersistenceUnitTests.java10
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/persistence/PersistenceXmlTests.java6
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/Generic2_0ContextModelTestCase.java44
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/java/GenericJavaSequenceGenerator2_0Tests.java6
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/orm/GenericOrmCascade2_0Tests.java21
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/orm/GenericOrmCollectionTable2_0Tests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/orm/GenericOrmElementCollectionMapping2_0Tests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/persistence/Generic2_0JpaMetadataConversionTests.java22
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/persistence/Generic2_0PersistenceUnitTests.java45
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/metadata/JpaEntityGenMetadataTests.java66
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/metadata/JpaJpqlMetadataTests.java59
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/metadata/JpaMetadataTests.java101
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/metadata/JpaValidationMetadataTests.java83
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/metadata/JptJpaCoreMetadataTests.java33
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/model/JpaProjectManagerTests.java56
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/platform/JpaPlatformExtensionTests.java34
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/platform/JpaPlatformTests.java13
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/plugin/JptJpaCoreTestsPlugin.java (renamed from jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/JptJpaCoreTestsPlugin.java)32
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/projects/TestJpaProject.java5
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/test.xml5
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.db.tests/.classpath1
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.db.tests/META-INF/MANIFEST.MF8
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.db.tests/src/org/eclipse/jpt/jpa/db/tests/internal/JptJpaDbTests.java8
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.db.tests/src/org/eclipse/jpt/jpa/db/tests/internal/JptJpaDbTestsPlugin.java56
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.db.tests/src/org/eclipse/jpt/jpa/db/tests/internal/plugin/JptJpaDbTestsPlugin.java39
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/META-INF/MANIFEST.MF6
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/EclipseLinkJpaPreferencesTests.java92
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/JptJpaEclipseLinkCoreMiscTests.java34
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/JptJpaEclipseLinkCoreTests.java21
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/EclipseLink1_1JpaProjectTests.java33
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/EclipseLink1_2JpaProjectTests.java33
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/EclipseLink2_0ContextModelTestCase.java21
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/EclipseLink2_1ContextModelTestCase.java20
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/EclipseLink2_2ContextModelTestCase.java20
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/EclipseLink2_3ContextModelTestCase.java20
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/EclipseLinkJpaProjectTests.java29
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLink2_0OrmCollectionTableTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLink2_1PersistenceUnitDefaultsTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmPersistentAttributeTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkPersistenceUnitDefaultsTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkPersistenceUnitMetadataTests.java6
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/EclipseLink2_0PersistenceUnitTestCase.java6
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/EclipseLink2_2JpaMetadataConversionTests.java33
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/EclipseLink2_4LoggingTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/EclipseLinkPersistenceUnitTests.java6
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/metadata/EclipseLinkStaticWeavingBuilderMetadataTests.java67
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/metadata/JptJpaEclipseLinkCoreMetadataTests.java32
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/test.xml7
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.gen.tests/META-INF/MANIFEST.MF6
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.gen.tests/src/org/eclipse/jpt/jpa/gen/tests/internal/EntityGenToolsTests.java17
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.gen.tests/src/org/eclipse/jpt/jpa/gen/tests/internal/JptJpaGenTests.java12
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.ui.tests/META-INF/MANIFEST.MF8
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.ui.tests/src/org/eclipse/jpt/jpa/ui/tests/internal/JptJpaUiTests.java36
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.ui.tests/src/org/eclipse/jpt/jpa/ui/tests/internal/platform/JpaPlatformUiExtensionTests.java47
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.ui.tests/src/org/eclipse/jpt/jpa/ui/tests/internal/platform/JptJpaUiPlatformTests.java (renamed from jpa/tests/org.eclipse.jpt.jpa.ui.tests/src/org/eclipse/jpt/jpa/ui/tests/internal/platform/JptUiPlatformTests.java)8
-rw-r--r--jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/.classpath8
-rw-r--r--jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/.settings/org.eclipse.jdt.core.prefs1
-rw-r--r--jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/AddAllEntitiesFeature.java2
-rw-r--r--jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateJPAEntityFeature.java7
-rw-r--r--jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateJPAEntityFromMappedSuperclassFeature.java5
-rw-r--r--jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateMappedSuperclassFeature.java5
-rw-r--r--jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/DeleteJPAEntityFeature.java5
-rw-r--r--jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/RefactorEntityFeature.java6
-rw-r--r--jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/propertytester/JpaContentNodeFacetProjectVersionPropertyTester.java9
-rw-r--r--jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/propertytester/JpaProjectFacetVersionPropertyTester.java8
-rw-r--r--jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/JPAEditorDiagramTypeProvider.java2
-rw-r--r--jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/EntityChangeListener.java5
-rw-r--r--jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JPAEditorUtil.java8
-rw-r--r--jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JpaArtifactFactory.java2
-rw-r--r--jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/.settings/org.eclipse.jdt.core.prefs1
-rw-r--r--jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/META-INF/MANIFEST.MF1
-rw-r--r--jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/src/org/eclipse/jpt/jpadiagrameditor/ui/tests/internal/JPAEditorTestsActivator.java3
-rw-r--r--jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/src/org/eclipse/jpt/jpadiagrameditor/ui/tests/internal/listener/JPAProjectListenerTest.java5
-rw-r--r--jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/src/org/eclipse/jpt/jpadiagrameditor/ui/tests/internal/modelintegration/ui/ModelIntegrationTest.java5
-rw-r--r--jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/src/org/eclipse/jpt/jpadiagrameditor/ui/tests/internal/relation/CreateRelationAttributesTest.java2
-rw-r--r--jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/src/org/eclipse/jpt/jpadiagrameditor/ui/tests/internal/util/CreateDeleteEntity.java8
-rw-r--r--jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/test.xml4
662 files changed, 11802 insertions, 9261 deletions
diff --git a/common/plugins/org.eclipse.jpt.common.core/.options b/common/plugins/org.eclipse.jpt.common.core/.options
index 987ec33b47..5328c61e14 100644
--- a/common/plugins/org.eclipse.jpt.common.core/.options
+++ b/common/plugins/org.eclipse.jpt.common.core/.options
@@ -1,4 +1,4 @@
-# Debugging options for the org.eclipse.jpt.common.core plugin.
+# debugging options for the plug-in org.eclipse.jpt.common.core
-# Turn on debugging for the org.eclipse.jpt.common.core plugin.
+# turn on debugging for the plug-in org.eclipse.jpt.common.core
org.eclipse.jpt.common.core/debug=true
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 a0f0e6b499..f99ebc7944 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
@@ -4,8 +4,8 @@ Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.jpt.common.core;singleton:=true
Bundle-Version: 1.2.0.qualifier
-Bundle-Activator: org.eclipse.jpt.common.core.JptCommonCorePlugin
-Bundle-ActivationPolicy: lazy
+Bundle-Activator: org.eclipse.jpt.common.core.internal.plugin.JptCommonCorePlugin
+Bundle-ActivationPolicy: lazy;exclude:="org.eclipse.jpt.common.core.internal.content"
Bundle-ClassPath: .
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
@@ -26,36 +26,40 @@ Require-Bundle: org.eclipse.core.expressions;bundle-version="[3.4.0,4.0.0)",
org.eclipse.wst.common.frameworks;bundle-version="[1.1.200,2.0.0)",
org.eclipse.wst.common.project.facet.core;bundle-version="[1.3.0,2.0.0)",
org.eclipse.wst.validation;bundle-version="[1.2.0,2.0.0)"
-Dali-Comment: We friend 'utility' to all non-EclipseLink, non-test bundles
+Import-Package: com.ibm.icu.text;version="4.0.1"
+Dali-Comment: We friend 'internal.utility' to all non-EclipseLink, non-test bundles
Export-Package: org.eclipse.jpt.common.core,
org.eclipse.jpt.common.core.gen,
org.eclipse.jpt.common.core.internal;
- x-friends:="org.eclipse.jpt.jpa.core,
- org.eclipse.jpt.jaxb.core",
+ 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.gen;
- x-friends:="org.eclipse.jpt.jpa.core,
- org.eclipse.jpt.jaxb.core",
+ x-friends:="org.eclipse.jpt.jaxb.core,
+ org.eclipse.jpt.jpa.core",
org.eclipse.jpt.common.core.internal.libprov;
- x-friends:="org.eclipse.jpt.jpa.core,
- org.eclipse.jpt.jaxb.core",
+ x-friends:="org.eclipse.jpt.jaxb.core,
+ org.eclipse.jpt.jpa.core",
org.eclipse.jpt.common.core.internal.libval;
- x-friends:="org.eclipse.jpt.jpa.core,
- org.eclipse.jpt.jaxb.core",
+ x-friends:="org.eclipse.jpt.jaxb.core,
+ org.eclipse.jpt.jpa.core",
org.eclipse.jpt.common.core.internal.operations;
- x-friends:="org.eclipse.jpt.jpa.core,
- org.eclipse.jpt.jaxb.core",
+ x-friends:="org.eclipse.jpt.jaxb.core,
+ org.eclipse.jpt.jpa.core",
org.eclipse.jpt.common.core.internal.resource;
- x-friends:="org.eclipse.jpt.jpa.core,
- org.eclipse.jpt.jaxb.core",
+ x-friends:="org.eclipse.jpt.jaxb.core,
+ org.eclipse.jpt.jpa.core",
org.eclipse.jpt.common.core.internal.resource.java;
- x-friends:="org.eclipse.jpt.jpa.core,
- org.eclipse.jpt.jaxb.core",
+ x-friends:="org.eclipse.jpt.jaxb.core,
+ org.eclipse.jpt.jpa.core",
org.eclipse.jpt.common.core.internal.resource.java.binary;
- x-friends:="org.eclipse.jpt.jpa.core,
- org.eclipse.jpt.jaxb.core",
+ x-friends:="org.eclipse.jpt.jaxb.core,
+ org.eclipse.jpt.jpa.core",
org.eclipse.jpt.common.core.internal.resource.java.source;
- x-friends:="org.eclipse.jpt.jpa.core,
- org.eclipse.jpt.jaxb.core",
+ x-friends:="org.eclipse.jpt.jaxb.core,
+ org.eclipse.jpt.jpa.core",
org.eclipse.jpt.common.core.internal.utility;
x-friends:="org.eclipse.jpt.common.ui,
org.eclipse.jpt.jaxb.core,
@@ -66,14 +70,14 @@ Export-Package: org.eclipse.jpt.common.core,
org.eclipse.jpt.jpa.gen,
org.eclipse.jpt.jpa.ui",
org.eclipse.jpt.common.core.internal.utility.command;
- x-friends:="org.eclipse.jpt.jpa.core,
- org.eclipse.jpt.jaxb.core",
+ x-friends:="org.eclipse.jpt.jaxb.core,
+ org.eclipse.jpt.jpa.core",
org.eclipse.jpt.common.core.internal.utility.jdt;
x-friends:="org.eclipse.jpt.jaxb.core,
- org.eclipse.jpt.jpa.core",
+ org.eclipse.jpt.jpa.core",
org.eclipse.jpt.common.core.internal.utility.translators;
- x-friends:="org.eclipse.jpt.jpa.core,
- org.eclipse.jpt.jaxb.core",
+ x-friends:="org.eclipse.jpt.jaxb.core,
+ org.eclipse.jpt.jpa.core",
org.eclipse.jpt.common.core.libprov,
org.eclipse.jpt.common.core.libval,
org.eclipse.jpt.common.core.resource,
@@ -81,4 +85,3 @@ Export-Package: org.eclipse.jpt.common.core,
org.eclipse.jpt.common.core.utility,
org.eclipse.jpt.common.core.utility.command,
org.eclipse.jpt.common.core.utility.jdt
-Import-Package: com.ibm.icu.text;version="4.0.1"
diff --git a/common/plugins/org.eclipse.jpt.common.core/plugin.properties b/common/plugins/org.eclipse.jpt.common.core/plugin.properties
index a38a4a43c3..c2f36f9e48 100644
--- a/common/plugins/org.eclipse.jpt.common.core/plugin.properties
+++ b/common/plugins/org.eclipse.jpt.common.core/plugin.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2011 Oracle. All rights reserved.
+# Copyright (c) 2011, 2012 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.
@@ -22,10 +22,12 @@
pluginName = Dali Java Persistence Tools - Common Core
providerName = Eclipse Web Tools Platform
-LIBRARY_VALIDATORS=Library Validators
-RESOURCE_LOCATORS=Resource Locators
+LIBRARY_VALIDATORS = Library Validators
+RESOURCE_LOCATORS = Resource Locators
+RESOURCE_TYPES = Resource Types
-JAR_CONTENT = JAR Content
+JAR_CONTENT = Java Archive (.jar/.zip)
JAVA_PACKAGE_INFO_CONTENT = package-info.java
+FACET_CONFIG_XML_CONTENT = Project facet configuration XML file
NO_OP_LIBRARY_PROVIDER_WARNING = Library configuration is disabled. The user may need to configure further classpath changes later.
diff --git a/common/plugins/org.eclipse.jpt.common.core/plugin.xml b/common/plugins/org.eclipse.jpt.common.core/plugin.xml
index 453e253726..4293622110 100644
--- a/common/plugins/org.eclipse.jpt.common.core/plugin.xml
+++ b/common/plugins/org.eclipse.jpt.common.core/plugin.xml
@@ -13,24 +13,35 @@
<plugin>
<!-- ***** extension points ***** -->
-
+
<extension-point
- id="org.eclipse.jpt.common.core.libraryValidators"
+ id="libraryValidators"
name="%LIBRARY_VALIDATORS"
schema="schema/libraryValidators.exsd"/>
-
-
+
<extension-point
- id="org.eclipse.jpt.common.core.resourceLocators"
+ id="resourceLocators"
name="%RESOURCE_LOCATORS"
schema="schema/resourceLocators.exsd"/>
+ <extension-point
+ id="resourceTypes"
+ name="%RESOURCE_TYPES"
+ schema="schema/resourceTypes.exsd"/>
+
<!-- ***** adapters ***** -->
<extension
point="org.eclipse.core.runtime.adapters">
+ <!-- IWorkspace -> JptWorkspace -->
+ <factory
+ adaptableType="org.eclipse.core.resources.IWorkspace"
+ class="org.eclipse.jpt.common.core.internal.WorkspaceAdapterFactory">
+ <adapter type="org.eclipse.jpt.common.core.JptWorkspace"/>
+ </factory>
+
<!-- IProject -> ProjectResourceLocator -->
<factory
adaptableType="org.eclipse.core.resources.IProject"
@@ -66,24 +77,65 @@
priority="normal">
</content-type>
+ <!-- faceted project file -->
+ <content-type
+ id="org.eclipse.jpt.common.core.content.projectFacet"
+ name="%FACET_CONFIG_XML_CONTENT"
+ file-names="org.eclipse.wst.common.project.facet.core.xml"
+ base-type="org.eclipse.core.runtime.xml">
+ <describer
+ class="org.eclipse.core.runtime.content.XMLRootElementContentDescriber2">
+ <parameter
+ name="element"
+ value="faceted-project"/>
+ </describer>
+ </content-type>
+
</extension>
-
-
+
+
+ <!-- ***** resource types (eat our own dogfood) ***** -->
+
+ <extension
+ point="org.eclipse.jpt.common.core.resourceTypes">
+
+ <resource-type
+ id="org.eclipse.jpt.common.core.resource.jar"
+ content-type="org.eclipse.jpt.common.core.content.jar"/>
+
+ <resource-type
+ id="org.eclipse.jpt.common.core.resource.javaPackageInfo"
+ content-type="org.eclipse.jpt.common.core.content.javaPackageInfo"/>
+
+ <resource-type
+ id="org.eclipse.jpt.common.core.resource.javaSource"
+ content-type="org.eclipse.jdt.core.javaSource"/>
+
+ </extension>
+
+
<!-- ***** property testers ***** -->
-
+
<extension
point="org.eclipse.core.expressions.propertyTesters">
<propertyTester
- id="org.eclipse.jpt.common.core.propertyTester.libraryProvider"
+ id="org.eclipse.jpt.common.core.propertyTester.LibraryProvider"
type="org.eclipse.jst.common.project.facet.core.libprov.ILibraryProvider"
namespace="org.eclipse.jpt.common.core"
properties="id, extendsId"
class="org.eclipse.jpt.common.core.internal.LibraryProviderPropertyTester"/>
+ <propertyTester
+ id="org.eclipse.jpt.common.core.propertyTester.JptResourceTypeReference"
+ type="org.eclipse.jpt.common.core.JptResourceTypeReference"
+ namespace="org.eclipse.jpt.common.core"
+ properties="resourceTypeIsKindOf"
+ class="org.eclipse.jpt.common.core.internal.JptResourceTypeReferencePropertyTester"/>
+
</extension>
-
-
+
+
<!-- ***** Dali extensions (eat our own dogfood) ***** -->
<extension
diff --git a/common/plugins/org.eclipse.jpt.common.core/property_files/jpt_common_core.properties b/common/plugins/org.eclipse.jpt.common.core/property_files/jpt_common_core.properties
index a4eef57496..b51cdbdd08 100644
--- a/common/plugins/org.eclipse.jpt.common.core/property_files/jpt_common_core.properties
+++ b/common/plugins/org.eclipse.jpt.common.core/property_files/jpt_common_core.properties
@@ -7,18 +7,23 @@
# Contributors:
# Oracle - initial API and implementation
################################################################################
+
DALI_JOB_NAME=Dali
DALI_EVENT_HANDLER_THREAD_NAME=Dali Event Handler
GENERATION_CREATING_LAUNCH_CONFIG_TASK=Creating launch configuration
GENERATION_SAVING_LAUNCH_CONFIG_TASK=Saving launch configuration
GENERATION_LAUNCHING_CONFIG_TASK=Launching configuration
-REGISTRY_MISSING_ATTRIBUTE=Missing required attribute ''{0}'' for element ''{1}'' in extension ''{1}'' from plug-in ''{2}''.
+PREFERENCES_FLUSH_JOB_NAME=Flush Preferences: {0}
+REGISTRY_MISSING_ATTRIBUTE=Missing required attribute ''{0}'' for element ''{1}'' in extension ''{2}'' from plug-in ''{3}''.
REGISTRY_INVALID_VALUE=Invalid value ''{0}'' for ''{1}'' in extension ''{2}'' from plug-in ''{3}''.
-REGISTRY_DUPLICATE=An extension of ''{0}'' with the ''{1}'' value of ''{2}'' is already registered.
+REGISTRY_MISSING_BUNDLE=Missing bundle ''{0}''.
+REGISTRY_DUPLICATE=The extension of ''{0}'' contributed by ''{1}'' with the ''{2}'' value of ''{3}'' is a duplicate of a previously registered extension.
REGISTRY_FAILED_CLASS_LOAD=Unable to load the class ''{0}'' declared for the extension point ''{1}'' in the plug-in ''{2}''.
REGISTRY_FAILED_INTERFACE_ASSIGNMENT=Unable to assign the class ''{0}'' declared for the extension point ''{1}'' in the plug-in ''{2}'' to the interface ''{3}''.
REGISTRY_FAILED_INSTANTIATION=Unable to instantiate the class ''{0}'' declared for the extension point ''{1}'' in the plug-in ''{2}''.
USER_LIBRARY_VALIDATOR__CLASS_NOT_FOUND=The class ''{0}'' is required to be in the selected libraries.
VALIDATE_CONTAINER_NOT_SPECIFIED=Parent folder must be specified
VALIDATE_FILE_NAME_NOT_SPECIFIED=File name must be specified
-VALIDATE_FILE_ALREADY_EXISTS=File already exist \ No newline at end of file
+VALIDATE_FILE_ALREADY_EXISTS=File already exist
+RESOURCE_TYPE_INVALID_CONTENT_TYPE = Invalid content type ''{0}'' for resource type ''{1}'' in extension ''{2}'' from plug-in ''{3}''.
+RESOURCE_TYPE_INVALID_BASE_TYPE = Invalid base type ''{0}'' for resource type ''{1}'' in extension ''{2}'' from plug-in ''{3}''.
diff --git a/common/plugins/org.eclipse.jpt.common.core/schema/resourceLocators.exsd b/common/plugins/org.eclipse.jpt.common.core/schema/resourceLocators.exsd
index d82f686e66..6221138636 100644
--- a/common/plugins/org.eclipse.jpt.common.core/schema/resourceLocators.exsd
+++ b/common/plugins/org.eclipse.jpt.common.core/schema/resourceLocators.exsd
@@ -118,10 +118,8 @@
<meta.section type="examples"/>
</appinfo>
<documentation>
- &lt;br&gt;
-&lt;p&gt;
-The following example is the included simple Java resource locator, which is used for simple Java projects. It is of &quot;lowest&quot; priority, since all JPT projects will at their roots be simple Java projects.
-&lt;p&gt;
+ &lt;p&gt;
+&lt;br&gt;The following example is the included simple Java resource locator, which is used for simple Java projects. It is of &quot;lowest&quot; priority, since all JPT projects will at their roots be simple Java projects.
&lt;pre&gt;
&lt;extension
point=&quot;org.eclipse.jpt.common.core.resourceLocators&quot;&gt;
@@ -138,6 +136,7 @@ The following example is the included simple Java resource locator, which is use
&lt;/extension&gt;
&lt;/pre&gt;
&lt;/p&gt;
+
</documentation>
</annotation>
diff --git a/common/plugins/org.eclipse.jpt.common.core/schema/resourceTypes.exsd b/common/plugins/org.eclipse.jpt.common.core/schema/resourceTypes.exsd
new file mode 100644
index 0000000000..9f04c485e5
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.core/schema/resourceTypes.exsd
@@ -0,0 +1,173 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.jpt.common.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.jpt.common.core" id="resourceTypes" name="Resource Types"/>
+ </appinfo>
+ <documentation>
+ Used to define resource types. A resource type is a combination of a content type (as defined as an extension to &apos;org.eclipse.core.contenttype.contentTypes&apos;) and an optional version. A resource type can also specify what other resource types it extends.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="resource-type" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="resource-type">
+ <annotation>
+ <documentation>
+ Declares a resource type. See &lt;samp&gt;org.eclipse.jpt.common.core.JptResourceType&lt;/samp&gt; for more information on resource types.
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="base-type" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ A unique identifier for the declared resource type.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="content-type" type="string" use="required">
+ <annotation>
+ <documentation>
+ The identifier of the resource type&apos;s content type, as specified in an extension to &apos;org.eclipse.core.contenttype.contentTypes&apos;.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="version" type="string">
+ <annotation>
+ <documentation>
+ Rhe resource type&apos;s version. A resource type is compatible with another resource type with the same content type if the resource type&apos;s version is greater than or equal to the other resource type&apos;s version. A resource type with an unspecified version is compatible with itself but not with a resource type with a specified version. A resource type with a specified version is compatible with a resource type with an unspecified version.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="base-type">
+ <annotation>
+ <documentation>
+ Specifies a base resource type.
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ The identifier of a compatible resource type.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ JPT 3.3
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ &lt;br&gt;
+&lt;p&gt;
+The following example is the included simple Java source resource type.
+&lt;/p&gt;&lt;p&gt;
+&lt;pre&gt;
+&lt;extension
+ point=&quot;org.eclipse.jpt.common.core.resourceTypes&quot;&gt;
+ &lt;resource-type
+ id=&quot;org.eclipse.jpt.common.core.resourceType.javaSource&quot;
+ content-type=&quot;org.eclipse.jdt.core.javaSource&quot;&gt;
+ &lt;/resource-type&gt;
+&lt;/extension&gt;
+&lt;/pre&gt;
+&lt;/p&gt;
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ &lt;p&gt;
+The specified content types can be retrieved from the &lt;code&gt;org.eclipse.jpt.common.core.JptResourceTypeManager&lt;/code&gt;.
+&lt;/p&gt;
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ &lt;p&gt;The org.eclipse.jpt.common.core plug-in provides the following resource types:
+&lt;ul&gt;
+&lt;li&gt;jar&lt;/li&gt;
+&lt;li&gt;javaPackageInfo&lt;/li&gt;
+&lt;li&gt;javaSource&lt;/li&gt;
+&lt;/ul&gt;
+&lt;/p&gt;
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="copyright"/>
+ </appinfo>
+ <documentation>
+ Copyright (c) 2012 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
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaXmlStructureNode.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/ContentTypeReference.java
index 7fdd2b9e60..af0ee654fb 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaXmlStructureNode.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/ContentTypeReference.java
@@ -7,27 +7,38 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.jpa.core;
+package org.eclipse.jpt.common.core;
+import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.jpt.common.utility.internal.Transformer;
+import org.eclipse.jpt.common.utility.internal.TransformerAdapter;
/**
- * Implement this interface for XML objects that appear in the Structure view
- *
+ * Reference an {@link IContentType Eclipse content type}.
+ * <p>
* Provisional API: This interface is part of an interim API that is still
* under development and expected to change significantly before reaching
* stability. It is available at this early stage to solicit feedback from
* pioneering adopters on the understanding that any code that uses this API
* will almost certainly be broken (repeatedly) as the API evolves.
*
- * @version 3.2
- * @since 3.2
+ * @version 3.3
+ * @since 3.3
*/
-
-public interface JpaXmlStructureNode extends JpaStructureNode {
-
+public interface ContentTypeReference {
/**
- * Return the content assist proposals for the specified position
- * in the XML file.
+ * Return an Eclipse content type.
*/
- Iterable<String> getXmlCompletionProposals(int pos);
+ IContentType getContentType();
+
+
+ Transformer<ContentTypeReference, IContentType> CONTENT_TYPE_TRANSFORMER = new ContentTypeTransformer();
+ class ContentTypeTransformer
+ extends TransformerAdapter<ContentTypeReference, IContentType>
+ {
+ @Override
+ public IContentType transform(ContentTypeReference ref) {
+ return ref.getContentType();
+ }
+ }
}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/JptCommonCorePlugin.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/JptCommonCorePlugin.java
deleted file mode 100644
index f7e06e39bf..0000000000
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/JptCommonCorePlugin.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2012 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;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jpt.common.core.internal.JptPlugin;
-import org.eclipse.jpt.common.core.internal.libval.LibraryValidatorManager;
-import org.eclipse.jpt.common.core.libprov.JptLibraryProviderInstallOperationConfig;
-import org.eclipse.jpt.common.core.libval.LibraryValidator;
-import org.osgi.framework.BundleContext;
-
-// TODO bjv move to *private* internal package and move all public stuff to adapters etc.
-public class JptCommonCorePlugin
- extends JptPlugin
-{
-
- // ********** public constants **********
-
- /**
- * The plug-in identifier of the jpt common core support
- * (value <code>"org.eclipse.jpt.common.core"</code>).
- */
- public static final String PLUGIN_ID = "org.eclipse.jpt.common.core"; //$NON-NLS-1$
- public static final String PLUGIN_ID_ = PLUGIN_ID + '.';
-
-
- /**
- * The content type for Java source code files.
- */
- public static final IContentType JAVA_SOURCE_CONTENT_TYPE = getContentType(JavaCore.JAVA_SOURCE_CONTENT_TYPE);
-
- /**
- * The resource type for Java source code files
- */
- public static final JptResourceType JAVA_SOURCE_RESOURCE_TYPE = new JptResourceType(JAVA_SOURCE_CONTENT_TYPE);
-
- /**
- * The content type for Java archives (JARs).
- */
- public static final IContentType JAR_CONTENT_TYPE = getJptContentType("jar"); //$NON-NLS-1$
-
- /**
- * The resource type for Java archives (JARs).
- */
- public static final JptResourceType JAR_RESOURCE_TYPE = new JptResourceType(JptCommonCorePlugin.JAR_CONTENT_TYPE);
-
- /**
- * The content type for package-info Java code files.
- */
- public static final IContentType JAVA_SOURCE_PACKAGE_INFO_CONTENT_TYPE = getJptContentType("javaPackageInfo"); //$NON-NLS-1$
-
- /**
- * The resource type for package-info Java code files
- */
- public static final JptResourceType JAVA_SOURCE_PACKAGE_INFO_RESOURCE_TYPE = new JptResourceType(JAVA_SOURCE_PACKAGE_INFO_CONTENT_TYPE);
-
-
- private static final String JPT_CONTENT_PREFIX = PLUGIN_ID_ + "content"; //$NON-NLS-1$
-
- private static final String JPT_CONTENT_PREFIX_ = JPT_CONTENT_PREFIX + '.';
-
- private static IContentType getJptContentType(String jptContentType) {
- return getContentType(JPT_CONTENT_PREFIX_ + jptContentType);
- }
-
- private static IContentType getContentType(String contentType) {
- return Platform.getContentTypeManager().getContentType(contentType);
- }
-
- public static Iterable<LibraryValidator> getLibraryValidators(
- JptLibraryProviderInstallOperationConfig config) {
- return LibraryValidatorManager.instance().getLibraryValidators(config);
- }
-
- // ********** singleton **********
-
- private static JptCommonCorePlugin INSTANCE;
-
- /**
- * Return the singleton Dali common core plug-in.
- */
- public static JptCommonCorePlugin instance() {
- return INSTANCE;
- }
-
-
- // ********** public static methods **********
-
- /**
- * Log the specified message.
- */
- public static void log(String msg) {
- INSTANCE.logError(msg);
- }
-
- /**
- * Log the specified exception or error.
- */
- public static void log(Throwable throwable) {
- INSTANCE.logError(throwable);
- }
-
- /**
- * Log the specified message and exception or error.
- */
- public static void log(String msg, Throwable throwable) {
- INSTANCE.logError(msg, throwable);
- }
-
-
- // ********** plug-in implementation **********
-
- public JptCommonCorePlugin() {
- super();
- if (INSTANCE != null) {
- throw new IllegalStateException();
- }
- // this convention is *wack*... ~bjv
- INSTANCE = this;
- }
-
- @Override
- public synchronized void start(BundleContext context) throws Exception {
- super.start(context);
- // nothing yet...
- }
-
- @Override
- public synchronized void stop(BundleContext context) throws Exception {
- try {
- // nothing yet...
- } finally {
- super.stop(context);
- }
- }
-}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/JptResourceModel.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/JptResourceModel.java
index f183add042..2c1995bbf7 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/JptResourceModel.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/JptResourceModel.java
@@ -23,14 +23,9 @@ import org.eclipse.core.resources.IFile;
* @version 2.3
* @since 2.2
*/
-public interface JptResourceModel {
- /**
- * Return the model's resource type. This can change.
- * Return <code>null</code> if the resource type cannot be determined,
- * the content type is <code>null</code> or the version is <code>null</code>.
- */
- JptResourceType getResourceType();
-
+public interface JptResourceModel
+ extends JptResourceTypeReference
+{
/**
* Return the model's file.
*/
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/JptResourceType.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/JptResourceType.java
index e86355e266..3e43b2a4a4 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/JptResourceType.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/JptResourceType.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2012 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.
@@ -10,10 +10,11 @@
package org.eclipse.jpt.common.core;
import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.jpt.common.utility.internal.Transformer;
+import org.eclipse.jpt.common.utility.internal.TransformerAdapter;
/**
- * Describes the file content type and version for JPA resources.
- * This is a value object that defines an {@link #equals(Object)} method.
+ * Specifies the file content type and version for Dali resources.
* <p>
* Provisional API: This interface is part of an interim API that is still
* under development and expected to change significantly before reaching
@@ -21,79 +22,77 @@ import org.eclipse.core.runtime.content.IContentType;
* pioneering adopters on the understanding that any code that uses this API
* will almost certainly be broken (repeatedly) as the API evolves.
*
- * @version 2.3
+ * @see JptResourceTypeManager
+ * @version 3.3
* @since 2.3
*/
-public class JptResourceType
+public interface JptResourceType
+ extends ContentTypeReference, Comparable<JptResourceType>
{
- private final IContentType contentType;
-
- private final String version;
-
-
/**
- * Version used when version can not be determined or when there is no
- * sense of version (e.g. Java).
+ * Return the resource type's manager.
*/
- public static final String UNDETERMINED_VERSION = "<undetermined>"; //$NON-NLS-1$
+ JptResourceTypeManager getManager();
+ /**
+ * Return the resource type's extension-supplied ID.
+ * This is unique among all the resource types.
+ */
+ String getId();
- public JptResourceType(IContentType contentType) {
- this(contentType, UNDETERMINED_VERSION);
- }
+ /**
+ * Return the resource type's version.
+ * @see org.eclipse.jpt.common.utility.internal.VersionComparator
+ */
+ String getVersion();
- public JptResourceType(IContentType contentType, String version) {
- super();
- if (contentType == null) {
- throw new NullPointerException("content type"); //$NON-NLS-1$
- }
- if (version == null) {
- throw new NullPointerException("version"); //$NON-NLS-1$
- }
- this.contentType = contentType;
- this.version = version;
- }
+ /**
+ * Version used when version cannot be determined or when there is no
+ * sense of version relevant to JPA (e.g. Java). An indeterminate version
+ * is compatible only with another indeterminate version; while all
+ * specified versions are compatible with an indeterminate version.
+ */
+ String UNDETERMINED_VERSION = "<undetermined>"; //$NON-NLS-1$
+ /**
+ * Return the resource type's base types.
+ * @see #isKindOf(JptResourceType)
+ */
+ Iterable<JptResourceType> getBaseTypes();
- public IContentType getContentType() {
- return this.contentType;
- }
+ /**
+ * Return whether either of the following is <code>true</code>:
+ * <li>Both of the following are <code>true</code>:<ul>
+ * <li>the resource type's content type
+ * {@link IContentType#isKindOf(IContentType) is a kind of} the
+ * specified resource type's content type
+ * <li>the resource type's version is compatible with the
+ * specified resource type's version
+ * (i.e. the resource type's version is greater than or
+ * equal to the specified resource type's version);
+ * if the resource type's version is {@link #UNDETERMINED_VERSION
+ * indeterminate}, it is compatible only if the specified resource
+ * type's version is also indeterminate
+ * </ul>
+ * <li>Any one of the resource type's {@link #getBaseTypes() base types}
+ * {@link #isKindOf(JptResourceType) is a kind of} the specified
+ * resource type
+ * <ul>
+ */
+ boolean isKindOf(JptResourceType resourceType);
- public String getVersion() {
- return this.version;
- }
+ /**
+ * Return the ID of the plug-in that contributed the resource type.
+ */
+ String getPluginId();
- @Override
- public boolean equals(Object obj) {
- if (obj == this) {
- return true;
- }
- if ((obj == null) || (obj.getClass() != this.getClass())) {
- return false;
+ Transformer<JptResourceType, String> VERSION_TRANSFORMER = new VersionTransformer();
+ class VersionTransformer
+ extends TransformerAdapter<JptResourceType, String>
+ {
+ @Override
+ public String transform(JptResourceType resourceType) {
+ return resourceType.getVersion();
}
- JptResourceType other = (JptResourceType) obj;
- return this.contentType.equals(other.contentType) && this.version.equals(other.version);
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int hash = 17;
- hash = hash * prime + this.contentType.hashCode();
- hash = hash * prime + this.version.hashCode();
- return hash;
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append(this.getClass().getSimpleName());
- sb.append("(content = "); //$NON-NLS-1$
- sb.append(this.contentType);
- sb.append(", "); //$NON-NLS-1$
- sb.append("version = "); //$NON-NLS-1$
- sb.append(this.version);
- sb.append(')');
- return sb.toString();
}
}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/JptResourceTypeManager.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/JptResourceTypeManager.java
new file mode 100644
index 0000000000..5de023d588
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/JptResourceTypeManager.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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;
+
+import org.eclipse.core.runtime.content.IContentType;
+
+/**
+ * The <code>org.eclipse.jpt.common.core.resourceTypes</code> extension point
+ * corresponding to a {@link JptWorkspace Dali workspace}.
+ * <p>
+ * See <code>org.eclipse.jpt.common.core/plugin.xml:resourceTypes</code>.
+ * <p>
+ * Not intended to be implemented by clients.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @see JptResourceType
+ * @version 3.3
+ * @since 3.3
+ */
+public interface JptResourceTypeManager {
+ /**
+ * Return the manager's Dali workspace.
+ */
+ JptWorkspace getJptWorkspace();
+
+
+ // ********** resource types **********
+
+ /**
+ * Return the defined resource types.
+ */
+ Iterable<JptResourceType> getResourceTypes();
+
+ /**
+ * Return the defined resource types for the specified content type.
+ */
+ Iterable<JptResourceType> getResourceTypes(IContentType contentType);
+
+ /**
+ * Return the resource type for the specified content type and
+ * {@link JptResourceType#UNDETERMINED_VERSION indeterminate version}.
+ * Return <code>null</code> if the resource type does not exist.
+ */
+ JptResourceType getResourceType(IContentType contentType);
+
+ /**
+ * Return the resource type for the specified content type and version.
+ * Return <code>null</code> if the resource type does not exist.
+ */
+ JptResourceType getResourceType(IContentType contentType, String version);
+}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/JptResourceTypeReference.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/JptResourceTypeReference.java
new file mode 100644
index 0000000000..39aa8eb8c7
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/JptResourceTypeReference.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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;
+
+import org.eclipse.jpt.common.utility.internal.Transformer;
+import org.eclipse.jpt.common.utility.internal.TransformerAdapter;
+
+/**
+ * An object with a reference to a resource type.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @see JptResourceType
+ * @version 3.3
+ * @since 3.3
+ */
+public interface JptResourceTypeReference {
+ /**
+ * Return the object's resource type.
+ */
+ JptResourceType getResourceType();
+
+
+ Transformer<JptResourceTypeReference, JptResourceType> RESOURCE_TYPE_TRANSFORMER = new ResourceTypeTransformer();
+ class ResourceTypeTransformer
+ extends TransformerAdapter<JptResourceTypeReference, JptResourceType>
+ {
+ @Override
+ public JptResourceType transform(JptResourceTypeReference ref) {
+ return ref.getResourceType();
+ }
+ }
+}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/JptWorkspace.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/JptWorkspace.java
new file mode 100644
index 0000000000..09e62c27f6
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/JptWorkspace.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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;
+
+import org.eclipse.core.resources.IWorkspace;
+
+/**
+ * The Dali state corresponding to an {@link IWorkspace Eclipse workspace}.
+ * <p>
+ * To retrieve the Dali workspace corresponding to an Eclipse workspace:
+ * <pre>
+ * IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ * JptWorkspace jptWorkspace = (JptWorkspace) workspace.getAdapter(JptWorkspace.class);
+ * </pre>
+ * <p>
+ * See <code>org.eclipse.jpt.common.core/plugin.xml:org.eclipse.core.runtime.adapters</code>.
+ * <p>
+ * Not intended to be implemented by clients.
+ * <p>
+ * Provisional API: This class is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.3
+ * @since 3.3
+ */
+public interface JptWorkspace {
+ /**
+ * Return the corresponding Eclipse workspace.
+ */
+ IWorkspace getWorkspace();
+
+ /**
+ * Return the manager for the workspace's Dali resource types.
+ */
+ JptResourceTypeManager getResourceTypeManager();
+}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/InternalJptResourceType.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/InternalJptResourceType.java
new file mode 100644
index 0000000000..83637a19b4
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/InternalJptResourceType.java
@@ -0,0 +1,132 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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;
+
+import java.util.HashSet;
+import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.jpt.common.core.JptResourceType;
+import org.eclipse.jpt.common.core.JptResourceTypeManager;
+import org.eclipse.jpt.common.utility.internal.VersionComparator;
+import org.eclipse.jpt.common.utility.internal.iterables.SuperIterableWrapper;
+import com.ibm.icu.text.Collator;
+
+/**
+ * Resource type.
+ */
+public class InternalJptResourceType
+ implements JptResourceType
+{
+ private final InternalJptResourceTypeManager manager;
+
+ private final String id;
+
+ private final IContentType contentType;
+
+ private final String version;
+
+ private /* final */ String pluginId;
+
+ // ignore duplicates
+ private /* final */ HashSet<InternalJptResourceType> baseTypes;
+
+
+ InternalJptResourceType(InternalJptResourceTypeManager manager, String id, IContentType contentType, String version) {
+ super();
+ this.manager = manager;
+ this.id = id;
+ this.contentType = contentType;
+ this.version = version;
+ }
+
+
+ public JptResourceTypeManager getManager() {
+ return this.manager;
+ }
+
+ public String getId() {
+ return this.id;
+ }
+
+ public IContentType getContentType() {
+ return this.contentType;
+ }
+
+ public String getVersion() {
+ return this.version;
+ }
+
+ void setPluginId(String pluginId) {
+ this.pluginId = pluginId;
+ }
+
+ public String getPluginId() {
+ return this.pluginId;
+ }
+
+ void setBaseTypes(HashSet<InternalJptResourceType> baseTypes) {
+ this.baseTypes = baseTypes;
+ }
+
+ public Iterable<JptResourceType> getBaseTypes() {
+ return new SuperIterableWrapper<JptResourceType>(this.baseTypes);
+ }
+
+ public boolean isKindOf(JptResourceType resourceType) {
+ return this.isKindOf_(resourceType) ||
+ this.extends_(resourceType);
+ }
+
+ private boolean isKindOf_(JptResourceType resourceType) {
+ return this.contentType.isKindOf(resourceType.getContentType()) &&
+ this.versionIsGTE(resourceType);
+ }
+
+ private boolean versionIsGTE(JptResourceType resourceType) {
+ return this.compareVersionTo(resourceType.getVersion()) >= 0;
+ }
+
+ private boolean extends_(JptResourceType resourceType) {
+ for (JptResourceType baseType : this.baseTypes) {
+ if (baseType.isKindOf(resourceType)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public int compareTo(JptResourceType resourceType) {
+ int result = Collator.getInstance().compare(this.contentType, resourceType.getContentType());
+ return (result != 0) ? result : this.compareVersionTo(resourceType.getVersion());
+ }
+
+ /**
+ * {@link #UNDETERMINED_VERSION} is less than any other version.
+ */
+ private int compareVersionTo(String v) {
+ if (this.version.equals(UNDETERMINED_VERSION)) {
+ return v.equals(UNDETERMINED_VERSION) ? 0 : -1;
+ }
+ if (v.equals(UNDETERMINED_VERSION)) {
+ return 1;
+ }
+ return VersionComparator.INTEGER_VERSION_COMPARATOR.compare(this.version, v);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append(this.contentType.getName());
+ if ( ! this.version.equals(UNDETERMINED_VERSION)) {
+ sb.append(' ');
+ sb.append(this.version);
+ }
+ return sb.toString();
+ }
+}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/InternalJptResourceTypeManager.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/InternalJptResourceTypeManager.java
new file mode 100644
index 0000000000..bcdf3460b0
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/InternalJptResourceTypeManager.java
@@ -0,0 +1,321 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.RegistryFactory;
+import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.jpt.common.core.JptResourceType;
+import org.eclipse.jpt.common.core.JptResourceTypeManager;
+import org.eclipse.jpt.common.core.internal.plugin.JptCommonCorePlugin;
+import org.eclipse.jpt.common.core.internal.utility.XPointTools;
+import org.eclipse.jpt.common.utility.internal.SimpleAssociation;
+import org.eclipse.jpt.common.utility.internal.SimpleFilter;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SuperIterableWrapper;
+
+/**
+ * Resource type manager.
+ */
+public class InternalJptResourceTypeManager
+ implements JptResourceTypeManager
+{
+ private final InternalJptWorkspace jptWorkspace;
+
+ private final ArrayList<InternalJptResourceType> resourceTypes = new ArrayList<InternalJptResourceType>();
+
+
+ // ********** extension point element and attribute names **********
+
+ private static final String SIMPLE_EXTENSION_POINT_NAME = "resourceTypes"; //$NON-NLS-1$
+ private static final String RESOURCE_TYPE_ELEMENT = "resource-type"; //$NON-NLS-1$
+ private static final String ID_ATTRIBUTE = "id"; //$NON-NLS-1$
+ private static final String CONTENT_TYPE_ATTRIBUTE = "content-type"; //$NON-NLS-1$
+ private static final String VERSION_ATTRIBUTE = "version"; //$NON-NLS-1$
+ private static final String BASE_TYPE_ELEMENT = "base-type"; //$NON-NLS-1$
+
+
+ /**
+ * Internal - called from only
+ * {@link InternalJptWorkspace#buildResourceTypeManager()}.
+ */
+ public InternalJptResourceTypeManager(InternalJptWorkspace jptWorkspace) {
+ super();
+ this.jptWorkspace = jptWorkspace;
+ this.initialize();
+ }
+
+
+ // ********** initialization **********
+
+ private void initialize() {
+ IExtensionPoint extensionPoint = this.getExtensionPoint();
+ if (extensionPoint == null) {
+ throw new IllegalStateException("missing extension point: " + this.getExtensionPointName()); //$NON-NLS-1$
+ }
+
+ ArrayList<IConfigurationElement> resourceTypeElements = new ArrayList<IConfigurationElement>();
+
+ for (IExtension extension : extensionPoint.getExtensions()) {
+ for (IConfigurationElement element : extension.getConfigurationElements()) {
+ String elementName = element.getName(); // probably cannot be null
+ if (elementName.equals(RESOURCE_TYPE_ELEMENT)) {
+ resourceTypeElements.add(element);
+ }
+ }
+ }
+
+ // build up the resource type stubs...
+ LinkedList<SimpleAssociation<IConfigurationElement, InternalJptResourceType>> stubs = new LinkedList<SimpleAssociation<IConfigurationElement, InternalJptResourceType>>();
+ for (IConfigurationElement element : resourceTypeElements) {
+ InternalJptResourceType resourceType = this.buildResourceType(element);
+ if (resourceType != null) {
+ stubs.add(new SimpleAssociation<IConfigurationElement, InternalJptResourceType>(element, resourceType));
+ }
+ }
+
+ // ...then make multiple further passes to add the base resource types
+ int prev = -1;
+ while (this.resourceTypes.size() != prev) {
+ prev = this.resourceTypes.size();
+ this.buildBaseTypes(stubs.iterator());
+ }
+
+ // the remaining stub resource types have invalid base types
+ for (SimpleAssociation<IConfigurationElement, InternalJptResourceType> assoc : stubs) {
+ IConfigurationElement resourceTypeElement = assoc.getKey();
+ for (IConfigurationElement baseTypeElement : resourceTypeElement.getChildren(BASE_TYPE_ELEMENT)) {
+ String baseTypeID = baseTypeElement.getAttribute(ID_ATTRIBUTE);
+ InternalJptResourceType baseType = this.getResourceType(baseTypeID);
+ if (baseType == null) {
+ this.logInvalidBaseType(assoc.getValue(), baseTypeElement, baseTypeID);
+ }
+ }
+ }
+ }
+
+ /**
+ * Return <code>null</code> if there is any sort of problem building a
+ * resource type from the specified configuration element.
+ */
+ private InternalJptResourceType buildResourceType(IConfigurationElement element) {
+ String contributor = element.getContributor().getName();
+ // id
+ String id = element.getAttribute(ID_ATTRIBUTE);
+ if (StringTools.stringIsEmpty(id)) {
+ this.logMissingAttribute(element, ID_ATTRIBUTE);
+ return null;
+ }
+ if (this.containsResourceType(id)) {
+ this.logError(JptCommonCoreMessages.REGISTRY_DUPLICATE, this.getExtensionPointName(), contributor, ID_ATTRIBUTE, id);
+ return null; // drop any duplicate resource types
+ }
+
+ // content type
+ String contentTypeID = element.getAttribute(CONTENT_TYPE_ATTRIBUTE);
+ if (contentTypeID == null) {
+ this.logMissingAttribute(element, CONTENT_TYPE_ATTRIBUTE);
+ return null;
+ }
+ IContentType contentType = this.getContentType(contentTypeID);
+ if (contentType == null) {
+ this.logInvalidContentType(element, id, contentTypeID);
+ return null;
+ }
+
+ // version (optional)
+ String version = element.getAttribute(VERSION_ATTRIBUTE);
+ if (version == null) {
+ version = JptResourceType.UNDETERMINED_VERSION;
+ }
+
+ if (this.containsResourceType(contentType, version)) {
+ this.logError(JptCommonCoreMessages.REGISTRY_DUPLICATE, this.getExtensionPointName(), contributor, ID_ATTRIBUTE, id);
+ return null; // drop any duplicate resource types
+ }
+
+ InternalJptResourceType resourceType = new InternalJptResourceType(this, id, contentType, version);
+ resourceType.setPluginId(contributor);
+ return resourceType;
+ }
+
+ private IContentType getContentType(String contentTypeID) {
+ return Platform.getContentTypeManager().getContentType(contentTypeID);
+ }
+
+ /**
+ * Loop over the specified "stub" resource types, resolving the base types
+ * for each resource type and, if they are all resolved, set the resource
+ * type's base types and add the resource type to the manager's master
+ * list. As more resource types are added to the manager's master list,
+ * more base types will be resolved with later passes. This method is called
+ * repeatedly, until no more base types can be resolved.
+ * <p>
+ * <strong>NB:</strong> As a result of only adding resource types with
+ * resolved base types, there will be no loops in the "hierarchy" tree.
+ */
+ private void buildBaseTypes(Iterator<SimpleAssociation<IConfigurationElement, InternalJptResourceType>> stubStream) {
+ while (stubStream.hasNext()) {
+ SimpleAssociation<IConfigurationElement, InternalJptResourceType> next = stubStream.next();
+ IConfigurationElement resourceTypeElement = next.getKey();
+ InternalJptResourceType resourceType = next.getValue();
+ IConfigurationElement[] baseTypeElements = resourceTypeElement.getChildren(BASE_TYPE_ELEMENT);
+ boolean validBaseTypes = true;
+ HashSet<InternalJptResourceType> baseTypes = new HashSet<InternalJptResourceType>(baseTypeElements.length);
+ for (IConfigurationElement baseTypeElement : baseTypeElements) {
+ String baseTypeID = baseTypeElement.getAttribute(ID_ATTRIBUTE);
+ if (baseTypeID == null) {
+ this.logMissingAttribute(baseTypeElement, ID_ATTRIBUTE);
+ stubStream.remove(); // remove from further passes
+ validBaseTypes = false;
+ break;
+ }
+ InternalJptResourceType baseType = this.getResourceType(baseTypeID);
+ if (baseType != null) {
+ baseTypes.add(baseType);
+ } else {
+ // leave for further passes
+ validBaseTypes = false;
+ break;
+ }
+ }
+ // if all the base types are valid, set them on the resource type and
+ // remove the resource type from the list of stubs and add it to the master list
+ if (validBaseTypes) {
+ resourceType.setBaseTypes(baseTypes);
+ stubStream.remove();
+ this.resourceTypes.add(resourceType);
+ }
+ }
+ }
+
+
+ // ********** resource types **********
+
+ public Iterable<JptResourceType> getResourceTypes() {
+ return new SuperIterableWrapper<JptResourceType>(this.resourceTypes);
+ }
+
+ public Iterable<JptResourceType> getResourceTypes(IContentType contentType) {
+ return new FilteringIterable<JptResourceType>(this.getResourceTypes(), new ContentTypeFilter(contentType));
+ }
+
+ /* CU private */ class ContentTypeFilter
+ extends SimpleFilter<JptResourceType, IContentType>
+ {
+ ContentTypeFilter(IContentType contentType) {
+ super(contentType);
+ }
+ @Override
+ public boolean accept(JptResourceType resourceType) {
+ return resourceType.getContentType().equals(this.criterion);
+ }
+ }
+
+ private boolean containsResourceType(String id) {
+ return this.getResourceType(id) != null;
+ }
+
+ private InternalJptResourceType getResourceType(String id) {
+ for (InternalJptResourceType resourceType : this.resourceTypes) {
+ if (resourceType.getId().equals(id)) {
+ return resourceType;
+ }
+ }
+ return null;
+ }
+
+ public JptResourceType getResourceType(IContentType contentType) {
+ return this.getResourceType(contentType, JptResourceType.UNDETERMINED_VERSION);
+ }
+
+ private boolean containsResourceType(IContentType contentType, String version) {
+ return this.getResourceType(contentType, version) != null;
+ }
+
+ public JptResourceType getResourceType(IContentType contentType, String version) {
+ for (JptResourceType resourceType : this.resourceTypes) {
+ if (resourceType.getContentType().equals(contentType) && resourceType.getVersion().equals(version)) {
+ return resourceType;
+ }
+ }
+ return null;
+ }
+
+
+ // ********** logging **********
+
+ private void logError(String msg, Object... args) {
+ this.getPlugin().logError(msg, args);
+ }
+
+ private void logMissingAttribute(IConfigurationElement element, String attributeName) {
+ this.getPlugin().logError(XPointTools.buildMissingAttributeMessage(element, attributeName));
+ }
+
+ private void logInvalidContentType(IConfigurationElement element, String resourceTypeID, String contentTypeID) {
+ this.getPlugin().logError(JptCommonCoreMessages.RESOURCE_TYPE_INVALID_CONTENT_TYPE,
+ contentTypeID,
+ resourceTypeID,
+ element.getDeclaringExtension().getExtensionPointUniqueIdentifier(),
+ element.getContributor().getName()
+ );
+ }
+
+ private void logInvalidBaseType(InternalJptResourceType resourceType, IConfigurationElement element, String baseTypeID) {
+ this.getPlugin().logError(JptCommonCoreMessages.RESOURCE_TYPE_INVALID_BASE_TYPE,
+ baseTypeID,
+ resourceType.getId(),
+ element.getDeclaringExtension().getExtensionPointUniqueIdentifier(),
+ element.getContributor().getName()
+ );
+ }
+
+
+ // ********** misc **********
+
+ public InternalJptWorkspace getJptWorkspace() {
+ return this.jptWorkspace;
+ }
+
+ private String getExtensionPointName() {
+ return this.getPluginID() + '.' + SIMPLE_EXTENSION_POINT_NAME;
+ }
+
+ private IExtensionPoint getExtensionPoint() {
+ return this.getExtensionRegistry().getExtensionPoint(this.getPluginID(), SIMPLE_EXTENSION_POINT_NAME);
+ }
+
+ private IExtensionRegistry getExtensionRegistry() {
+ return RegistryFactory.getRegistry();
+ }
+
+ private String getPluginID() {
+ return this.getPlugin().getPluginID();
+ }
+
+ private JptCommonCorePlugin getPlugin() {
+ return JptCommonCorePlugin.instance();
+ }
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this, this.resourceTypes);
+ }
+}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/InternalJptWorkspace.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/InternalJptWorkspace.java
new file mode 100644
index 0000000000..428bb14749
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/InternalJptWorkspace.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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;
+
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.jpt.common.core.JptWorkspace;
+import org.eclipse.jpt.common.core.internal.plugin.JptCommonCorePlugin;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+
+public class InternalJptWorkspace
+ implements JptWorkspace
+{
+ private final IWorkspace workspace;
+
+ // NB: the Dali workspace must be synchronized whenever accessing any of this state
+ private InternalJptResourceTypeManager resourceTypeManager;
+
+
+ /**
+ * Internal: Called <em>only</em> by the
+ * {@link JptCommonCorePlugin#buildJptWorkspace(IWorkspace) Dali plug-in}.
+ */
+ public InternalJptWorkspace(IWorkspace workspace) {
+ super();
+ this.workspace = workspace;
+ }
+
+ public IWorkspace getWorkspace() {
+ return workspace;
+ }
+
+
+ // ********** Dali resource type manager **********
+
+ public synchronized InternalJptResourceTypeManager getResourceTypeManager() {
+ if ((this.resourceTypeManager == null) && this.isActive()) {
+ this.resourceTypeManager = this.buildResourceTypeManager();
+ }
+ return this.resourceTypeManager;
+ }
+
+ private InternalJptResourceTypeManager buildResourceTypeManager() {
+ return new InternalJptResourceTypeManager(this);
+ }
+
+
+ // ********** misc **********
+
+ private boolean isActive() {
+ return JptCommonCorePlugin.instance().isActive();
+ }
+
+ /**
+ * Internal: Called <em>only</em> by the
+ * {@link JptCommonCorePlugin#stop_() Dali plug-in}.
+ */
+ public synchronized void stop() {
+ if (this.resourceTypeManager != null) {
+ this.resourceTypeManager = null;
+ }
+ }
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this, this.workspace);
+ }
+}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/JptCommonCoreMessages.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/JptCommonCoreMessages.java
index b9e6e40681..1ea5070beb 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/JptCommonCoreMessages.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/JptCommonCoreMessages.java
@@ -16,13 +16,21 @@ import org.eclipse.osgi.util.NLS;
*/
public class JptCommonCoreMessages {
+ private static final String BUNDLE_NAME = "jpt_common_core"; //$NON-NLS-1$
+ private static final Class<?> BUNDLE_CLASS = JptCommonCoreMessages.class;
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, BUNDLE_CLASS);
+ }
+
public static String DALI_JOB_NAME;
public static String DALI_EVENT_HANDLER_THREAD_NAME;
public static String GENERATION_CREATING_LAUNCH_CONFIG_TASK;
public static String GENERATION_SAVING_LAUNCH_CONFIG_TASK;
public static String GENERATION_LAUNCHING_CONFIG_TASK;
+ public static String PREFERENCES_FLUSH_JOB_NAME;
public static String REGISTRY_MISSING_ATTRIBUTE;
public static String REGISTRY_INVALID_VALUE;
+ public static String REGISTRY_MISSING_BUNDLE;
public static String REGISTRY_DUPLICATE;
public static String REGISTRY_FAILED_CLASS_LOAD;
public static String REGISTRY_FAILED_INTERFACE_ASSIGNMENT;
@@ -31,13 +39,9 @@ public class JptCommonCoreMessages {
public static String VALIDATE_CONTAINER_NOT_SPECIFIED;
public static String VALIDATE_FILE_NAME_NOT_SPECIFIED;
public static String VALIDATE_FILE_ALREADY_EXISTS;
-
- private static final String BUNDLE_NAME = "jpt_common_core"; //$NON-NLS-1$
- private static final Class<?> BUNDLE_CLASS = JptCommonCoreMessages.class;
- static {
- NLS.initializeMessages(BUNDLE_NAME, BUNDLE_CLASS);
- }
-
+ public static String RESOURCE_TYPE_INVALID_CONTENT_TYPE;
+ public static String RESOURCE_TYPE_INVALID_BASE_TYPE;
+
private JptCommonCoreMessages() {
throw new UnsupportedOperationException();
}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/JptPlugin.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/JptPlugin.java
deleted file mode 100644
index 52be7123d1..0000000000
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/JptPlugin.java
+++ /dev/null
@@ -1,280 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.osgi.service.debug.DebugOptions;
-import org.osgi.framework.BundleContext;
-import org.osgi.util.tracker.ServiceTracker;
-
-/**
- * Common Dali plug-in behavior.
- */
-public abstract class JptPlugin
- extends Plugin
-{
- protected BundleContext bundleContext;
- protected ServiceTracker<DebugOptions, DebugOptions> debugOptionsServiceTracker;
-
-
- protected JptPlugin() {
- super();
- }
-
-
- // ********** logging **********
-
- /**
- * Log the specified message with a severity of
- * {@link IStatus#ERROR ERROR}.
- * @see #log(int, String)
- * @see IStatus
- */
- public void logError(String message) {
- this.log(IStatus.ERROR, message);
- }
-
- /**
- * Log the specified message with the specified severity.
- * @see IStatus#getSeverity()
- */
- public void log(int severity, String message) {
- this.log(severity, message, null);
- }
-
- /**
- * Log the specified exception or error with a severity of
- * {@link IStatus#ERROR ERROR}.
- * @see #log(int, Throwable)
- * @see IStatus
- */
- public void logError(Throwable throwable) {
- this.log(IStatus.ERROR, throwable);
- }
-
- /**
- * Log the specified exception or error with the specified severity.
- * @see IStatus#getSeverity()
- */
- public void log(int severity, Throwable throwable) {
- this.log(severity, throwable.getLocalizedMessage(), throwable);
- }
-
- /**
- * Log the specified message and exception or error with a severity of
- * {@link IStatus#ERROR ERROR}.
- * @see #log(int, String, Throwable)
- * @see IStatus
- */
- public void logError(String msg, Throwable throwable) {
- this.log(IStatus.ERROR, msg, throwable);
- }
-
- /**
- * Log the specified message and exception or error
- * with the specified severity.
- * @see IStatus#getSeverity()
- * @see IStatus#getCode()
- */
- public void log(int severity, String msg, Throwable throwable) {
- this.log(severity, IStatus.OK, msg, throwable);
- }
-
- /**
- * Log the specified message and exception or error
- * with the specified severity and code.
- * @see IStatus#getSeverity()
- * @see IStatus#getCode()
- */
- public void log(int severity, int code, String msg, Throwable throwable) {
- this.getLog().log(new Status(severity, this.getPluginID(), code, msg, throwable));
- }
-
-
- // ********** debug options **********
-
- /**
- * Return the specified debug option as a <code>boolean</code> value.
- * Return <code>false</code> if no such option is found.
- * <p>
- * The debug option is within the scope of the plug-in's debug options
- * (e.g. for the plug-in <code>"org.eclipse.jpt.common.core"</code>,
- * the specified option <code>"foo"</code> will be mapped to
- * the {@link Platform} option
- * <code>"org.eclipse.jpt.common.core/debug/foo"</code>).
- */
- public boolean getBooleanDebugOption(String option) {
- return this.getBooleanDebugOption(option, false);
- }
-
- /**
- * Return the specified debug option as a <code>boolean</code> value.
- * Return the specified default value if no such option is found.
- * <p>
- * The debug option is within the scope of the plug-in's debug options
- * (e.g. for the plug-in <code>"org.eclipse.jpt.common.core"</code>,
- * the specified option <code>"foo"</code> will be mapped to
- * the {@link Platform} option
- * <code>"org.eclipse.jpt.common.core/debug/foo"</code>).
- */
- public boolean getBooleanDebugOption(String option, boolean defaultValue) {
- String value = this.getDebugOption(option);
- return (value == null) ? defaultValue : Boolean.parseBoolean(value.trim());
- }
-
- /**
- * Return the specified debug option as an <code>int</code> value.
- * Return <code>-1</code> if no such option is found.
- * <p>
- * The debug option is within the scope of the plug-in's debug options
- * (e.g. for the plug-in <code>"org.eclipse.jpt.common.core"</code>,
- * the specified option <code>"foo"</code> will be mapped to
- * the {@link Platform} option
- * <code>"org.eclipse.jpt.common.core/debug/foo"</code>).
- */
- public int getIntegerDebugOption(String option) {
- return this.getIntegerDebugOption(option, -1);
- }
-
- /**
- * Return the specified debug option as an <code>int</code> value.
- * Return the specified default value if no such option is found.
- * <p>
- * The debug option is within the scope of the plug-in's debug options
- * (e.g. for the plug-in <code>"org.eclipse.jpt.common.core"</code>,
- * the specified option <code>"foo"</code> will be mapped to
- * the {@link Platform} option
- * <code>"org.eclipse.jpt.common.core/debug/foo"</code>).
- */
- public int getIntegerDebugOption(String option, int defaultValue) {
- String value = this.getDebugOption(option);
- return (value == null) ? defaultValue : Integer.parseInt(value.trim());
- }
-
- /**
- * Return the specified debug option.
- * Return <code>null</code> if no such option is found.
- * <p>
- * The debug option is within the scope of the plug-in's debug options
- * (e.g. for the plug-in <code>"org.eclipse.jpt.common.core"</code>,
- * the specified option <code>"foo"</code> will be mapped to
- * the {@link Platform} option
- * <code>"org.eclipse.jpt.common.core/debug/foo"</code>).
- */
- public String getDebugOption(String option) {
- return this.getDebugOption(option, null);
- }
-
- /**
- * Return the specified debug option.
- * Return the specified default value if no such option is found.
- * <p>
- * The debug option is within the scope of the plug-in's debug options
- * (e.g. for the plug-in <code>"org.eclipse.jpt.common.core"</code>,
- * the specified option <code>"foo"</code> will be mapped to
- * the {@link Platform} option
- * <code>"org.eclipse.jpt.common.core/debug/foo"</code>).
- */
- public String getDebugOption(String option, String defaultValue) {
- return this.isDebugging() ? this.getDebugOption_(option, defaultValue) : defaultValue;
- }
-
- protected String getDebugOption_(String option, String defaultValue) {
- if (StringTools.stringIsEmpty(option)) {
- throw new IllegalArgumentException("debug option cannot be blank"); //$NON-NLS-1$
- }
- String value = this.getDebugOption_(option);
- return (value != null) ? value : defaultValue;
- }
-
- protected String getDebugOption_(String option) {
- DebugOptions debugOptions = this.getDebugOptions();
- return (debugOptions == null) ? null : debugOptions.getOption(this.getPluginDebugOption() + option);
- }
-
- protected DebugOptions getDebugOptions() {
- ServiceTracker<DebugOptions, DebugOptions> tracker = this.getDebugOptionsServiceTracker();
- return (tracker == null) ? null : tracker.getService();
- }
-
- private synchronized ServiceTracker<DebugOptions, DebugOptions> getDebugOptionsServiceTracker() {
- if (this.isActive() && (this.debugOptionsServiceTracker == null)) {
- this.debugOptionsServiceTracker = this.buildDebugOptionsServiceTracker();
- this.debugOptionsServiceTracker.open();
- }
- return this.debugOptionsServiceTracker;
- }
-
- private ServiceTracker<DebugOptions, DebugOptions> buildDebugOptionsServiceTracker() {
- return new ServiceTracker<DebugOptions, DebugOptions>(this.bundleContext, DebugOptions.class, null);
- }
-
- /**
- * Return the plug-in's debug option path.
- */
- protected String getPluginDebugOption() {
- return this.getPluginID() + DEBUG_OPTION_SCOPE;
- }
- protected static final String DEBUG_OPTION_SCOPE = "/debug/"; //$NON-NLS-1$
-
-
- // ********** plug-in lifecycle **********
-
- @Override
- public synchronized void start(BundleContext context) throws Exception {
- super.start(context);
- this.bundleContext = context;
- }
-
- @Override
- public synchronized void stop(BundleContext context) throws Exception {
- try {
- this.stop_();
- } finally {
- this.bundleContext = null;
- super.stop(context);
- }
- }
-
- protected void stop_() throws Exception {
- if (this.debugOptionsServiceTracker != null) {
- this.debugOptionsServiceTracker.close();
- this.debugOptionsServiceTracker = null;
- }
- }
-
-
- // ********** misc **********
-
- public String getPluginID() {
- return this.getBundle().getSymbolicName();
- }
-
- /**
- * Return whether the plug-in is active; i.e. it has been
- * {@link #start(BundleContext) started}.
- */
- public synchronized boolean isActive() {
- return this.bundleContext != null;
- }
-
- /**
- * Return whether the plug-in is inactive; i.e. it has been
- * {@link #stop(BundleContext) stopped} or not yet
- * {@link #start(BundleContext) started}.
- */
- public boolean isInactive() {
- return ! this.isActive();
- }
-}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/JptResourceTypeReferencePropertyTester.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/JptResourceTypeReferencePropertyTester.java
new file mode 100644
index 0000000000..9a5138089f
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/JptResourceTypeReferencePropertyTester.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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;
+
+import java.util.regex.Pattern;
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.jpt.common.core.JptResourceType;
+import org.eclipse.jpt.common.core.JptResourceTypeReference;
+import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
+
+/**
+ * Property tester for {@link JptResourceTypeReference}.
+ * See <code>org.eclipse.jpt.common.core/plugin.xml:org.eclipse.core.expressions.propertyTesters</code>
+ * @see JptResourceType#isKindOf(JptResourceType)
+ */
+public class JptResourceTypeReferencePropertyTester
+ extends PropertyTester
+{
+ /**
+ * To test a {@link JptResourceTypeReference resource type reference}, specify
+ * the resource type identifier and, optionally, a version; using the format
+ * <code>"<em>&lt;resource-type-id&gt;</em>:<em>&lt;version&gt;</em>"</code>
+ * (e.g. <code>"org.eclipse.jpt.jpa.eclipselink.core.content.orm:2.1"</code>)
+ */
+ public static final String RESOURCE_TYPE_IS_KIND_OF = "resourceTypeIsKindOf"; //$NON-NLS-1$
+ public static final Pattern RESOURCE_TYPE_PATTERN = Pattern.compile(":"); //$NON-NLS-1$
+
+
+ public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
+ if (receiver instanceof JptResourceTypeReference) {
+ return this.test((JptResourceTypeReference) receiver, property, expectedValue);
+ }
+ return false;
+ }
+
+ private boolean test(JptResourceTypeReference ref, String property, Object expectedValue) {
+ if (property.equals(RESOURCE_TYPE_IS_KIND_OF)) {
+ return this.resourceTypeIsKindOf(ref, (String) expectedValue);
+ }
+ return false;
+ }
+
+ private boolean resourceTypeIsKindOf(JptResourceTypeReference ref, String expectedValue) {
+ return this.resourceTypeIsKindOf(ref, RESOURCE_TYPE_PATTERN.split(expectedValue));
+ }
+
+ private boolean resourceTypeIsKindOf(JptResourceTypeReference ref, String[] subStrings) {
+ int len = subStrings.length;
+ if ((len < 1) || (len > 2)) {
+ return false;
+ }
+ String contentTypeID = subStrings[0];
+ String version = (len == 2) ? subStrings[1] : JptResourceType.UNDETERMINED_VERSION;
+ return this.resourceTypeIsKindOf(ref, contentTypeID, version);
+ }
+
+ private boolean resourceTypeIsKindOf(JptResourceTypeReference ref, String contentTypeID, String version) {
+ IContentType contentType = this.getContentType(contentTypeID);
+ return (contentType != null) && this.resourceTypeIsKindOf(ref, contentType, version);
+ }
+
+ private IContentType getContentType(String contentTypeID) {
+ return Platform.getContentTypeManager().getContentType(contentTypeID);
+ }
+
+ private boolean resourceTypeIsKindOf(JptResourceTypeReference ref, IContentType contentType, String version) {
+ JptResourceType resourceType = PlatformTools.getResourceType(contentType, version);
+ return (resourceType != null) && ref.getResourceType().isKindOf(resourceType);
+ }
+}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/LibraryProviderPropertyTester.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/LibraryProviderPropertyTester.java
index 0f3e21f034..b4f146b6f1 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/LibraryProviderPropertyTester.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/LibraryProviderPropertyTester.java
@@ -14,7 +14,7 @@ import org.eclipse.jst.common.project.facet.core.libprov.ILibraryProvider;
/**
* Property tester for {@link ILibraryProvider}.
- * See <code>org.eclipse.jpt.common.core/plugin.xml</code>
+ * See <code>org.eclipse.jpt.common.core/plugin.xml:org.eclipse.core.expressions.propertyTesters</code>
*/
public class LibraryProviderPropertyTester
extends PropertyTester
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/WorkspaceAdapterFactory.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/WorkspaceAdapterFactory.java
new file mode 100644
index 0000000000..2aac1647d5
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/WorkspaceAdapterFactory.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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;
+
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.jpt.common.core.JptWorkspace;
+import org.eclipse.jpt.common.core.internal.plugin.JptCommonCorePlugin;
+
+/**
+ * Factory to build Dali adapters for an {@link IWorkspace Eclipse workspace}:<ul>
+ * <li>{@link org.eclipse.jpt.common.core.JptWorkspace}
+ * </ul>
+ * See <code>org.eclipse.jpt.common.core/plugin.xml:org.eclipse.core.runtime.adapters</code>.
+ */
+public class WorkspaceAdapterFactory
+ implements IAdapterFactory
+{
+ private static final Class<?>[] ADAPTER_LIST = new Class[] {
+ JptWorkspace.class
+ };
+
+ public Class<?>[] getAdapterList() {
+ return ADAPTER_LIST;
+ }
+
+ public Object getAdapter(Object adaptableObject, @SuppressWarnings("rawtypes") Class adapterType) {
+ if (adaptableObject instanceof IWorkspace) {
+ return this.getAdapter((IWorkspace) adaptableObject, adapterType);
+ }
+ return null;
+ }
+
+ private Object getAdapter(IWorkspace workspace, Class<?> adapterType) {
+ if (adapterType == JptWorkspace.class) {
+ return this.getJptWorkspace(workspace);
+ }
+ return null;
+ }
+
+ private JptWorkspace getJptWorkspace(IWorkspace workspace) {
+ return JptCommonCorePlugin.instance().getJptWorkspace(workspace);
+ }
+}
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/content/IndeterminateContentDescriber.java
new file mode 100644
index 0000000000..5d2dcc3d3f
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/content/IndeterminateContentDescriber.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2012 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.content;
+
+import java.io.InputStream;
+import java.io.Reader;
+import org.eclipse.core.runtime.QualifiedName;
+import org.eclipse.core.runtime.content.IContentDescription;
+import org.eclipse.core.runtime.content.ITextContentDescriber;
+
+/**
+ * This describer returns {@link #INDETERMINATE} for any content.
+ * <p>
+ * This is in its own package so it can be excluded from bundle
+ * activation in the <code>META-INF/MANIFEST.MF</code> file.
+ * To be excluded, content describers must be self-contained and
+ * not trigger bundle auto-activation.
+ */
+public class IndeterminateContentDescriber
+ implements ITextContentDescriber
+{
+ public int describe(InputStream contents, IContentDescription description) {
+ return INDETERMINATE;
+ }
+
+ public int describe(Reader contents, IContentDescription description) {
+ return INDETERMINATE;
+ }
+
+ public QualifiedName[] getSupportedOptions() {
+ return EMPTY_QUALIFIED_NAME_ARRAY;
+ }
+ private static final QualifiedName[] EMPTY_QUALIFIED_NAME_ARRAY = new QualifiedName[0];
+}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/gen/AbstractJptGenerator.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/gen/AbstractJptGenerator.java
index 936f15ddb3..a284bb3370 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/gen/AbstractJptGenerator.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/gen/AbstractJptGenerator.java
@@ -1,12 +1,12 @@
/*******************************************************************************
-* Copyright (c) 2008, 2012 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
-*******************************************************************************/
+ * Copyright (c) 2008, 2012 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.gen;
import java.io.File;
@@ -14,7 +14,6 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.FileLocator;
@@ -38,10 +37,10 @@ import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
import org.eclipse.jdt.launching.IVMInstall;
import org.eclipse.jdt.launching.JavaRuntime;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
import org.eclipse.jpt.common.core.gen.JptGenerator;
import org.eclipse.jpt.common.core.gen.LaunchConfigListener;
import org.eclipse.jpt.common.core.internal.JptCommonCoreMessages;
+import org.eclipse.jpt.common.core.internal.plugin.JptCommonCorePlugin;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.ListenerList;
import org.eclipse.osgi.service.datalocation.Location;
@@ -367,7 +366,7 @@ public abstract class AbstractJptGenerator implements JptGenerator
protected IPath findGenJarStartingWith(String genJarName) {
try {
- File jarInstallDir = this.getBundleParentDir(JptCommonCorePlugin.PLUGIN_ID);
+ File jarInstallDir = this.getBundleParentDir(JptCommonCorePlugin.instance().getBundle());
List<File> result = new ArrayList<File>();
this.findFileStartingWith(genJarName, jarInstallDir, result);
@@ -385,7 +384,7 @@ public abstract class AbstractJptGenerator implements JptGenerator
// ********** private methods **********
- private File getBundleParentDir(String bundleName) throws IOException {
+ private File getBundleParentDir(Bundle bundle) throws IOException {
if (Platform.inDevelopmentMode()) {
Location eclipseHomeLoc = Platform.getInstallLocation();
@@ -395,7 +394,6 @@ public abstract class AbstractJptGenerator implements JptGenerator
}
return new File(eclipseHome);
}
- Bundle bundle = Platform.getBundle(bundleName);
return FileLocator.getBundleFile(bundle).getParentFile();
}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/libprov/JptOsgiBundlesLibraryProviderInstallOperationConfig.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/libprov/JptOsgiBundlesLibraryProviderInstallOperationConfig.java
index b91c73b440..1780d76199 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/libprov/JptOsgiBundlesLibraryProviderInstallOperationConfig.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/libprov/JptOsgiBundlesLibraryProviderInstallOperationConfig.java
@@ -1,17 +1,17 @@
/*******************************************************************************
- * Copyright (c) 2010, 2011 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
- *******************************************************************************/
+ * Copyright (c) 2010, 2012 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.libprov;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
+import org.eclipse.jpt.common.core.internal.libval.LibraryValidatorManager;
import org.eclipse.jpt.common.core.libprov.JptLibraryProviderInstallOperationConfig;
import org.eclipse.jpt.common.core.libval.LibraryValidator;
import org.eclipse.jst.j2ee.internal.common.classpath.WtpOsgiBundlesLibraryProviderInstallOperationConfig;
@@ -33,7 +33,7 @@ public abstract class JptOsgiBundlesLibraryProviderInstallOperationConfig
return status;
}
- for (LibraryValidator libraryValidator : JptCommonCorePlugin.getLibraryValidators(this)) {
+ for (LibraryValidator libraryValidator : LibraryValidatorManager.instance().getLibraryValidators(this)) {
status = libraryValidator.validate(this);
if (! status.isOK()) {
return status;
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/libprov/JptUserLibraryProviderInstallOperationConfig.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/libprov/JptUserLibraryProviderInstallOperationConfig.java
index 224f52afe2..b4285ba21e 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/libprov/JptUserLibraryProviderInstallOperationConfig.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/libprov/JptUserLibraryProviderInstallOperationConfig.java
@@ -1,17 +1,17 @@
/*******************************************************************************
- * Copyright (c) 2010, 2011 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
- *******************************************************************************/
+ * Copyright (c) 2010, 2012 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.libprov;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
+import org.eclipse.jpt.common.core.internal.libval.LibraryValidatorManager;
import org.eclipse.jpt.common.core.libprov.JptLibraryProviderInstallOperationConfig;
import org.eclipse.jpt.common.core.libval.LibraryValidator;
import org.eclipse.jst.j2ee.internal.common.classpath.WtpUserLibraryProviderInstallOperationConfig;
@@ -33,7 +33,7 @@ public abstract class JptUserLibraryProviderInstallOperationConfig
return status;
}
- for (LibraryValidator libraryValidator : JptCommonCorePlugin.getLibraryValidators(this)) {
+ for (LibraryValidator libraryValidator : LibraryValidatorManager.instance().getLibraryValidators(this)) {
status = libraryValidator.validate(this);
if (! status.isOK()) {
return status;
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/libval/LibValUtil.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/libval/LibValUtil.java
index 34afb0c83b..1c7a55faf0 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/libval/LibValUtil.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/libval/LibValUtil.java
@@ -1,15 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2011 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
- *******************************************************************************/
+ * Copyright (c) 2011, 2012 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.libval;
-import static org.eclipse.jst.common.project.facet.core.internal.FacetedProjectFrameworkJavaPlugin.PLUGIN_ID;
import java.io.File;
import java.io.IOException;
import java.util.Enumeration;
@@ -23,7 +22,7 @@ import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jpt.common.core.internal.JptCommonCoreMessages;
-import org.eclipse.osgi.util.NLS;
+import org.eclipse.jpt.common.core.internal.plugin.JptCommonCorePlugin;
public class LibValUtil {
@@ -79,11 +78,8 @@ public class LibValUtil {
final int count = entry.getValue();
if (count == 0) {
- final String classFileName = entry.getKey();
- final String className = classFileNameToClassName.get(classFileName);
- final String message =
- NLS.bind(JptCommonCoreMessages.USER_LIBRARY_VALIDATOR__CLASS_NOT_FOUND, className);
- return new Status(IStatus.ERROR, PLUGIN_ID, message);
+ final String className = classFileNameToClassName.get(entry.getKey());
+ return JptCommonCorePlugin.instance().buildErrorStatus(JptCommonCoreMessages.USER_LIBRARY_VALIDATOR__CLASS_NOT_FOUND, className);
}
}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/libval/LibraryValidatorManager.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/libval/LibraryValidatorManager.java
index ce7c2eb179..aba3b4a5bc 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/libval/LibraryValidatorManager.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/libval/LibraryValidatorManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2012 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.
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.common.core.internal.libval;
-import static org.eclipse.jpt.common.core.internal.utility.XPointTools.*;
+import static org.eclipse.jpt.common.core.internal.utility.XPointTools.findRequiredAttribute;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.expressions.Expression;
@@ -20,7 +20,8 @@ import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.Platform;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
+import org.eclipse.jpt.common.core.internal.JptCommonCoreMessages;
+import org.eclipse.jpt.common.core.internal.plugin.JptCommonCorePlugin;
import org.eclipse.jpt.common.core.internal.utility.XPointTools.XPointException;
import org.eclipse.jpt.common.core.libprov.JptLibraryProviderInstallOperationConfig;
import org.eclipse.jpt.common.core.libval.LibraryValidator;
@@ -31,7 +32,7 @@ import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
public class LibraryValidatorManager {
public static final String EXTENSION_POINT_ID = "libraryValidators"; //$NON-NLS-1$
- public static final String QUALIFIED_EXTENSION_POINT_ID = JptCommonCorePlugin.PLUGIN_ID_ + EXTENSION_POINT_ID;
+ public static final String QUALIFIED_EXTENSION_POINT_ID = JptCommonCorePlugin.instance().getPluginID() + '.' + EXTENSION_POINT_ID;
public static final String LIBRARY_VALIDATOR_ELEMENT = "libraryValidator"; //$NON-NLS-1$
public static final String ID_ATTRIBUTE = "id"; //$NON-NLS-1$
public static final String CLASS_ATTRIBUTE = "class"; //$NON-NLS-1$
@@ -116,7 +117,7 @@ public class LibraryValidatorManager {
lvConfig.setId(findRequiredAttribute(element, ID_ATTRIBUTE));
if (this.libraryValidatorConfigs.containsKey(lvConfig.getId())) {
- logDuplicateExtension(QUALIFIED_EXTENSION_POINT_ID, ID_ATTRIBUTE, lvConfig.getId());
+ JptCommonCorePlugin.instance().logError(JptCommonCoreMessages.REGISTRY_DUPLICATE, QUALIFIED_EXTENSION_POINT_ID, lvConfig.getPluginId(), ID_ATTRIBUTE, lvConfig.getId());
throw new XPointException();
}
@@ -132,7 +133,7 @@ public class LibraryValidatorManager {
expr = ExpressionConverter.getDefault().perform(child);
}
catch (CoreException e) {
- log(e);
+ JptCommonCorePlugin.instance().logError(e);
throw new XPointException();
}
lvConfig.setEnablementCondition(expr);
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/operations/AbstractJptFileCreationDataModelProvider.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/operations/AbstractJptFileCreationDataModelProvider.java
index 1106f12032..ed49e5a558 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/operations/AbstractJptFileCreationDataModelProvider.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/operations/AbstractJptFileCreationDataModelProvider.java
@@ -16,8 +16,8 @@ import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
import org.eclipse.jpt.common.core.internal.JptCommonCoreMessages;
+import org.eclipse.jpt.common.core.internal.plugin.JptCommonCorePlugin;
import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
import org.eclipse.jpt.common.core.resource.ProjectResourceLocator;
import org.eclipse.jpt.common.utility.internal.StringTools;
@@ -80,24 +80,18 @@ public abstract class AbstractJptFileCreationDataModelProvider
if (container == null) {
// verifies container has been specified, but should be unnecessary in most cases.
// there is almost always a default, and the new file wizard does this validation as well.
- return new Status(
- IStatus.ERROR, JptCommonCorePlugin.PLUGIN_ID,
- JptCommonCoreMessages.VALIDATE_CONTAINER_NOT_SPECIFIED);
+ return JptCommonCorePlugin.instance().buildErrorStatus(JptCommonCoreMessages.VALIDATE_CONTAINER_NOT_SPECIFIED);
}
String fileName = getStringProperty(FILE_NAME);
if (StringTools.stringIsEmpty(fileName)) {
// verifies file name has been specified, but should be unnecessary in most cases.
// there is almost always a default, and the new file wizard does this validation as well.
- return new Status(
- IStatus.ERROR, JptCommonCorePlugin.PLUGIN_ID,
- JptCommonCoreMessages.VALIDATE_FILE_NAME_NOT_SPECIFIED);
+ return JptCommonCorePlugin.instance().buildErrorStatus(JptCommonCoreMessages.VALIDATE_FILE_NAME_NOT_SPECIFIED);
}
if (container.getFile(new Path(fileName)).exists()) {
// verifies file does not exist, but should be unnecessary in most cases.
// the new file wizard does this validation as well.
- return new Status(
- IStatus.ERROR, JptCommonCorePlugin.PLUGIN_ID,
- JptCommonCoreMessages.VALIDATE_FILE_ALREADY_EXISTS);
+ return JptCommonCorePlugin.instance().buildErrorStatus(JptCommonCoreMessages.VALIDATE_FILE_ALREADY_EXISTS);
}
return Status.OK_STATUS;
}
@@ -111,17 +105,11 @@ public abstract class AbstractJptFileCreationDataModelProvider
protected IContainer getContainer() {
IPath containerPath = getContainerPath();
- if (containerPath == null) {
- return null;
- }
- return PlatformTools.getContainer(containerPath);
+ return (containerPath == null) ? null : PlatformTools.getContainer(containerPath);
}
protected IProject getProject() {
- return getProject(getContainer());
- }
-
- protected IProject getProject(IContainer container) {
+ IContainer container = this.getContainer();
return (container == null) ? null : container.getProject();
}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/plugin/JptCommonCorePlugin.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/plugin/JptCommonCorePlugin.java
new file mode 100644
index 0000000000..60fef30fcf
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/plugin/JptCommonCorePlugin.java
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012 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.plugin;
+
+import java.util.HashMap;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.jpt.common.core.internal.InternalJptWorkspace;
+import org.eclipse.jpt.common.core.internal.utility.JptPlugin;
+
+public class JptCommonCorePlugin
+ extends JptPlugin
+{
+ // NB: the plug-in must be synchronized whenever accessing any of this state
+ private final HashMap<IWorkspace, InternalJptWorkspace> jptWorkspaces = new HashMap<IWorkspace, InternalJptWorkspace>();
+
+
+ // ********** singleton **********
+
+ private static volatile JptCommonCorePlugin INSTANCE;
+
+ /**
+ * Return the singleton Dali common core plug-in.
+ */
+ public static JptCommonCorePlugin instance() {
+ return INSTANCE;
+ }
+
+
+ // ********** Dali plug-in **********
+
+ public JptCommonCorePlugin() {
+ super();
+ }
+
+ @Override
+ protected void setInstance(JptPlugin plugin) {
+ INSTANCE = (JptCommonCorePlugin) plugin;
+ }
+
+ @Override
+ protected void stop_() throws Exception {
+ try {
+ for (InternalJptWorkspace jptWorkspace : this.jptWorkspaces.values()) {
+ try {
+ jptWorkspace.stop();
+ } catch (Throwable ex) {
+ this.logError(ex); // keep going
+ }
+ }
+ this.jptWorkspaces.clear();
+ } finally {
+ super.stop_();
+ }
+ }
+
+
+ // ********** Dali workspaces **********
+
+ /**
+ * Return the Dali workspace corresponding to the specified Eclipse workspace.
+ * <p>
+ * The preferred way to retrieve a Dali workspace is via the Eclipse
+ * adapter framework:
+ * <pre>
+ * JptWorkspace jptWorkspace = (JptWorkspace) ResourcesPlugin.getWorkspace().getAdapter(JptWorkspace.class)
+ * </pre>
+ * @see org.eclipse.jpt.common.core.internal.WorkspaceAdapterFactory#getJptWorkspace(IWorkspace)
+ */
+ public synchronized InternalJptWorkspace getJptWorkspace(IWorkspace workspace) {
+ InternalJptWorkspace jptWorkspace = this.jptWorkspaces.get(workspace);
+ if ((jptWorkspace == null) && this.isActive()) {
+ jptWorkspace = this.buildJptWorkspace(workspace);
+ this.jptWorkspaces.put(workspace, jptWorkspace);
+ }
+ return jptWorkspace;
+ }
+
+ private InternalJptWorkspace buildJptWorkspace(IWorkspace workspace) {
+ return new InternalJptWorkspace(workspace);
+ }
+}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/ModuleResourceLocator.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/ModuleResourceLocator.java
index d76318d249..3409d2bdf2 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/ModuleResourceLocator.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/ModuleResourceLocator.java
@@ -14,7 +14,7 @@ import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
+import org.eclipse.jpt.common.core.internal.plugin.JptCommonCorePlugin;
import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
import org.eclipse.wst.common.componentcore.ComponentCore;
import org.eclipse.wst.common.componentcore.resources.IVirtualFile;
@@ -53,7 +53,7 @@ public class ModuleResourceLocator
try {
return this.getVirtualFile_(vFolder, file);
} catch (CoreException ex) {
- JptCommonCorePlugin.log(ex);
+ JptCommonCorePlugin.instance().logError(ex);
return null;
}
}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/PluginResourceLocator.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/PluginResourceLocator.java
index 2e8f070000..b6b5dc450a 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/PluginResourceLocator.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/PluginResourceLocator.java
@@ -14,7 +14,7 @@ import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
+import org.eclipse.jpt.common.core.internal.plugin.JptCommonCorePlugin;
import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
import org.eclipse.pde.core.project.IBundleProjectService;
import org.osgi.framework.BundleContext;
@@ -60,7 +60,7 @@ public class PluginResourceLocator
return this.getBundleRoot_(project);
} catch (CoreException ex) {
// problem creating description on an existing project
- JptCommonCorePlugin.log(ex);
+ JptCommonCorePlugin.instance().logError(ex);
return null;
}
}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/ProjectAdapterFactory.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/ProjectAdapterFactory.java
index 1b0e356297..5006b4e782 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/ProjectAdapterFactory.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/ProjectAdapterFactory.java
@@ -17,7 +17,7 @@ import org.eclipse.jpt.common.core.resource.ProjectResourceLocator;
* Factory to build Dali adapters for an {@link IProject}:<ul>
* <li>{@link org.eclipse.jpt.common.core.resource.ProjectResourceLocator}
* </ul>
- * See <code>org.eclipse.jpt.common.core/plugin.xml</code>.
+ * See <code>org.eclipse.jpt.common.core/plugin.xml:org.eclipse.core.runtime.adapters</code>.
*/
public class ProjectAdapterFactory
implements IAdapterFactory
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/ResourceLocatorManager.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/ResourceLocatorManager.java
index ad71031646..0320331a41 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/ResourceLocatorManager.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/ResourceLocatorManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2012 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.
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.common.core.internal.resource;
-import static org.eclipse.jpt.common.core.internal.utility.XPointTools.*;
+import static org.eclipse.jpt.common.core.internal.utility.XPointTools.findRequiredAttribute;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.expressions.Expression;
@@ -21,8 +21,10 @@ import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.Platform;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
+import org.eclipse.jpt.common.core.internal.JptCommonCoreMessages;
+import org.eclipse.jpt.common.core.internal.plugin.JptCommonCorePlugin;
import org.eclipse.jpt.common.core.internal.resource.ResourceLocatorConfig.Priority;
+import org.eclipse.jpt.common.core.internal.utility.XPointTools;
import org.eclipse.jpt.common.core.internal.utility.XPointTools.XPointException;
import org.eclipse.jpt.common.core.resource.ResourceLocator;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
@@ -32,7 +34,7 @@ import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
public class ResourceLocatorManager {
public static final String EXTENSION_POINT_ID = "resourceLocators"; //$NON-NLS-1$
- public static final String QUALIFIED_EXTENSION_POINT_ID = JptCommonCorePlugin.PLUGIN_ID_ + EXTENSION_POINT_ID;
+ public static final String QUALIFIED_EXTENSION_POINT_ID = JptCommonCorePlugin.instance().getPluginID() + '.' + EXTENSION_POINT_ID;
public static final String RESOURCE_LOCATOR_ELEMENT = "resourceLocator"; //$NON-NLS-1$
public static final String ID_ATTRIBUTE = "id"; //$NON-NLS-1$
public static final String CLASS_ATTRIBUTE = "class"; //$NON-NLS-1$
@@ -118,7 +120,7 @@ public class ResourceLocatorManager {
rlConfig.setId(findRequiredAttribute(element, ID_ATTRIBUTE));
if (this.resourceLocatorConfigs.containsKey(rlConfig.getId())) {
- logDuplicateExtension(QUALIFIED_EXTENSION_POINT_ID, ID_ATTRIBUTE, rlConfig.getId());
+ JptCommonCorePlugin.instance().logError(JptCommonCoreMessages.REGISTRY_DUPLICATE, QUALIFIED_EXTENSION_POINT_ID, rlConfig.getPluginId(), ID_ATTRIBUTE, rlConfig.getId());
throw new XPointException();
}
@@ -129,7 +131,7 @@ public class ResourceLocatorManager {
String priorityString = element.getAttribute(PRIORITY_ATTRIBUTE).trim();
Priority priority = Priority.get(priorityString);
if (priority == null) {
- logInvalidValue(element, PRIORITY_ATTRIBUTE, priorityString);
+ JptCommonCorePlugin.instance().logError(XPointTools.buildInvalidValueMessage(element, PRIORITY_ATTRIBUTE, priorityString));
throw new XPointException();
}
rlConfig.setPriority(priority);
@@ -143,7 +145,7 @@ public class ResourceLocatorManager {
expr = ExpressionConverter.getDefault().perform(child);
}
catch (CoreException e) {
- log(e);
+ JptCommonCorePlugin.instance().logError(e);
throw new XPointException();
}
rlConfig.setEnablementCondition(expr);
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/SimpleJavaResourceLocator.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/SimpleJavaResourceLocator.java
index 58712b543c..2a83cc2acd 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/SimpleJavaResourceLocator.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/SimpleJavaResourceLocator.java
@@ -20,7 +20,7 @@ import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
+import org.eclipse.jpt.common.core.internal.plugin.JptCommonCorePlugin;
import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
import org.eclipse.jpt.common.core.resource.ResourceLocator;
import org.eclipse.jpt.common.utility.Filter;
@@ -45,7 +45,7 @@ public class SimpleJavaResourceLocator
try {
return this.resourceLocationIsValid_(project, container);
} catch (JavaModelException ex) {
- JptCommonCorePlugin.log(ex);
+ JptCommonCorePlugin.instance().logError(ex);
// happens if the Java project does not exist
return false;
}
@@ -91,7 +91,7 @@ public class SimpleJavaResourceLocator
try {
return this.getDefaultResourceLocation_(project);
} catch (Exception ex) {
- JptCommonCorePlugin.log(ex);
+ JptCommonCorePlugin.instance().logError(ex);
// happens if the Java project does not exist or there is a problem with the
// Java resources
return null;
@@ -121,7 +121,7 @@ public class SimpleJavaResourceLocator
try {
return this.getResourcePath_(project, runtimePath);
} catch (Exception ex) {
- JptCommonCorePlugin.log(ex);
+ JptCommonCorePlugin.instance().logError(ex);
return null;
}
}
@@ -146,7 +146,7 @@ public class SimpleJavaResourceLocator
try {
return this.getRuntimePath_(project, resourcePath);
} catch (Exception ex) {
- JptCommonCorePlugin.log(ex);
+ JptCommonCorePlugin.instance().logError(ex);
return resourcePath.makeRelativeTo(project.getFullPath());
}
}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryAbstractType.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryAbstractType.java
index 423f8d23f3..f8646bea9b 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryAbstractType.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryAbstractType.java
@@ -19,7 +19,7 @@ import org.eclipse.jdt.core.ITypeParameter;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.dom.IBinding;
import org.eclipse.jdt.core.dom.ITypeBinding;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
+import org.eclipse.jpt.common.core.internal.plugin.JptCommonCorePlugin;
import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools;
import org.eclipse.jpt.common.core.internal.utility.jdt.JavaResourceTypeBinding;
import org.eclipse.jpt.common.core.resource.java.JavaResourceAbstractType;
@@ -164,7 +164,7 @@ abstract class BinaryAbstractType
return new ArrayIterable<ITypeParameter>(this.type.getTypeParameters());
}
catch (JavaModelException jme) {
- JptCommonCorePlugin.log(jme);
+ JptCommonCorePlugin.instance().logError(jme);
}
return EmptyIterable.instance();
}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryAnnotatedElement.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryAnnotatedElement.java
index 7510ddbc6b..2439c1640e 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryAnnotatedElement.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryAnnotatedElement.java
@@ -17,7 +17,7 @@ import org.eclipse.jdt.core.IMemberValuePair;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.common.core.AnnotationProvider;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
+import org.eclipse.jpt.common.core.internal.plugin.JptCommonCorePlugin;
import org.eclipse.jpt.common.core.resource.java.Annotation;
import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
@@ -283,7 +283,7 @@ abstract class BinaryAnnotatedElement
try {
return this.adapter.getAnnotations();
} catch (JavaModelException ex) {
- JptCommonCorePlugin.log(ex);
+ JptCommonCorePlugin.instance().logError(ex);
return EMPTY_JDT_ANNOTATION_ARRAY;
}
}
@@ -336,7 +336,6 @@ abstract class BinaryAnnotatedElement
}
/* CU private */ static final IMemberValuePair[] EMPTY_MEMBER_VALUE_PAIR_ARRAY = new IMemberValuePair[0];
- /* CU private */ static final Object[] EMPTY_OBJECT_ARRAY = new Object[0];
// ********** annotation container **********
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryAttribute.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryAttribute.java
index f5e6db47a0..2a611652bc 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryAttribute.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryAttribute.java
@@ -13,7 +13,7 @@ import org.eclipse.jdt.core.IMember;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.dom.IBinding;
import org.eclipse.jdt.core.dom.ITypeBinding;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
+import org.eclipse.jpt.common.core.internal.plugin.JptCommonCorePlugin;
import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools;
import org.eclipse.jpt.common.core.internal.utility.jdt.JavaResourceTypeBinding;
import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
@@ -106,7 +106,7 @@ abstract class BinaryAttribute
try {
return member.getFlags();
} catch (JavaModelException ex) {
- JptCommonCorePlugin.log(ex);
+ JptCommonCorePlugin.instance().logError(ex);
return 0;
}
}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryClassFile.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryClassFile.java
index 3c4d009ad6..5b3caab9e8 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryClassFile.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryClassFile.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2012 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.
@@ -12,7 +12,7 @@ package org.eclipse.jpt.common.core.internal.resource.java.binary;
import org.eclipse.jdt.core.IClassFile;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
+import org.eclipse.jpt.common.core.internal.plugin.JptCommonCorePlugin;
import org.eclipse.jpt.common.core.resource.java.JavaResourceAbstractType;
import org.eclipse.jpt.common.core.resource.java.JavaResourceClassFile;
import org.eclipse.jpt.common.core.resource.java.JavaResourcePackageFragment;
@@ -50,7 +50,7 @@ final class BinaryClassFile
}
}
catch (JavaModelException e) {
- JptCommonCorePlugin.log(e);
+ JptCommonCorePlugin.instance().logError(e);
}
return new BinaryType(this, jdtType);
}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryEnum.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryEnum.java
index 3c1348eeba..ef593f3abf 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryEnum.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryEnum.java
@@ -14,7 +14,7 @@ import org.eclipse.jdt.core.IField;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.dom.EnumDeclaration;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
+import org.eclipse.jpt.common.core.internal.plugin.JptCommonCorePlugin;
import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.resource.java.JavaResourceEnum;
import org.eclipse.jpt.common.core.resource.java.JavaResourceEnumConstant;
@@ -95,7 +95,7 @@ final class BinaryEnum
try {
return type.getFields();
} catch (JavaModelException ex) {
- JptCommonCorePlugin.log(ex);
+ JptCommonCorePlugin.instance().logError(ex);
return EMPTY_FIELD_ARRAY;
}
}
@@ -106,7 +106,7 @@ final class BinaryEnum
try {
return field.isEnumConstant();
} catch (JavaModelException ex) {
- JptCommonCorePlugin.log(ex);
+ JptCommonCorePlugin.instance().logError(ex);
return false;
}
}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryEnumConstant.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryEnumConstant.java
index 1ac65b6784..327212bb4b 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryEnumConstant.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryEnumConstant.java
@@ -14,7 +14,7 @@ import org.eclipse.jdt.core.IField;
import org.eclipse.jdt.core.ITypeParameter;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.dom.EnumConstantDeclaration;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
+import org.eclipse.jpt.common.core.internal.plugin.JptCommonCorePlugin;
import org.eclipse.jpt.common.core.resource.java.JavaResourceEnum;
import org.eclipse.jpt.common.core.resource.java.JavaResourceEnumConstant;
import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
@@ -80,7 +80,7 @@ final class BinaryEnumConstant
return new ArrayIterable<ITypeParameter>(this.enumConstant.getDeclaringType().getTypeParameters());
}
catch (JavaModelException jme) {
- JptCommonCorePlugin.log(jme);
+ JptCommonCorePlugin.instance().logError(jme);
}
return EmptyIterable.instance();
}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryField.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryField.java
index 41abd98901..5d25eb7ec4 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryField.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryField.java
@@ -18,7 +18,7 @@ import org.eclipse.jdt.core.dom.IBinding;
import org.eclipse.jdt.core.dom.ITypeBinding;
import org.eclipse.jdt.core.dom.IVariableBinding;
import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
+import org.eclipse.jpt.common.core.internal.plugin.JptCommonCorePlugin;
import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
@@ -77,7 +77,7 @@ final class BinaryField
return new ArrayIterable<ITypeParameter>(this.field.getDeclaringType().getTypeParameters());
}
catch (JavaModelException jme) {
- JptCommonCorePlugin.log(jme);
+ JptCommonCorePlugin.instance().logError(jme);
}
return EmptyIterable.instance();
}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryMember.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryMember.java
index 1bc0c39556..c2a078b92c 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryMember.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryMember.java
@@ -17,7 +17,7 @@ import org.eclipse.jdt.core.IMember;
import org.eclipse.jdt.core.ITypeParameter;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.Signature;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
+import org.eclipse.jpt.common.core.internal.plugin.JptCommonCorePlugin;
import org.eclipse.jpt.common.core.resource.java.Annotation;
import org.eclipse.jpt.common.core.resource.java.JavaResourceMember;
import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
@@ -83,7 +83,7 @@ abstract class BinaryMember
try {
return Flags.isFinal(member.getFlags());
} catch (JavaModelException ex) {
- JptCommonCorePlugin.log(ex);
+ JptCommonCorePlugin.instance().logError(ex);
return false;
}
}
@@ -103,7 +103,7 @@ abstract class BinaryMember
try {
return Flags.isTransient(member.getFlags());
} catch (JavaModelException ex) {
- JptCommonCorePlugin.log(ex);
+ JptCommonCorePlugin.instance().logError(ex);
return false;
}
}
@@ -123,7 +123,7 @@ abstract class BinaryMember
try {
return Flags.isPublic(member.getFlags());
} catch (JavaModelException ex) {
- JptCommonCorePlugin.log(ex);
+ JptCommonCorePlugin.instance().logError(ex);
return false;
}
}
@@ -143,7 +143,7 @@ abstract class BinaryMember
try {
return Flags.isStatic(member.getFlags());
} catch (JavaModelException ex) {
- JptCommonCorePlugin.log(ex);
+ JptCommonCorePlugin.instance().logError(ex);
return false;
}
}
@@ -163,7 +163,7 @@ abstract class BinaryMember
try {
return Flags.isProtected(member.getFlags());
} catch (JavaModelException ex) {
- JptCommonCorePlugin.log(ex);
+ JptCommonCorePlugin.instance().logError(ex);
return false;
}
}
@@ -219,7 +219,7 @@ abstract class BinaryMember
}
}
catch (JavaModelException jme) {
- JptCommonCorePlugin.log(jme);
+ JptCommonCorePlugin.instance().logError(jme);
}
}
else if (Signature.getTypeSignatureKind(erasureSignature) == Signature.ARRAY_TYPE_SIGNATURE) {
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryMethod.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryMethod.java
index b07184e87c..54bcc7c335 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryMethod.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryMethod.java
@@ -22,7 +22,7 @@ import org.eclipse.jdt.core.dom.IBinding;
import org.eclipse.jdt.core.dom.IMethodBinding;
import org.eclipse.jdt.core.dom.ITypeBinding;
import org.eclipse.jdt.core.dom.MethodDeclaration;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
+import org.eclipse.jpt.common.core.internal.plugin.JptCommonCorePlugin;
import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.common.core.resource.java.JavaResourceMethod;
import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
@@ -117,7 +117,7 @@ final class BinaryMethod
try {
return jdtMethod.getParameters();
} catch (JavaModelException ex) {
- JptCommonCorePlugin.log(ex);
+ JptCommonCorePlugin.instance().logError(ex);
return null;
}
}
@@ -143,7 +143,7 @@ final class BinaryMethod
try {
return method.isConstructor();
} catch (JavaModelException ex) {
- JptCommonCorePlugin.log(ex);
+ JptCommonCorePlugin.instance().logError(ex);
return false;
}
}
@@ -183,7 +183,7 @@ final class BinaryMethod
new ArrayIterable<ITypeParameter>(this.method.getDeclaringType().getTypeParameters()));
}
catch (JavaModelException jme) {
- JptCommonCorePlugin.log(jme);
+ JptCommonCorePlugin.instance().logError(jme);
}
return EmptyIterable.instance();
}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryNode.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryNode.java
index a10bb4c264..b4b4941580 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryNode.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryNode.java
@@ -14,11 +14,12 @@ import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.IMemberValuePair;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
+import org.eclipse.jpt.common.core.internal.plugin.JptCommonCorePlugin;
import org.eclipse.jpt.common.core.internal.resource.java.AbstractJavaResourceNode;
import org.eclipse.jpt.common.core.resource.java.JavaResourceCompilationUnit;
import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.common.utility.internal.Tools;
/**
* Binary convenience methods
@@ -61,9 +62,8 @@ public abstract class BinaryNode
*/
public Object[] getJdtMemberValues(IAnnotation jdtContainerAnnotation, String memberName) {
Object[] values = (Object[]) this.getJdtMemberValue(jdtContainerAnnotation, memberName);
- return (values != null) ? values : EMPTY_OBJECT_ARRAY;
+ return (values != null) ? values : Tools.EMPTY_OBJECT_ARRAY;
}
- private static final Object[] EMPTY_OBJECT_ARRAY = new Object[0];
/**
* Return the value of the specified JDT annotation's member with
@@ -91,7 +91,7 @@ public abstract class BinaryNode
try {
return jdtContainerAnnotation.getMemberValuePairs();
} catch (JavaModelException ex) {
- JptCommonCorePlugin.log(ex);
+ JptCommonCorePlugin.instance().logError(ex);
return EMPTY_MEMBER_VALUE_PAIR_ARRAY;
}
}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryPackageFragment.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryPackageFragment.java
index bbfdf84c37..a7b2cb9e1c 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryPackageFragment.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryPackageFragment.java
@@ -18,7 +18,7 @@ import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
+import org.eclipse.jpt.common.core.internal.plugin.JptCommonCorePlugin;
import org.eclipse.jpt.common.core.resource.java.JavaResourceAbstractType;
import org.eclipse.jpt.common.core.resource.java.JavaResourceClassFile;
import org.eclipse.jpt.common.core.resource.java.JavaResourcePackageFragment;
@@ -138,7 +138,7 @@ final class BinaryPackageFragment
try {
return this.packageFragment.getChildren();
} catch (JavaModelException ex) {
- JptCommonCorePlugin.log(ex);
+ JptCommonCorePlugin.instance().logError(ex);
return EMPTY_JAVA_ELEMENT_ARRAY;
}
}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryType.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryType.java
index 93ee2ac663..579a2d2ac7 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryType.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryType.java
@@ -23,7 +23,7 @@ import org.eclipse.jdt.core.dom.ITypeBinding;
import org.eclipse.jdt.core.dom.IVariableBinding;
import org.eclipse.jdt.core.dom.Modifier;
import org.eclipse.jdt.core.dom.TypeDeclaration;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
+import org.eclipse.jpt.common.core.internal.plugin.JptCommonCorePlugin;
import org.eclipse.jpt.common.core.internal.resource.java.InheritedAttributeKey;
import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools;
import org.eclipse.jpt.common.core.internal.utility.jdt.JavaResourceTypeBinding;
@@ -138,7 +138,7 @@ final class BinaryType
try {
return type.getSuperclassTypeSignature();
} catch (JavaModelException ex) {
- JptCommonCorePlugin.log(ex);
+ JptCommonCorePlugin.instance().logError(ex);
return null;
}
}
@@ -158,7 +158,7 @@ final class BinaryType
try {
return Flags.isAbstract(type.getFlags());
} catch (JavaModelException ex) {
- JptCommonCorePlugin.log(ex);
+ JptCommonCorePlugin.instance().logError(ex);
return false;
}
}
@@ -187,7 +187,7 @@ final class BinaryType
}
}
catch (JavaModelException ex) {
- JptCommonCorePlugin.log(ex);
+ JptCommonCorePlugin.instance().logError(ex);
}
return null;
}
@@ -209,7 +209,7 @@ final class BinaryType
return method != null && Flags.isPrivate(method.getFlags());
}
catch (JavaModelException ex) {
- JptCommonCorePlugin.log(ex);
+ JptCommonCorePlugin.instance().logError(ex);
return false;
}
}
@@ -337,7 +337,7 @@ final class BinaryType
try {
return type.getFields();
} catch (JavaModelException ex) {
- JptCommonCorePlugin.log(ex);
+ JptCommonCorePlugin.instance().logError(ex);
return EMPTY_FIELD_ARRAY;
}
}
@@ -368,7 +368,7 @@ final class BinaryType
try {
return type.getMethods();
} catch (JavaModelException ex) {
- JptCommonCorePlugin.log(ex);
+ JptCommonCorePlugin.instance().logError(ex);
return EMPTY_METHOD_ARRAY;
}
}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryTypeCache.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryTypeCache.java
index fdc5684ba7..b7fa5fe198 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryTypeCache.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/BinaryTypeCache.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2012 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.
@@ -15,7 +15,7 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jpt.common.core.AnnotationProvider;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
+import org.eclipse.jpt.common.core.internal.plugin.JptCommonCorePlugin;
import org.eclipse.jpt.common.core.resource.java.JavaResourceAbstractType;
import org.eclipse.jpt.common.core.resource.java.JavaResourceTypeCache;
import org.eclipse.jpt.common.utility.internal.StringTools;
@@ -85,7 +85,7 @@ public final class BinaryTypeCache
}
}
catch(JavaModelException e) {
- JptCommonCorePlugin.log(e);
+ JptCommonCorePlugin.instance().logError(e);
}
return null;
}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/RootBinaryNode.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/RootBinaryNode.java
index 3afcf608da..406ff7a625 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/RootBinaryNode.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/binary/RootBinaryNode.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2012 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.
@@ -10,10 +10,11 @@
package org.eclipse.jpt.common.core.internal.resource.java.binary;
import org.eclipse.jpt.common.core.AnnotationProvider;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
import org.eclipse.jpt.common.core.JptResourceModelListener;
import org.eclipse.jpt.common.core.JptResourceType;
+import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.common.core.resource.java.JavaResourcePackageFragmentRoot;
import org.eclipse.jpt.common.utility.internal.ListenerList;
/**
@@ -68,7 +69,7 @@ abstract class RootBinaryNode
// ********** JptResourceModel implementation **********
public JptResourceType getResourceType() {
- return JptCommonCorePlugin.JAR_RESOURCE_TYPE;
+ return PlatformTools.getResourceType(JavaResourcePackageFragmentRoot.JAR_CONTENT_TYPE);
}
public void addResourceModelListener(JptResourceModelListener listener) {
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourcePackageInfoCompilationUnit.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourcePackageInfoCompilationUnit.java
index a8573088a3..3f710f80ae 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourcePackageInfoCompilationUnit.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourcePackageInfoCompilationUnit.java
@@ -13,8 +13,8 @@ import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jdt.core.dom.PackageDeclaration;
import org.eclipse.jpt.common.core.AnnotationProvider;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
import org.eclipse.jpt.common.core.JptResourceType;
+import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
import org.eclipse.jpt.common.core.resource.java.JavaResourceAbstractType;
import org.eclipse.jpt.common.core.resource.java.JavaResourcePackage;
import org.eclipse.jpt.common.core.resource.java.JavaResourcePackageInfoCompilationUnit;
@@ -64,7 +64,7 @@ public final class SourcePackageInfoCompilationUnit
// ********** JptResourceModel implementation **********
public JptResourceType getResourceType() {
- return JptCommonCorePlugin.JAVA_SOURCE_PACKAGE_INFO_RESOURCE_TYPE;
+ return PlatformTools.getResourceType(PACKAGE_INFO_CONTENT_TYPE);
}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceTypeCompilationUnit.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceTypeCompilationUnit.java
index 0f8ed44ef0..a52feff0e4 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceTypeCompilationUnit.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceTypeCompilationUnit.java
@@ -17,8 +17,8 @@ import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jdt.core.dom.EnumDeclaration;
import org.eclipse.jdt.core.dom.TypeDeclaration;
import org.eclipse.jpt.common.core.AnnotationProvider;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
import org.eclipse.jpt.common.core.JptResourceType;
+import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
import org.eclipse.jpt.common.core.resource.java.JavaResourceAbstractType;
import org.eclipse.jpt.common.core.resource.java.JavaResourceEnum;
import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
@@ -87,7 +87,7 @@ public final class SourceTypeCompilationUnit
// ********** JpaResourceModel implementation **********
public JptResourceType getResourceType() {
- return JptCommonCorePlugin.JAVA_SOURCE_RESOURCE_TYPE;
+ return PlatformTools.getResourceType(CONTENT_TYPE);
}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/JDTTools.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/JDTTools.java
index 024853c8cd..4b484d09e8 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/JDTTools.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/JDTTools.java
@@ -19,7 +19,7 @@ import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.IParent;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
+import org.eclipse.jpt.common.core.internal.plugin.JptCommonCorePlugin;
import org.eclipse.jpt.common.utility.Filter;
import org.eclipse.jpt.common.utility.internal.NotNullFilter;
import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
@@ -40,7 +40,7 @@ public final class JDTTools {
try {
return packageFragmentRootIsSourceFolder_(pfr);
} catch (JavaModelException ex) {
- JptCommonCorePlugin.log(ex);
+ JptCommonCorePlugin.instance().logError(ex);
return false;
}
}
@@ -58,7 +58,7 @@ public final class JDTTools {
} catch (JavaModelException ex) {
// ignore FNFE - which can happen when the workspace is out of sync with O/S file system
if ( ! (ex.getCause() instanceof FileNotFoundException)) {
- JptCommonCorePlugin.log(ex);
+ JptCommonCorePlugin.instance().logError(ex);
}
return EMPTY_JAVA_ELEMENT_ARRAY;
}
@@ -74,7 +74,7 @@ public final class JDTTools {
return typeIsSubType(javaProject, javaProject.findType(potentialSubType), javaProject.findType(potentialSuperType));
}
catch (JavaModelException ex) {
- JptCommonCorePlugin.log(ex);
+ JptCommonCorePlugin.instance().logError(ex);
return false;
}
}
@@ -84,7 +84,7 @@ public final class JDTTools {
return typeIsSubType_(javaProject, potentialSubType, potentialSuperType);
}
catch (JavaModelException ex) {
- JptCommonCorePlugin.log(ex);
+ JptCommonCorePlugin.instance().logError(ex);
return false;
}
}
@@ -173,7 +173,7 @@ public final class JDTTools {
try {
return javaProject.findType(fullyQualifiedName);
} catch (JavaModelException ex) {
- JptCommonCorePlugin.log(ex);
+ JptCommonCorePlugin.instance().logError(ex);
return null;
}
}
@@ -196,7 +196,7 @@ public final class JDTTools {
try {
return getPackageFragmentRoots_(javaProject);
} catch (JavaModelException ex) {
- JptCommonCorePlugin.log(ex);
+ JptCommonCorePlugin.instance().logError(ex);
return EmptyIterable.instance();
}
}
@@ -212,7 +212,7 @@ public final class JDTTools {
}
}
catch (JavaModelException e) {
- JptCommonCorePlugin.log(e);
+ JptCommonCorePlugin.instance().logError(e);
}
return false;
}
@@ -249,7 +249,7 @@ public final class JDTTools {
return true;
}
} catch (JavaModelException ex) {
- JptCommonCorePlugin.log(ex);
+ JptCommonCorePlugin.instance().logError(ex);
}
return false;
}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/JptPlugin.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/JptPlugin.java
new file mode 100644
index 0000000000..4cf4df2bd9
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/JptPlugin.java
@@ -0,0 +1,1874 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.utility;
+
+import java.io.PrintStream;
+import java.io.PrintWriter;
+import java.util.Map;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ProjectScope;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.ILog;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.QualifiedName;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.jpt.common.core.internal.JptCommonCoreMessages;
+import org.eclipse.jpt.common.core.internal.plugin.JptCommonCorePlugin;
+import org.eclipse.jpt.common.utility.ExceptionHandler;
+import org.eclipse.jpt.common.utility.internal.ArrayTools;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.Tools;
+import org.eclipse.osgi.service.debug.DebugOptions;
+import org.eclipse.osgi.service.debug.DebugTrace;
+import org.eclipse.osgi.util.NLS;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.prefs.BackingStoreException;
+import org.osgi.util.tracker.ServiceTracker;
+
+/**
+ * Common Dali plug-in behavior:<ul>
+ * <li>plug-in lifecycle
+ * <li>content types
+ * <li>resource (project) persistent properties
+ * <li>preferences
+ * <li>logging
+ * <li>statuses
+ * <li>exception handler
+ * <li>debug options
+ * <li>tracing
+ * </ul>
+ * <strong>NB:</strong> The following plug-in state is read-write and any change
+ * to the {@link #getPluginID() plug-in's ID} must consider backward and forward
+ * compatibility (i.e. {@link #getOriginalPluginID_() it may be wise to continue
+ * using the original plug-in ID} - In particular, forward-compatibility is necessary
+ * for a team of developers to use different versions of the same plug-in when
+ * reading and writing this state.):<ul>
+ * <li>resource (project) persistent properties
+ * <li>preferences
+ * </ul>
+ */
+public abstract class JptPlugin
+ implements BundleActivator
+{
+ // NB: the plug-in must be synchronized whenever accessing any of this state
+ private BundleContext bundleContext;
+ private ExceptionHandler exceptionHandler;
+ private ServiceTracker<DebugOptions, DebugOptions> debugOptionsTracker;
+ private DebugTrace debugTrace;
+
+
+ /**
+ * Default constructor is required. Of course, subclass constructors must
+ * be <code>public</code>.
+ */
+ protected JptPlugin() {
+ super();
+ }
+
+
+ // ********** plug-in lifecycle **********
+
+ /**
+ * @see #start_()
+ */
+ public final synchronized void start(BundleContext context) throws Exception {
+ // make the instance available immediately; although nothing should
+ // retrieve it during start-up, as most state should be populated lazily...
+ this.setInstance(this);
+ // "activate" the plug-in
+ this.bundleContext = context;
+ this.start_();
+ }
+
+ /**
+ * Subclass should call <code>super.start_()</code> at the beginning
+ * of its override implementation.
+ * <p>
+ * <strong>NB:</strong> Most state should be built lazily....
+ */
+ protected void start_() throws Exception {
+ // perform any startup stuff
+ }
+
+ /**
+ * @see #stop_()
+ */
+ public final synchronized void stop(BundleContext context) throws Exception {
+ try {
+ this.stop_();
+ } finally {
+ // "deactivate" the plug-in
+ this.bundleContext = null;
+ // leave the instance available during shutdown so stuff can be
+ // logged, traced, etc.
+ this.setInstance(null);
+ }
+ }
+
+ /**
+ * The plug-in will still be {@link #isActive() active} and its instance
+ * still present when this method is called.
+ * <p>
+ * Subclass should call <code>super.stop_()</code> at the end
+ * of its override implementation.
+ */
+ protected void stop_() throws Exception {
+ if (this.debugOptionsTracker != null) {
+ this.debugOptionsTracker.close();
+ this.debugOptionsTracker = null;
+ this.debugTrace = null;
+ }
+ this.exceptionHandler = null;
+ }
+
+ /**
+ * Set the plug-in's singleton instance.
+ */
+ protected abstract void setInstance(JptPlugin plugin);
+
+
+ // ********** content type **********
+
+ /**
+ * Return the content type corresponding to the
+ * specified context type within the scope of the plug-in; i.e prefix the
+ * specified content type with the
+ * {@link #getContentTypeScope() plug-in's content type scope}.
+ * Return <code>null</code> if the plug-in is {@link #isInactive() inactive}.
+ */
+ public IContentType getContentType(String contentType) {
+ StringBuilder scope = this.getContentTypeScope();
+ return (scope == null) ? null : Platform.getContentTypeManager().getContentType(scope.append(contentType).toString());
+ }
+
+ /**
+ * Return the name of the plug-in's {@link IContentType content type} scope.
+ * Include an appended <code>'.'</code>.
+ * By default, this is in the form
+ * <em>&lt;plug-in ID&gt;.content.</em>
+ * (e.g. <code>"org.eclipse.jpt.common.core.content."</code>).
+ * Return <code>null</code> if the plug-in is {@link #isInactive() inactive}.
+ */
+ protected StringBuilder getContentTypeScope() {
+ String id = this.getPluginID();
+ if (id == null) {
+ return null;
+ }
+ StringBuilder sb = new StringBuilder(id);
+ sb.append('.');
+ sb.append(this.getRelativeContentTypeScope());
+ sb.append('.');
+ return sb;
+ }
+
+ /**
+ * @see #RELATIVE_CONTENT_TYPE_SCOPE
+ */
+ protected String getRelativeContentTypeScope() {
+ return RELATIVE_CONTENT_TYPE_SCOPE;
+ }
+ /**
+ * Value: <code>{@value}</code>
+ */
+ protected static final String RELATIVE_CONTENT_TYPE_SCOPE = "content"; //$NON-NLS-1$
+
+
+ // ********** resource persistent properties **********
+
+ /**
+ * Return the specified {@link IResource#getPersistentProperty(QualifiedName)
+ * resource's persistent property}, relative to the plug-in's ID.
+ * Return <code>null</code> if the plug-in is {@link #isInactive() inactive}
+ * or if there are any problems retrieving the property.
+ */
+ public String getPersistentProperty(IResource resource, String key) {
+ QualifiedName qName = this.buildPersistentPropertyQualifiedName(key);
+ try {
+ return (qName == null) ? null : resource.getPersistentProperty(qName);
+ } catch (CoreException ex) {
+ this.logError(ex);
+ return null;
+ }
+ }
+
+ /**
+ * Set the specified {@link IResource#setPersistentProperty(QualifiedName, String)
+ * resource's persistent property}, relative to the plug-in's ID.
+ */
+ public void setPersistentProperty(IResource resource, String key, String value) {
+ QualifiedName qName = this.buildPersistentPropertyQualifiedName(key);
+ try {
+ if (qName != null) {
+ resource.setPersistentProperty(qName, value);
+ }
+ } catch (CoreException ex) {
+ this.logError(ex);
+ }
+ }
+
+ /**
+ * Remove the specified {@link IResource#getPersistentProperties()
+ * resource's persistent properties}, relative to the plug-in's ID.
+ */
+ public void removePersistentProperties(IResource resource) {
+ try {
+ this.removePersistentProperties_(resource);
+ } catch (CoreException ex) {
+ this.logError(ex);
+ }
+ }
+
+ protected void removePersistentProperties_(IResource resource) throws CoreException {
+ Map<QualifiedName, String> props = resource.getPersistentProperties();
+ for (QualifiedName key : props.keySet()) {
+ resource.setPersistentProperty(key, null);
+ }
+ }
+
+ /**
+ * Qualify the specified relative name with the plug-in's ID.
+ * Return <code>null</code> if the plug-in is {@link #isInactive() inactive}.
+ */
+ protected QualifiedName buildPersistentPropertyQualifiedName(String relativeName) {
+ String id = this.getPersistentPropertyPluginID();
+ return (id == null) ? null : new QualifiedName(id, relativeName);
+ }
+
+ /**
+ * @see #getOriginalPluginID_()
+ */
+ protected String getPersistentPropertyPluginID() {
+ return this.getOriginalPluginID();
+ }
+
+
+ // ********** preferences **********
+
+ /**
+ * Return the value of the specified preference, searching the plug-in's
+ * workspace and default preferences.
+ * Return <code>null</code> if the specified preference is not found.
+ */
+ public String getPreference(String key) {
+ return this.getPreference(key, null);
+ }
+
+ /**
+ * Return the value of the specified preference, searching the plug-in's
+ * workspace and default preferences.
+ * Return the specified default value if the specified preference is not found.
+ */
+ public String getPreference(String key, String defaultValue) {
+ return this.searchPreferences(key, this.getPreferenceSearchPath(), defaultValue);
+ }
+
+ /**
+ * Return the value of the plug-in's specified project preference.
+ * Return <code>null</code> if the specified preference is not found.
+ */
+ public String getPreference(IProject project, String key) {
+ return this.getPreference(project, key, null);
+ }
+
+ /**
+ * Return the value of the plug-in's specified project preference.
+ * Return the specified default value if the specified preference is not found.
+ */
+ public String getPreference(IProject project, String key, String defaultValue) {
+ return this.searchPreferences(key, this.getPreferenceSearchPath(project), defaultValue);
+ }
+
+ /**
+ * Return the value of the specified preference, searching the plug-in's
+ * workspace and default preferences.
+ * Return <code>false</code> if the specified preference is not found.
+ */
+ public boolean getBooleanPreference(String key) {
+ return this.getBooleanPreference(key, false);
+ }
+
+ /**
+ * Return the value of the specified preference, searching the plug-in's
+ * workspace and default preferences.
+ * Return the specified default value if the specified preference is not found.
+ */
+ public boolean getBooleanPreference(String key, boolean defaultValue) {
+ return this.searchBooleanPreferences(key, this.getPreferenceSearchPath(), defaultValue);
+ }
+
+ /**
+ * Return the value of the plug-in's specified project preference.
+ * Return <code>false</code> if the specified preference is not found.
+ */
+ public boolean getBooleanPreference(IProject project, String key) {
+ return this.getBooleanPreference(project, key, false);
+ }
+
+ /**
+ * Return the value of the plug-in's specified project preference.
+ * Return the specified default value if the specified preference is not found.
+ */
+ public boolean getBooleanPreference(IProject project, String key, boolean defaultValue) {
+ return this.searchBooleanPreferences(key, this.getPreferenceSearchPath(project), defaultValue);
+ }
+
+ /**
+ * Search the specified sets of preferences and return the value of the
+ * first occurrence of the specified key. Return the specified default
+ * value if none of the specified preference trees contain the specified
+ * key.
+ */
+ protected boolean searchBooleanPreferences(String key, IEclipsePreferences[] searchPath, boolean defaultValue) {
+ String value = this.searchPreferences(key, searchPath);
+ return (value == null) ? defaultValue : Boolean.parseBoolean(value);
+ }
+
+ /**
+ * Return the value of the specified preference, searching the plug-in's
+ * workspace and default preferences.
+ * Return <code>-1</code> if the specified preference is not found.
+ */
+ public int getIntPreference(String key) {
+ return this.getIntPreference(key, -1);
+ }
+
+ /**
+ * Return the value of the specified preference, searching the plug-in's
+ * workspace and default preferences.
+ * Return the specified default value if the specified preference is not found.
+ */
+ public int getIntPreference(String key, int defaultValue) {
+ return this.searchIntPreferences(key, this.getPreferenceSearchPath(), defaultValue);
+ }
+
+ /**
+ * Return the value of the plug-in's specified project preference.
+ * Return <code>-1</code> if the specified preference is not found.
+ */
+ public int getIntPreference(IProject project, String key) {
+ return this.getIntPreference(project, key, -1);
+ }
+
+ /**
+ * Return the value of the plug-in's specified project preference.
+ * Return the specified default value if the specified preference is not found.
+ */
+ public int getIntPreference(IProject project, String key, int defaultValue) {
+ return this.searchIntPreferences(key, this.getPreferenceSearchPath(project), defaultValue);
+ }
+
+ /**
+ * Search the specified sets of preferences and return the value of the
+ * first occurrence of the specified key. Return the specified default
+ * value if none of the specified preference trees contain the specified
+ * key.
+ */
+ protected int searchIntPreferences(String key, IEclipsePreferences[] searchPath, int defaultValue) {
+ String value = this.searchPreferences(key, searchPath);
+ if (value == null) {
+ return defaultValue;
+ }
+ try {
+ return Integer.parseInt(value);
+ } catch (NumberFormatException e) {
+ return defaultValue;
+ }
+ }
+
+ /**
+ * Search the specified sets of preferences and return the value of the
+ * first occurrence of the specified key. Return the specified default
+ * value if none of the specified preference trees contain the specified
+ * key.
+ */
+ protected String searchPreferences(String key, IEclipsePreferences[] searchPath, String defaultValue) {
+ String value = this.searchPreferences(key, searchPath);
+ return (value != null) ? value : defaultValue;
+ }
+
+ /**
+ * Search the specified sets of preferences and return the value of the
+ * first occurrence of the specified key. Return <code>null</code> if none
+ * of the specified preference trees contain the specified key.
+ */
+ protected String searchPreferences(String key, IEclipsePreferences[] searchPath) {
+ for (IEclipsePreferences prefs : searchPath) {
+ if (prefs != null) { // prefs can be null if the plug-in is inactive
+ String value = prefs.get(key, null);
+ if (value != null) {
+ return value;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Return the plug-in's preference search path (typically, the plug-in's
+ * workspace preferences followed by its default preferences).
+ */
+ protected IEclipsePreferences[] getPreferenceSearchPath() {
+ return new IEclipsePreferences[] {
+ this.getWorkspacePreferences(),
+ this.getDefaultPreferences(), // "original" preferences
+ this.getCurrentDefaultPreferences() // may be the same as the "original" preferences
+ };
+ }
+
+ /**
+ * Return the plug-in's preference search path (typically, only the
+ * plug-in's project preferences).
+ */
+ protected IEclipsePreferences[] getPreferenceSearchPath(IProject project) {
+ return ArrayTools.add(this.getPreferenceSearchPath(), 0, this.getProjectPreferences(project));
+ }
+
+ /**
+ * Set the value of the plug-in's specified project preference.
+ * If the new value is <code>null</code>, remove the preference.
+ */
+ public void setPreference(IProject project, String key, String value) {
+ IEclipsePreferences prefs = this.getProjectPreferences(project);
+ if (prefs != null) {
+ if (value == null) {
+ prefs.remove(key);
+ } else {
+ prefs.put(key, value);
+ }
+ this.flushPreferences(prefs);
+ }
+ }
+
+ /**
+ * Set the value of the plug-in's specified workspace preference.
+ * If the new value is <code>null</code>, remove the preference.
+ */
+ public void setPreference(String key, String value) {
+ IEclipsePreferences prefs = this.getWorkspacePreferences();
+ if (prefs != null) {
+ if (value == null) {
+ prefs.remove(key);
+ } else {
+ prefs.put(key, value);
+ }
+ this.flushPreferences(prefs);
+ }
+ }
+
+ /**
+ * Set the value of the plug-in's specified default preference.
+ * Typically called during default preferences initialization
+ * (as configured by an extension of
+ * <code>org.eclipse.core.runtime.preferences</code>).
+ * If the new value is <code>null</code>, remove the preference.
+ */
+ public void setDefaultPreference(String key, String value) {
+ IEclipsePreferences prefs = this.getCurrentDefaultPreferences();
+ if (prefs != null) {
+ if (value == null) {
+ prefs.remove(key);
+ } else {
+ prefs.put(key, value);
+ }
+ this.flushPreferences(prefs);
+ }
+ }
+
+ /**
+ * Set the value of the plug-in's specified project preference.
+ */
+ public void setBooleanPreference(IProject project, String key, boolean value) {
+ IEclipsePreferences prefs = this.getProjectPreferences(project);
+ if (prefs != null) {
+ prefs.putBoolean(key, value);
+ this.flushPreferences(prefs);
+ }
+ }
+
+ /**
+ * Set the value of the plug-in's specified workspace preference.
+ */
+ public void setBooleanPreference(String key, boolean value) {
+ IEclipsePreferences prefs = this.getWorkspacePreferences();
+ if (prefs != null) {
+ prefs.putBoolean(key, value);
+ this.flushPreferences(prefs);
+ }
+ }
+
+ /**
+ * Set the value of the plug-in's specified default preference.
+ * Typically called during default preferences initialization
+ * (as configured by an extension of
+ * <code>org.eclipse.core.runtime.preferences</code>).
+ */
+ public void setBooleanDefaultPreference(String key, boolean value) {
+ IEclipsePreferences prefs = this.getCurrentDefaultPreferences();
+ if (prefs != null) {
+ prefs.putBoolean(key, value);
+ this.flushPreferences(prefs);
+ }
+ }
+
+ /**
+ * Set the value of the plug-in's specified project preference.
+ */
+ public void setIntPreference(IProject project, String key, int value) {
+ IEclipsePreferences prefs = this.getProjectPreferences(project);
+ if (prefs != null) {
+ prefs.putInt(key, value);
+ this.flushPreferences(prefs);
+ }
+ }
+
+ /**
+ * Set the value of the plug-in's specified workspace preference.
+ */
+ public void setIntPreference(String key, int value) {
+ IEclipsePreferences prefs = this.getWorkspacePreferences();
+ if (prefs != null) {
+ prefs.putInt(key, value);
+ this.flushPreferences(prefs);
+ }
+ }
+
+ /**
+ * Set the value of the plug-in's specified default preference.
+ * Typically called during default preferences initialization
+ * (as configured by an extension of
+ * <code>org.eclipse.core.runtime.preferences</code>).
+ */
+ public void setIntDefaultPreference(String key, int value) {
+ IEclipsePreferences prefs = this.getCurrentDefaultPreferences();
+ if (prefs != null) {
+ prefs.putInt(key, value);
+ this.flushPreferences(prefs);
+ }
+ }
+
+ /**
+ * Remove the value of the plug-in's specified project preference.
+ */
+ public void removePreference(IProject project, String key) {
+ IEclipsePreferences prefs = this.getProjectPreferences(project);
+ if (prefs != null) {
+ prefs.remove(key);
+ this.flushPreferences(prefs);
+ }
+ }
+
+ /**
+ * Remove the value of the plug-in's specified workspace preference.
+ */
+ public void removePreference(String key) {
+ IEclipsePreferences prefs = this.getWorkspacePreferences();
+ if (prefs != null) {
+ prefs.remove(key);
+ this.flushPreferences(prefs);
+ }
+ }
+
+ /**
+ * Remove the plug-in's preferences for the specified project.
+ */
+ public void removePreferences(IProject project) {
+ this.removePreferences(this.getProjectPreferences(project));
+ }
+
+ /**
+ * Remove the plug-in's workspace preferences.
+ */
+ public void removePreferences() {
+ this.removePreferences(this.getWorkspacePreferences());
+ }
+
+ protected void removePreferences(IEclipsePreferences prefs) {
+ try {
+ if (prefs != null) {
+ prefs.removeNode();
+ }
+ } catch (BackingStoreException ex) {
+ this.logError(ex);
+ }
+ }
+
+ /**
+ * Return the plug-in's workspace preferences. These preferences are written
+ * to disk when the workspace is closed.
+ * Return <code>null</code> if the plug-in is {@link #isInactive() inactive}.
+ * These preferences are stored the file<br>
+ * <code>
+ * <em>&lt;workspace dir&gt;</em>/<em>&lt;project dir&gt;</em>/.settings/<em>&lt;plug-in ID&gt;</em>.prefs
+ * </code>
+ */
+ protected IEclipsePreferences getProjectPreferences(IProject project) {
+ return this.getPreferences(new ProjectScope(project));
+ }
+
+ /**
+ * Return the plug-in's workspace preferences. These preferences are written
+ * to disk when the workspace is closed.
+ * Return <code>null</code> if the plug-in is {@link #isInactive() inactive}.
+ * These preferences are stored the file<br>
+ * <code>
+ * <em>&lt;workspace dir&gt;</em>/.metadata/.plugins/org.eclipse.core.runtime/.settings/<em>&lt;plug-in ID&gt;</em>.prefs
+ * </code>
+ */
+ protected IEclipsePreferences getWorkspacePreferences() {
+ return this.getPreferences(InstanceScope.INSTANCE);
+ }
+
+ /**
+ * Return the plug-in's <em>current</em> default preferences.
+ * These preferences are initialized
+ * during default preferences initialization and are not saved to disk.
+ * Return <code>null</code> if the plug-in is {@link #isInactive() inactive}.
+ * <p>
+ * These preferences must use the <em>current</em> plug-in ID as the
+ * extension is associated with the plug-in.
+ * <p>
+ * Default preferences are calculated upon first reference. The precedence
+ * is:<ul>
+ * <li>command-line
+ * <li>product
+ * <li>bundle
+ * <li>run-time
+ * </ul>
+ * @see org.eclipse.core.internal.preferences.DefaultPreferences#load()
+ * @see <a href="http://www.eclipse.org/eclipse/platform-core/documents/user_settings/plugin_customization.html">
+ * Plug-in Customization documentation</a>
+ */
+ @SuppressWarnings("restriction")
+ protected IEclipsePreferences getCurrentDefaultPreferences() {
+ String qualifier = this.getPluginID();
+ return (qualifier == null) ? null : DefaultScope.INSTANCE.getNode(qualifier);
+ }
+
+ /**
+ * Return the plug-in's default preferences, as determined by the
+ * {@link #getPreferencesPluginID() "preferences plug-in ID"} which,
+ * by default, is the {@link #getOriginalPluginID() "original plug-in ID"}.
+ * This is used only to <em>read</em> default preferences that may be
+ * set via product customization using the original plug-in ID.
+ */
+ protected IEclipsePreferences getDefaultPreferences() {
+ return this.getPreferences(DefaultScope.INSTANCE);
+ }
+
+ /**
+ * Return the plug-in's preferences for the specified context.
+ * Return <code>null</code> if the plug-in is {@link #isInactive() inactive}.
+ */
+ protected IEclipsePreferences getPreferences(IScopeContext context) {
+ String qualifier = this.getPreferencesPluginID();
+ return (qualifier == null) ? null : context.getNode(qualifier);
+ }
+
+ /**
+ * Return <code>null</code> if the plug-in is {@link #isInactive() inactive}.
+ * @see #getOriginalPluginID_()
+ */
+ protected String getPreferencesPluginID() {
+ return this.getOriginalPluginID();
+ }
+
+ /**
+ * Flush the specified preferences in an asynchronous
+ * {@link FlushPreferencesJob job}
+ * because the flush request can trigger a lock on the project,
+ * which can cause deadlocks (e.g. when deleting the metamodel source
+ * folder).
+ * <p>
+ * Note: The flush will also remove the preferences node if it is empty.
+ */
+ protected void flushPreferences(IEclipsePreferences prefs) {
+ if (FlushPreferences) {
+ new FlushPreferencesJob(prefs).schedule();
+ }
+ }
+
+ /**
+ * This flag is set to <code>false</code> when the test plug-in is loaded.
+ * The preferences end up getting flushed after the test case has deleted
+ * its project, resulting in resource exceptions in the log, e.g.
+ * <pre>
+ * Resource '/JpaProjectManagerTests' is not open.
+ * </pre>
+ * See <code>JptJpaCoreTestsPlugin.start_()</code>
+ */
+ public static volatile boolean FlushPreferences = true;
+
+ protected static class FlushPreferencesJob
+ extends Job
+ {
+ private final IEclipsePreferences prefs;
+
+ FlushPreferencesJob(IEclipsePreferences prefs) {
+ super(NLS.bind(JptCommonCoreMessages.PREFERENCES_FLUSH_JOB_NAME, prefs.absolutePath()));
+ this.prefs = prefs;
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ this.prefs.flush();
+ } catch(BackingStoreException ex) {
+ return JptCommonCorePlugin.instance().logError(ex);
+ }
+ return Status.OK_STATUS;
+ }
+ }
+
+
+ // ********** logging **********
+
+ /**
+ * Log the specified message with a severity of
+ * {@link IStatus#ERROR ERROR}.
+ * Return the logged status.
+ * @see #log(int, String)
+ * @see IStatus
+ */
+ public IStatus logError(String message) {
+ return this.log(IStatus.ERROR, message);
+ }
+
+ /**
+ * Log the specified message with the specified severity.
+ * Return the logged status.
+ * @see IStatus#getSeverity()
+ */
+ public IStatus log(int severity, String message) {
+ return this.log(severity, message, Tools.EMPTY_OBJECT_ARRAY);
+ }
+
+ /**
+ * Log the specified message with a severity of
+ * {@link IStatus#ERROR ERROR}.
+ * Bind the message to the specified arguments.
+ * Return the logged status.
+ * @see #log(int, String, Object[])
+ * @see IStatus
+ */
+ public IStatus logError(String message, Object... args) {
+ return this.log(IStatus.ERROR, message, args);
+ }
+
+ /**
+ * Log the specified message with the specified severity.
+ * Bind the message to the specified arguments.
+ * Return the logged status.
+ * @see IStatus#getSeverity()
+ */
+ public IStatus log(int severity, String message, Object... args) {
+ return this.log(severity, (Throwable) null, message, args);
+ }
+
+ /**
+ * Log the specified exception with a severity of
+ * {@link IStatus#ERROR ERROR}.
+ * Return the logged status.
+ * @see #log(int, Throwable)
+ * @see IStatus
+ */
+ public IStatus logError(Throwable throwable) {
+ return this.log(IStatus.ERROR, throwable);
+ }
+
+ /**
+ * Log the specified exception with the specified severity.
+ * Return the logged status.
+ * @see IStatus#getSeverity()
+ */
+ public IStatus log(int severity, Throwable throwable) {
+ return this.log(severity, throwable, throwable.getLocalizedMessage());
+ }
+
+ /**
+ * Log the specified message and exception with a severity of
+ * {@link IStatus#ERROR ERROR}.
+ * Return the logged status.
+ * @see #log(int, Throwable, String)
+ * @see IStatus
+ */
+ public IStatus logError(Throwable throwable, String message) {
+ return this.log(IStatus.ERROR, throwable, message);
+ }
+
+ /**
+ * Log the specified message and exception with the specified severity.
+ * Return the logged status.
+ * @see IStatus#getSeverity()
+ */
+ public IStatus log(int severity, Throwable throwable, String message) {
+ return this.log(severity, IStatus.OK, throwable, message);
+ }
+
+ /**
+ * Log the specified message and exception with a severity of
+ * {@link IStatus#ERROR ERROR}.
+ * Bind the message to the specified arguments.
+ * Return the logged status.
+ * @see #log(int, Throwable, String, Object[])
+ * @see IStatus
+ */
+ public IStatus logError(Throwable throwable, String message, Object... args) {
+ return this.log(IStatus.ERROR, throwable, message, args);
+ }
+
+ /**
+ * Log the specified message and exception with the specified severity.
+ * Bind the message to the specified arguments.
+ * Return the logged status.
+ * @see IStatus#getSeverity()
+ */
+ public IStatus log(int severity, Throwable throwable, String message, Object... args) {
+ return this.log(severity, IStatus.OK, throwable, message, args);
+ }
+
+ /**
+ * Log the specified message and exception with the specified severity
+ * and code.
+ * If the plug-in is {@link #isInactive() inactive}, log the information
+ * to the appropriate Java system log (instead of the Eclise platform log).
+ * Return the logged status.
+ * @see IStatus#getSeverity()
+ * @see IStatus#getCode()
+ */
+ public IStatus log(int severity, int code, Throwable throwable, String message) {
+ return this.log(severity, code, throwable, message, Tools.EMPTY_OBJECT_ARRAY);
+ }
+
+ /**
+ * Log the specified message and exception with the specified severity
+ * and code. Bind the message to the specified arguments.
+ * If the plug-in is {@link #isInactive() inactive}, log the information
+ * to the appropriate Java system log (instead of the Eclise platform log).
+ * Return the logged status.
+ * @see IStatus#getSeverity()
+ * @see IStatus#getCode()
+ */
+ public IStatus log(int severity, int code, Throwable throwable, String message, Object... args) {
+ if (args.length > 0) {
+ message = NLS.bind(message, args);
+ }
+ String id = this.getPluginID();
+ IStatus status = new Status(severity, ((id != null) ? id : UNKNOWN_PLUGIN_ID), code, message, throwable);
+ if (id != null) {
+ ILog log = this.getLog();
+ if (log != null) {
+ log.log(status);
+ } else {
+ this.log_(status);
+ }
+ } else {
+ this.log_(status);
+ }
+ return status;
+ }
+ protected static final String UNKNOWN_PLUGIN_ID = "unknown"; //$NON-NLS-1$
+
+ /**
+ * Return the plug-in's log.
+ * Return <code>null</code> if the plug-in is {@link #isInactive() inactive}.
+ * @see Platform#getLog(Bundle)
+ */
+ public ILog getLog() {
+ Bundle bundle = this.getBundle();
+ return (bundle == null) ? null : Platform.getLog(bundle);
+ }
+
+ /**
+ * Log the specified message and exception with the specified severity
+ * and code to the appropriate Java system log.
+ * This method is called when the plug-in is inactive or the Eclipse
+ * platform log is unavailable.
+ * @see IStatus#getSeverity()
+ * @see IStatus#getCode()
+ */
+ protected void log_(IStatus status) {
+ PrintStream stream = System.out;
+ int severity = status.getSeverity();
+ if ((severity == IStatus.ERROR) || (severity == IStatus.WARNING)) {
+ stream = System.err; // ???
+ }
+ synchronized (stream) {
+ this.log_(new PrintWriter(stream), status);
+ }
+ }
+
+ protected void log_(PrintWriter writer, IStatus status) {
+ writer.print(this.getClass().getName());
+ writer.print(':');
+ writer.println();
+ int severity = status.getSeverity();
+ switch (severity) {
+ case IStatus.CANCEL:
+ writer.print("CANCEL"); //$NON-NLS-1$
+ break;
+ case IStatus.ERROR:
+ writer.print("ERROR"); //$NON-NLS-1$
+ break;
+ case IStatus.WARNING:
+ writer.print("WARNING"); //$NON-NLS-1$
+ break;
+ case IStatus.INFO:
+ writer.print("INFO"); //$NON-NLS-1$
+ break;
+ case IStatus.OK:
+ writer.print("OK"); //$NON-NLS-1$
+ break;
+ default:
+ writer.print("SEVERITY "); //$NON-NLS-1$
+ writer.print(severity);
+ break;
+ }
+ int code = status.getCode();
+ if (code != IStatus.OK) {
+ writer.print(" (code="); //$NON-NLS-1$
+ writer.print(code);
+ writer.print(")"); //$NON-NLS-1$
+ }
+ String message = status.getMessage();
+ if (message != null) {
+ writer.print(": "); //$NON-NLS-1$
+ writer.print(message);
+ }
+ writer.println();
+ Throwable throwable = status.getException();
+ if (throwable != null) {
+ throwable.printStackTrace(writer);
+ }
+ }
+
+
+ // ********** statuses **********
+
+ /**
+ * Build a status with a severity of
+ * {@link IStatus#ERROR ERROR}.
+ * @see #buildStatus(int)
+ * @see IStatus
+ */
+ public IStatus buildErrorStatus() {
+ return this.buildStatus(IStatus.ERROR);
+ }
+
+ /**
+ * Build a status with a severity of
+ * {@link IStatus#OK OK}.
+ * @see #buildStatus(int)
+ * @see IStatus
+ */
+ public IStatus buildOKStatus() {
+ return this.buildStatus(IStatus.OK);
+ }
+
+ /**
+ * Build a status with the specified severity.
+ * @see IStatus#getSeverity()
+ */
+ public IStatus buildStatus(int severity) {
+ return this.buildStatus(severity, (String) null); // message can be null
+ }
+
+ /**
+ * Build a status with the specified message with a severity of
+ * {@link IStatus#ERROR ERROR}.
+ * @see #buildStatus(int, String)
+ * @see IStatus
+ */
+ public IStatus buildErrorStatus(String message) {
+ return this.buildStatus(IStatus.ERROR, message);
+ }
+
+ /**
+ * Build a status with the specified message with a severity of
+ * {@link IStatus#WARNING WARNING}.
+ * @see #buildStatus(int, String)
+ * @see IStatus
+ */
+ public IStatus buildWarningStatus(String message) {
+ return this.buildStatus(IStatus.WARNING, message);
+ }
+
+ /**
+ * Build a status with the specified message with a severity of
+ * {@link IStatus#INFO INFO}.
+ * @see #buildStatus(int, String)
+ * @see IStatus
+ */
+ public IStatus buildInfoStatus(String message) {
+ return this.buildStatus(IStatus.INFO, message);
+ }
+
+ /**
+ * Build a status with the specified severity and message.
+ * @see IStatus#getSeverity()
+ */
+ public IStatus buildStatus(int severity, String message) {
+ return this.buildStatus(severity, message, Tools.EMPTY_OBJECT_ARRAY);
+ }
+
+ /**
+ * Build a status with the specified message with a severity of
+ * {@link IStatus#ERROR ERROR}.
+ * @see #buildStatus(int, String, Object[])
+ * @see IStatus
+ */
+ public IStatus buildErrorStatus(String message, Object... args) {
+ return this.buildStatus(IStatus.ERROR, message, args);
+ }
+
+ /**
+ * Build a status with the specified message with a severity of
+ * {@link IStatus#WARNING WARNING}.
+ * @see #buildStatus(int, String, Object[])
+ * @see IStatus
+ */
+ public IStatus buildWarningStatus(String message, Object... args) {
+ return this.buildStatus(IStatus.WARNING, message, args);
+ }
+
+ /**
+ * Build a status with the specified message with a severity of
+ * {@link IStatus#INFO INFO}.
+ * @see #buildStatus(int, String, Object[])
+ * @see IStatus
+ */
+ public IStatus buildInfoStatus(String message, Object... args) {
+ return this.buildStatus(IStatus.INFO, message, args);
+ }
+
+ /**
+ * Build a status with the specified severity and message.
+ * Bind the message to the specified arguments.
+ * @see IStatus#getSeverity()
+ */
+ public IStatus buildStatus(int severity, String message, Object... args) {
+ return this.buildStatus(severity, (Throwable) null, message, args); // exception can be null
+ }
+
+ /**
+ * Build a status with the specified exception with a severity of
+ * {@link IStatus#ERROR ERROR}.
+ * @see #buildStatus(int, Throwable)
+ * @see IStatus
+ */
+ public IStatus buildErrorStatus(Throwable throwable) {
+ return this.buildStatus(IStatus.ERROR, throwable);
+ }
+
+ /**
+ * Build a status with the specified severity and exception.
+ * @see IStatus#getSeverity()
+ */
+ public IStatus buildStatus(int severity, Throwable throwable) {
+ return this.buildStatus(severity, throwable, throwable.getLocalizedMessage());
+ }
+
+ /**
+ * Build a status with the specified exception and message with a
+ * severity of {@link IStatus#ERROR ERROR}.
+ * @see #buildStatus(int, Throwable, String)
+ * @see IStatus
+ */
+ public IStatus buildErrorStatus(Throwable throwable, String message) {
+ return this.buildStatus(IStatus.ERROR, throwable, message);
+ }
+
+ /**
+ * Build a status with the specified severity, exception, and message.
+ * @see IStatus#getSeverity()
+ */
+ public IStatus buildStatus(int severity, Throwable throwable, String message) {
+ return this.buildStatus(severity, throwable, message, Tools.EMPTY_OBJECT_ARRAY);
+ }
+
+ /**
+ * Build a status with the specified exception and message with a
+ * severity of {@link IStatus#ERROR ERROR}.
+ * Bind the message to the specified arguments.
+ * @see #buildStatus(int, Throwable, String, Object[])
+ * @see IStatus
+ */
+ public IStatus buildErrorStatus(Throwable throwable, String message, Object... args) {
+ return this.buildStatus(IStatus.ERROR, throwable, message, args);
+ }
+
+ /**
+ * Build a status with the specified severity, exception, and message.
+ * Bind the message to the specified arguments.
+ * @see IStatus#getSeverity()
+ */
+ public IStatus buildStatus(int severity, Throwable throwable, String message, Object... args) {
+ return this.buildStatus(severity, IStatus.OK, throwable, message, args);
+ }
+
+ /**
+ * Build a status with the specified severity, code, exception, and message.
+ * @see IStatus#getSeverity()
+ * @see IStatus#getCode()
+ */
+ public IStatus buildStatus(int severity, int code, Throwable throwable, String message) {
+ return this.buildStatus(severity, code, throwable, message, Tools.EMPTY_OBJECT_ARRAY);
+ }
+
+ /**
+ * Build a status with the specified severity, code, exception, and message.
+ * Bind the message to the specified arguments.
+ * @see IStatus#getSeverity()
+ * @see IStatus#getCode()
+ */
+ public IStatus buildStatus(int severity, int code, Throwable throwable, String message, Object... args) {
+ if (args.length > 0) {
+ message = NLS.bind(message, args);
+ }
+ String id = this.getPluginID();
+ if (id == null) {
+ id = this.getClass().getName(); // seems reasonable
+ }
+ return new Status(severity, id, code, message, throwable);
+ }
+
+
+ // ********** exception handler **********
+
+ /**
+ * Return an exception handler that logs any exceptions with the plug-in
+ * with the appropriate severity; by default, {@link IStatus#ERROR error}.
+ */
+ public synchronized ExceptionHandler getExceptionHandler() {
+ if ((this.exceptionHandler == null) && this.isActive()) {
+ this.exceptionHandler = this.buildExceptionHandler();
+ }
+ return this.exceptionHandler;
+ }
+
+ /**
+ * By default the plug-in's exception handler will log any exceptions
+ * as {@link IStatus#ERROR errors}.
+ */
+ protected ExceptionHandler buildExceptionHandler() {
+ return this.buildExceptionHandler(IStatus.ERROR);
+ }
+
+ /**
+ * This public method can be used by code that would like its own exception
+ * handler, as opposed to using the plug-in's exception handler.
+ * @see #getExceptionHandler()
+ * @see PluginExceptionHandler
+ */
+ public ExceptionHandler buildExceptionHandler(int severity) {
+ return new PluginExceptionHandler(severity);
+ }
+
+ /**
+ * Handle any exception by logging it with the plug-in with the configured
+ * severity.
+ */
+ protected class PluginExceptionHandler
+ implements ExceptionHandler
+ {
+ private final int severity;
+ protected PluginExceptionHandler(int severity) {
+ super();
+ this.severity = severity;
+ }
+ public void handleException(Throwable t) {
+ JptPlugin.this.log(this.severity, t);
+ }
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this);
+ }
+ }
+
+
+ // ********** debug options **********
+
+ /**
+ * Return whether the plug-in is in debug mode.
+ * <p>
+ * To allow a user to enable a plug-in's <em>debug</em> mode
+ * (or any other debug options)
+ * add the appropriate entry to the plug-in's trace-options file.
+ * <p>
+ * For example, to allow the user to enable the <em>debug</em> mode for
+ * the plug-in <code>org.eclipse.jpt.common.core</code>,
+ * add the following entry to the file
+ * <code>org.eclipse.jpt.common.core/.options</code>:
+ * <pre>
+ * org.eclipse.jpt.common.core/debug=true
+ * </pre>
+ * The flag can be set via either:<ul>
+ * <li>The Host Workspace's Run > Run Configurations > Tracing settings
+ * </ul>
+ * or
+ * <p><ul>
+ * <li>The Target Workspace's Window > Preferences > General > Tracing settings
+ * (This will be present because all Dali debug options have been activated
+ * via the <code>org.eclipse.jpt.common.ui</code> extension
+ * to the <code>org.eclipse.ui.trace.traceComponents</code> extension point.
+ * See <code>org.eclipse.jpt.common.ui/plugin.xml</code>.)
+ * </ul>
+ */
+ public boolean isDebugEnabled() {
+ DebugOptions debugOptions = this.getDebugOptions();
+ if (debugOptions == null) {
+ return false;
+ }
+ StringBuilder option = this.getDebugOptionName();
+ return (option != null) && debugOptions.getBooleanOption(option.toString(), false);
+ }
+
+ /**
+ * Set whether the plug-in is in debug mode.
+ *
+ * @see #isDebugEnabled()
+ */
+ public void setDebugEnabled(boolean debug) {
+ DebugOptions debugOptions = this.getDebugOptions();
+ if (debugOptions != null) {
+ StringBuilder option = this.getDebugOptionName();
+ if (option != null) {
+ if ( ! debugOptions.isDebugEnabled()) {
+ debugOptions.setDebugEnabled(true);
+ }
+ debugOptions.setOption(option.toString(), Boolean.toString(debug));
+ }
+ }
+ }
+
+ /**
+ * Return the name of the plug-in's debug option.
+ * By default, this is in the form
+ * <em>&lt;plug-in ID&gt;/debug</em>
+ * (e.g. <code>org.eclipse.jpt.common.core/debug</code>).
+ * Return <code>null</code> if the plug-in is {@link #isInactive() inactive}.
+ */
+ protected StringBuilder getDebugOptionName() {
+ String id = this.getPluginID();
+ if (id == null) {
+ return null;
+ }
+ StringBuilder sb = new StringBuilder(id);
+ sb.append('/');
+ sb.append(this.getRelativeDebugOptionName());
+ return sb;
+ }
+
+ /**
+ * @see #RELATIVE_DEBUG_OPTION_NAME
+ */
+ protected String getRelativeDebugOptionName() {
+ return RELATIVE_DEBUG_OPTION_NAME;
+ }
+ /**
+ * Value: <code>{@value}</code>
+ */
+ protected static final String RELATIVE_DEBUG_OPTION_NAME = "debug"; //$NON-NLS-1$
+
+ /**
+ * Return the specified debug option as a <code>boolean</code> value.
+ * Return <code>false</code> if no such option is found.
+ * <p>
+ * The debug option is within the scope of the plug-in's debug options
+ * (e.g. for the plug-in <code>"org.eclipse.jpt.common.core"</code>,
+ * the specified option <code>"foo"</code> will be mapped to
+ * the {@link Platform} option
+ * <code>"org.eclipse.jpt.common.core/debug/foo"</code>).
+ */
+ public boolean getBooleanDebugOption(String option) {
+ return this.getBooleanDebugOption(option, false);
+ }
+
+ /**
+ * Return the specified debug option as a <code>boolean</code> value.
+ * Return the specified default value if no such option is found.
+ * <p>
+ * The debug option is within the scope of the plug-in's debug options
+ * (e.g. for the plug-in <code>"org.eclipse.jpt.common.core"</code>,
+ * the specified option <code>"foo"</code> will be mapped to
+ * the {@link Platform} option
+ * <code>"org.eclipse.jpt.common.core/debug/foo"</code>).
+ */
+ public boolean getBooleanDebugOption(String option, boolean defaultValue) {
+ String value = this.getDebugOption(option);
+ return (value == null) ? defaultValue : Boolean.parseBoolean(value.trim());
+ }
+
+ /**
+ * Set the specified debug option to the specified <code>boolean</code>
+ * value.
+ * <p>
+ * The debug option is within the scope of the plug-in's debug options
+ * (e.g. for the plug-in <code>"org.eclipse.jpt.common.core"</code>,
+ * the specified option <code>"foo"</code> will be mapped to
+ * the {@link Platform} option
+ * <code>"org.eclipse.jpt.common.core/debug/foo"</code>).
+ */
+ public void setDebugOption(String option, boolean value) {
+ this.setDebugOption(option, Boolean.toString(value));
+ }
+
+ /**
+ * Return the specified debug option as an <code>int</code> value.
+ * Return <code>-1</code> if no such option is found.
+ * <p>
+ * The debug option is within the scope of the plug-in's debug options
+ * (e.g. for the plug-in <code>"org.eclipse.jpt.common.core"</code>,
+ * the specified option <code>"foo"</code> will be mapped to
+ * the {@link Platform} option
+ * <code>"org.eclipse.jpt.common.core/debug/foo"</code>).
+ */
+ public int getIntegerDebugOption(String option) {
+ return this.getIntegerDebugOption(option, -1);
+ }
+
+ /**
+ * Return the specified debug option as an <code>int</code> value.
+ * Return the specified default value if no such option is found.
+ * <p>
+ * The debug option is within the scope of the plug-in's debug options
+ * (e.g. for the plug-in <code>"org.eclipse.jpt.common.core"</code>,
+ * the specified option <code>"foo"</code> will be mapped to
+ * the {@link Platform} option
+ * <code>"org.eclipse.jpt.common.core/debug/foo"</code>).
+ */
+ public int getIntegerDebugOption(String option, int defaultValue) {
+ String value = this.getDebugOption(option);
+ return (value == null) ? defaultValue : Integer.parseInt(value.trim());
+ }
+
+ /**
+ * Set the specified debug option to the specified <code>int</code>
+ * value.
+ * <p>
+ * The debug option is within the scope of the plug-in's debug options
+ * (e.g. for the plug-in <code>"org.eclipse.jpt.common.core"</code>,
+ * the specified option <code>"foo"</code> will be mapped to
+ * the {@link Platform} option
+ * <code>"org.eclipse.jpt.common.core/debug/foo"</code>).
+ */
+ public void setDebugOption(String option, int value) {
+ this.setDebugOption(option, Integer.toString(value));
+ }
+
+ /**
+ * Return the specified debug option.
+ * Return <code>null</code> if no such option is found.
+ * <p>
+ * The debug option is within the scope of the plug-in's debug options
+ * (e.g. for the plug-in <code>"org.eclipse.jpt.common.core"</code>,
+ * the specified option <code>"foo"</code> will be mapped to
+ * the {@link Platform} option
+ * <code>"org.eclipse.jpt.common.core/debug/foo"</code>).
+ */
+ public String getDebugOption(String option) {
+ return this.getDebugOption(option, null);
+ }
+
+ /**
+ * Return the specified debug option.
+ * Return the specified default value if no such option is found.
+ * <p>
+ * The debug option is within the scope of the plug-in's debug options
+ * (e.g. for the plug-in <code>"org.eclipse.jpt.common.core"</code>,
+ * the specified option <code>"foo"</code> will be mapped to
+ * the {@link Platform} option
+ * <code>"org.eclipse.jpt.common.core/debug/foo"</code>).
+ */
+ public String getDebugOption(String option, String defaultValue) {
+ this.checkDebugOption(option);
+ return this.isDebugEnabled() ? this.getDebugOption_(option, defaultValue) : defaultValue;
+ }
+
+ /**
+ * Pre-condition: the specified option is not blank.
+ */
+ protected String getDebugOption_(String option, String defaultValue) {
+ String value = this.getDebugOption_(option);
+ return (value != null) ? value : defaultValue;
+ }
+
+ protected String getDebugOption_(String option) {
+ DebugOptions debugOptions = this.getDebugOptions();
+ if (debugOptions == null) {
+ return null;
+ }
+ StringBuilder scope = this.getDebugOptionScope();
+ return (scope == null) ? null : debugOptions.getOption(scope.append(option).toString());
+ }
+
+ /**
+ * Set the specified debug option to the specified value.
+ * <p>
+ * The debug option is within the scope of the plug-in's debug options
+ * (e.g. for the plug-in <code>"org.eclipse.jpt.common.core"</code>,
+ * the specified option <code>"foo"</code> will be mapped to
+ * the {@link Platform} option
+ * <code>"org.eclipse.jpt.common.core/debug/foo"</code>).
+ * If the plug-in is not in {@link #isDebugEnabled() debug mode},
+ * the specified option is not changed.
+ */
+ public void setDebugOption(String option, String value) {
+ this.checkDebugOption(option);
+ if (this.isDebugEnabled()) {
+ this.setDebugOption_(option, value);
+ }
+ }
+
+ /**
+ * Pre-condition: the specified option is not blank.
+ */
+ protected void setDebugOption_(String option, String value) {
+ DebugOptions debugOptions = this.getDebugOptions();
+ if (debugOptions != null) {
+ StringBuilder scope = this.getDebugOptionScope();
+ if (scope != null) {
+ debugOptions.setOption(scope.append(option).toString(), value);
+ }
+ }
+ }
+
+ /**
+ * Remove the specified debug option.
+ * <p>
+ * The debug option is within the scope of the plug-in's debug options
+ * (e.g. for the plug-in <code>"org.eclipse.jpt.common.core"</code>,
+ * the specified option <code>"foo"</code> will be mapped to
+ * the {@link Platform} option
+ * <code>"org.eclipse.jpt.common.core/debug/foo"</code>).
+ * If the plug-in is not in {@link #isDebugEnabled() debug mode},
+ * the specified option is not changed.
+ */
+ public void removeDebugOption(String option) {
+ this.checkDebugOption(option);
+ if (this.isDebugEnabled()) {
+ this.removeDebugOption_(option);
+ }
+ }
+
+ /**
+ * Pre-condition: the specified option is not blank.
+ */
+ protected void removeDebugOption_(String option) {
+ DebugOptions debugOptions = this.getDebugOptions();
+ if (debugOptions != null) {
+ StringBuilder scope = this.getDebugOptionScope();
+ if (scope != null) {
+ debugOptions.removeOption(scope.append(option).toString());
+ }
+ }
+ }
+
+ protected DebugOptions getDebugOptions() {
+ ServiceTracker<DebugOptions, DebugOptions> tracker = this.getDebugOptionsTracker();
+ return (tracker == null) ? null : tracker.getService();
+ }
+
+ private synchronized ServiceTracker<DebugOptions, DebugOptions> getDebugOptionsTracker() {
+ if ((this.debugOptionsTracker == null) && this.isActive()) {
+ this.debugOptionsTracker = this.buildDebugOptionsTracker();
+ this.debugOptionsTracker.open();
+ }
+ return this.debugOptionsTracker;
+ }
+
+ private ServiceTracker<DebugOptions, DebugOptions> buildDebugOptionsTracker() {
+ return new ServiceTracker<DebugOptions, DebugOptions>(this.bundleContext, DebugOptions.class, null);
+ }
+
+ /**
+ * Return the name of the plug-in's debug option scope.
+ * Include an appended <code>'/'</code>.
+ * By default, this is in the form
+ * <em>&lt;plug-in ID&gt;/debug/</em>
+ * (e.g. <code>org.eclipse.jpt.common.core/debug/</code>).
+ * Return <code>null</code> if the plug-in is {@link #isInactive() inactive}.
+ */
+ protected StringBuilder getDebugOptionScope() {
+ StringBuilder sb = this.getDebugOptionName();
+ return (sb == null) ? null : sb.append('/');
+ }
+
+ protected void checkDebugOption(String option) {
+ if (StringTools.stringIsEmpty(option)) {
+ throw new IllegalArgumentException("debug option cannot be blank"); //$NON-NLS-1$
+ }
+ }
+
+
+ // ********** tracing **********
+
+ /**
+ * Trace the calling method for the specified debug option (with no message).
+ * This method should be called directly from the method to be traced,
+ * as only the name of that single method will be recorded.
+ * <p>
+ * The debug option is within the scope of the plug-in's debug options
+ * (e.g. for the plug-in <code>"org.eclipse.jpt.common.core"</code>,
+ * the specified option <code>"foo"</code> will be mapped to
+ * the {@link Platform} option
+ * <code>"org.eclipse.jpt.common.core/debug/foo"</code>).
+ * If the plug-in is not in {@link #isDebugEnabled() debug mode},
+ * the specified message is not traced.
+ *
+ * @see #dumpStackTrace(String)
+ */
+ public void trace(String option) {
+ this.trace(option, (String) null); // message can be null
+ }
+
+ /**
+ * Trace the specified message for the specified debug option.
+ * This method should be called directly from the method to be traced,
+ * as only the name of that single method will be recorded.
+ * <p>
+ * The debug option is within the scope of the plug-in's debug options
+ * (e.g. for the plug-in <code>"org.eclipse.jpt.common.core"</code>,
+ * the specified option <code>"foo"</code> will be mapped to
+ * the {@link Platform} option
+ * <code>"org.eclipse.jpt.common.core/debug/foo"</code>).
+ * If the plug-in is not in {@link #isDebugEnabled() debug mode},
+ * the specified message is not traced.
+ *
+ * @see #dumpStackTrace(String, String)
+ */
+ public void trace(String option, String message) {
+ this.trace(option, message, Tools.EMPTY_OBJECT_ARRAY);
+ }
+
+ /**
+ * Trace the specified message for the specified debug option.
+ * This method should be called directly from the method to be traced,
+ * as only the name of that single method will be recorded.
+ * <p>
+ * The debug option is within the scope of the plug-in's debug options
+ * (e.g. for the plug-in <code>"org.eclipse.jpt.common.core"</code>,
+ * the specified option <code>"foo"</code> will be mapped to
+ * the {@link Platform} option
+ * <code>"org.eclipse.jpt.common.core/debug/foo"</code>).
+ * Bind the message to the specified arguments.
+ * If the plug-in is not in {@link #isDebugEnabled() debug mode},
+ * the specified message is not traced.
+ *
+ * @see #dumpStackTrace(String, String, Object...)
+ */
+ public void trace(String option, String message, Object... args) {
+ this.trace(option, null, message, args);
+ }
+
+ /**
+ * Trace the specified exception for the specified debug option.
+ * This method should be called directly from the method to be traced,
+ * as only the name of that single method will be recorded.
+ * Only the specified exception's class name and
+ * {@link Throwable#getLocalizedMessage() message} will be recorded in the
+ * trace log (as opposed to the exception's stack trace).
+ * <p>
+ * The debug option is within the scope of the plug-in's debug options
+ * (e.g. for the plug-in <code>"org.eclipse.jpt.common.core"</code>,
+ * the specified option <code>"foo"</code> will be mapped to
+ * the {@link Platform} option
+ * <code>"org.eclipse.jpt.common.core/debug/foo"</code>).
+ * If the plug-in is not in {@link #isDebugEnabled() debug mode},
+ * the specified message is not traced.
+ */
+ public void trace(String option, Throwable throwable) {
+ this.trace(option, throwable, throwable.getLocalizedMessage());
+ }
+
+ /**
+ * Trace the specified exception and message for the specified debug option.
+ * This method should be called directly from the method to be traced,
+ * as only the name of that single method will be recorded.
+ * Only the specified exception's class name and
+ * {@link Throwable#getLocalizedMessage() message} will be recorded in the
+ * trace log (as opposed to the exception's stack trace).
+ * <p>
+ * The debug option is within the scope of the plug-in's debug options
+ * (e.g. for the plug-in <code>"org.eclipse.jpt.common.core"</code>,
+ * the specified option <code>"foo"</code> will be mapped to
+ * the {@link Platform} option
+ * <code>"org.eclipse.jpt.common.core/debug/foo"</code>).
+ * If the plug-in is not in {@link #isDebugEnabled() debug mode},
+ * the specified message is not traced.
+ */
+ public void trace(String option, Throwable throwable, String message) {
+ this.trace(option, throwable, message, Tools.EMPTY_OBJECT_ARRAY);
+ }
+
+ /**
+ * Trace the specified message and exception for the specified debug option.
+ * This method should be called directly from the method to be traced,
+ * as only the name of that single method will be recorded.
+ * Only the specified exception's class name and
+ * {@link Throwable#getLocalizedMessage() message} will be recorded in the
+ * trace log (as opposed to the exception's stack trace).
+ * <p>
+ * The debug option is within the scope of the plug-in's debug options
+ * (e.g. for the plug-in <code>"org.eclipse.jpt.common.core"</code>,
+ * the specified option <code>"foo"</code> will be mapped to
+ * the {@link Platform} option
+ * <code>"org.eclipse.jpt.common.core/debug/foo"</code>).
+ * Bind the message to the specified arguments.
+ * If the plug-in is not in {@link #isDebugEnabled() debug mode},
+ * the specified message is not traced.
+ */
+ public void trace(String option, Throwable throwable, String message, Object... args) {
+ this.checkDebugOption(option);
+ if (this.isDebugEnabled()) {
+ this.trace_(option, throwable, message, args);
+ }
+ }
+
+ /**
+ * Pre-condition: the specified option is not blank.
+ */
+ protected void trace_(String option, Throwable throwable, String message, Object... args) {
+ if (args.length > 0) {
+ message = NLS.bind(message, args);
+ }
+ DebugTrace trace = this.getDebugTrace();
+ if (trace != null) {
+ trace.trace(this.getTraceOptionScope().append(option).toString(), message, throwable);
+ }
+ }
+
+ /**
+ * Dump a stack trace for the specified debug option.
+ * <p>
+ * The debug option is within the scope of the plug-in's debug options
+ * (e.g. for the plug-in <code>"org.eclipse.jpt.common.core"</code>,
+ * the specified option <code>"foo"</code> will be mapped to
+ * the {@link Platform} option
+ * <code>"org.eclipse.jpt.common.core/debug/foo"</code>).
+ * If the plug-in is not in {@link #isDebugEnabled() debug mode},
+ * the stack trace is not dumped.
+ */
+ public void dumpStackTrace(String option) {
+ this.dumpStackTrace(option, null);
+ }
+
+ /**
+ * Dump a stack trace for the specified debug option.
+ * Precede it with a trace for the specified message.
+ * This method should be called directly from the method to be traced,
+ * as only that single method will be recorded with the message.
+ * <p>
+ * The debug option is within the scope of the plug-in's debug options
+ * (e.g. for the plug-in <code>"org.eclipse.jpt.common.core"</code>,
+ * the specified option <code>"foo"</code> will be mapped to
+ * the {@link Platform} option
+ * <code>"org.eclipse.jpt.common.core/debug/foo"</code>).
+ * If the plug-in is not in {@link #isDebugEnabled() debug mode},
+ * the stack trace is not dumped.
+ */
+ public void dumpStackTrace(String option, String message) {
+ this.dumpStackTrace(option, message, Tools.EMPTY_OBJECT_ARRAY);
+ }
+
+ /**
+ * Dump a stack trace for the specified debug option.
+ * Precede it with a trace for the specified message.
+ * This method should be called directly from the method to be traced,
+ * as only that single method will be recorded with the message.
+ * <p>
+ * The debug option is within the scope of the plug-in's debug options
+ * (e.g. for the plug-in <code>"org.eclipse.jpt.common.core"</code>,
+ * the specified option <code>"foo"</code> will be mapped to
+ * the {@link Platform} option
+ * <code>"org.eclipse.jpt.common.core/debug/foo"</code>).
+ * Bind the message to the specified arguments.
+ * If the plug-in is not in {@link #isDebugEnabled() debug mode},
+ * the stack trace is not dumped.
+ */
+ public void dumpStackTrace(String option, String message, Object... args) {
+ this.checkDebugOption(option);
+ if (this.isDebugEnabled()) {
+ if (message != null) {
+ this.trace_(option, null, message, args);
+ }
+ this.dumpStackTrace_(option);
+ }
+ }
+
+ /**
+ * Pre-condition: the specified option is not blank.
+ */
+ // TODO file bug with Platform:
+ // EclipseDebugTrace.traceDumpStack(...) should filter out trace class
+ // entries like FrameworkDebugTraceEntry constructor
+ protected void dumpStackTrace_(String option) {
+ DebugTrace trace = this.getDebugTrace();
+ if (trace != null) {
+ trace.traceDumpStack(this.getTraceOptionScope().append(option).toString());
+ }
+ }
+
+ /**
+ * Default value: <code>"/debug/"</code>
+ */
+ protected StringBuilder getTraceOptionScope() {
+ StringBuilder sb = new StringBuilder();
+ sb.append('/');
+ sb.append(this.getRelativeTraceOptionName());
+ sb.append('/');
+ return sb;
+ }
+
+ /**
+ * @see #getRelativeDebugOptionName()
+ */
+ protected String getRelativeTraceOptionName() {
+ return this.getRelativeDebugOptionName();
+ }
+
+ protected synchronized DebugTrace getDebugTrace() {
+ if ((this.debugTrace == null) && this.isActive()) {
+ this.debugTrace = this.buildDebugTrace();
+ }
+ return this.debugTrace;
+ }
+
+ protected DebugTrace buildDebugTrace() {
+ return this.buildDebugTrace(this.getDebugTraceEntryClass());
+ }
+
+ /**
+ * @see #DEBUG_TRACE_ENTRY_CLASS
+ */
+ protected Class<?> getDebugTraceEntryClass() {
+ return DEBUG_TRACE_ENTRY_CLASS;
+ }
+ /**
+ * Value: <code>{@value}</code>
+ */
+ protected final Class<?> DEBUG_TRACE_ENTRY_CLASS = JptPlugin.class;
+
+ /**
+ * The specified trace entry class must be the class where the trace methods
+ * are <em>defined</em> (<em>not</em> the class of the object that receives
+ * the message at runtime - i.e. do not use the result of
+ * {@link #getClass()}), as that is the class captured in a stacktrace.
+ */
+ protected DebugTrace buildDebugTrace(Class<?> traceEntryClass) {
+ DebugOptions debugOptions = this.getDebugOptions();
+ if (debugOptions == null) {
+ return null;
+ }
+ String id = this.getPluginID();
+ return (id == null) ? null : debugOptions.newDebugTrace(id, traceEntryClass);
+ }
+
+
+ // ********** misc **********
+
+ /**
+ * Return the plug-in's bundle. Return <code>null</code> if the plug-in is
+ * {@link #isInactive() inactive}.
+ */
+ public synchronized Bundle getBundle() {
+ return (this.bundleContext == null) ? null : this.bundleContext.getBundle();
+ }
+
+ /**
+ * Return the plug-in's ID (i.e. the symbolic name of the plug-in's bundle).
+ * Return <code>null</code> if the plug-in is {@link #isInactive() inactive}.
+ */
+ public String getPluginID() {
+ Bundle bundle = this.getBundle();
+ return (bundle == null) ? null : bundle.getSymbolicName();
+ }
+
+ /**
+ * Return the plug-in's "original" ID. This is useful for backward and
+ * forward compatibility of resource persistent properties and preferences.
+ * By default return the {@link #getPluginID() current plug-in ID}.
+ * Return <code>null</code> if the plug-in is {@link #isInactive() inactive}.
+ */
+ public String getOriginalPluginID() {
+ return this.isActive() ? this.getOriginalPluginID_() : null;
+ }
+
+ /**
+ * Override this method if the {@link Bundle#getSymbolicName() plug-in's ID}
+ * changes but there are previously-saved resource persistent properties
+ * and/or preferences that use the original plug-in ID and backward and/or
+ * forward compatibility is desirable.
+ */
+ protected String getOriginalPluginID_() {
+ return this.getPluginID();
+ }
+
+ /**
+ * Return whether the plug-in is active; i.e. it has been
+ * {@link #start(BundleContext) started}.
+ */
+ public synchronized boolean isActive() {
+ return this.bundleContext != null;
+ }
+
+ /**
+ * Return whether the plug-in is inactive; i.e. it has been
+ * {@link #stop(BundleContext) stopped} or not yet
+ * {@link #start(BundleContext) started}.
+ */
+ public boolean isInactive() {
+ return ! this.isActive();
+ }
+
+ /**
+ * Qualify the specified relative name with the plug-in's ID.
+ * Return <code>null</code> if the plug-in is {@link #isInactive() inactive}.
+ */
+ public QualifiedName buildQualifiedName(String relativeName) {
+ String id = this.getPluginID();
+ return (id == null) ? null : new QualifiedName(id, relativeName);
+ }
+
+ /**
+ * Return <code>null</code> if the plug-in is {@link #isInactive() inactive}
+ * or if the system is running with no data area (<code>-data @none</code>).
+ * @see org.eclipse.core.runtime.Plugin#getStateLocation()
+ * @see Platform#getStateLocation(Bundle)
+ */
+ public IPath getStateLocation() {
+ try {
+ return this.getStateLocation_();
+ } catch (IllegalStateException ex) {
+ return null;
+ }
+ }
+
+ protected IPath getStateLocation_() {
+ Bundle bundle = this.getBundle();
+ return (bundle == null) ? null : Platform.getStateLocation(bundle);
+ }
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this, this.getBundle());
+ }
+}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/PlatformTools.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/PlatformTools.java
index 462ccd18c3..0385c90924 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/PlatformTools.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/PlatformTools.java
@@ -21,7 +21,9 @@ import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.core.runtime.content.IContentTypeManager;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
+import org.eclipse.jpt.common.core.JptResourceType;
+import org.eclipse.jpt.common.core.JptWorkspace;
+import org.eclipse.jpt.common.core.internal.plugin.JptCommonCorePlugin;
/**
* A collection of utilities for dealing with the Eclipse platform API.
@@ -63,6 +65,20 @@ public class PlatformTools {
return project.getFile(projectRelativePath);
}
+ public static JptResourceType getResourceType(IContentType contentType) {
+ JptWorkspace jptWorkspace = getJptWorkspace();
+ return (jptWorkspace == null) ? null : jptWorkspace.getResourceTypeManager().getResourceType(contentType);
+ }
+
+ public static JptResourceType getResourceType(IContentType contentType, String version) {
+ JptWorkspace jptWorkspace = getJptWorkspace();
+ return (jptWorkspace == null) ? null : jptWorkspace.getResourceTypeManager().getResourceType(contentType, version);
+ }
+
+ private static JptWorkspace getJptWorkspace() {
+ return getAdapter(ResourcesPlugin.getWorkspace(), JptWorkspace.class);
+ }
+
/**
* Return the specified file's content type,
* using the Eclipse platform's content type manager.
@@ -85,12 +101,12 @@ public class PlatformTools {
try {
contentType = findContentTypeFor(fileContents, fileName);
} catch (IOException ex) {
- JptCommonCorePlugin.log(ex);
+ JptCommonCorePlugin.instance().logError(ex);
} finally {
try {
fileContents.close();
} catch (IOException ex) {
- JptCommonCorePlugin.log(ex);
+ JptCommonCorePlugin.instance().logError(ex);
}
}
return contentType;
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/ProjectTools.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/ProjectTools.java
new file mode 100644
index 0000000000..2e6d626ce6
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/ProjectTools.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.utility;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jpt.common.core.internal.plugin.JptCommonCorePlugin;
+import org.eclipse.jst.j2ee.internal.J2EEConstants;
+import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
+import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+
+/**
+ * Utility methods for {@link IProject Eclipse projects}.
+ */
+public class ProjectTools {
+
+ /**
+ * Return the runtime path to which <code>.jar</code> files are relatively
+ * specified for the specified project.
+ * A web project has a runtime root path of <code>"/WEB-INF"</code>;
+ * while for a non-web project it is simply <code>"/"</code>.
+ */
+ public static IPath getJarRuntimeRootPath(IProject project) {
+ String path = "/"; //$NON-NLS-1$
+ if (hasWebFacet(project)) {
+ path = path + J2EEConstants.WEB_INF;
+ }
+ return new Path(path);
+ }
+
+ /**
+ * Return whether the specified project has a
+ * {@link IModuleConstants#JST_WEB_MODULE Web facet}.
+ */
+ public static boolean hasWebFacet(IProject project) {
+ return hasFacet(project, IModuleConstants.JST_WEB_MODULE);
+ }
+
+ /**
+ * Return whether the specified project has the specified facet.
+ */
+ public static boolean hasFacet(IProject project, IProjectFacet facet) {
+ return hasFacet(project, facet.getId());
+ }
+
+ /**
+ * Return whether the specified project has the specified facet.
+ */
+ public static boolean hasFacet(IProject project, String facetID) {
+ try {
+ return FacetedProjectFramework.hasProjectFacet(project, facetID);
+ } catch (CoreException ex) {
+ // problem reading the project metadata - assume facet does not exist and return 'false'
+ JptCommonCorePlugin.instance().logError(ex);
+ return false;
+ }
+ }
+
+ private ProjectTools() {
+ super();
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/XPointTools.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/XPointTools.java
index 5942fb531f..df89ba76f0 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/XPointTools.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/XPointTools.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2012 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.
@@ -11,128 +11,175 @@ package org.eclipse.jpt.common.core.internal.utility;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.Platform;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
+import org.eclipse.jpt.common.core.internal.plugin.JptCommonCorePlugin;
import org.eclipse.jpt.common.core.internal.JptCommonCoreMessages;
import org.eclipse.osgi.util.NLS;
import org.osgi.framework.Bundle;
/**
- * Utilities for extension point management, validation, etc.
+ * Utilities for Eclipse extension point management, validation, etc.
*/
public class XPointTools {
-
- public static String findRequiredAttribute(
- IConfigurationElement configElement, String attributeName)
- throws XPointException {
-
- String val = configElement.getAttribute(attributeName);
- if (val == null) {
- logMissingAttribute(configElement, attributeName);
+ /**
+ * Return the value of the specified attribute of the specified element.
+ * @exception XPointException if the value is <code>null</code>.
+ */
+ public static String findRequiredAttribute(IConfigurationElement element, String attributeName) throws XPointException {
+ String value = element.getAttribute(attributeName);
+ if (value == null) {
+ logMissingAttribute(element, attributeName);
throw new XPointException();
}
- return val;
+ return value;
}
-
- public static <T> T instantiate(String pluginId, String extensionPoint, String className, Class<T> interfaze) {
- Class<T> clazz = loadClass(pluginId, extensionPoint, className, interfaze);
- return (clazz == null) ? null : instantiate(pluginId, extensionPoint, clazz);
+
+ private static void logMissingAttribute(IConfigurationElement element, String attributeName) {
+ logError(buildMissingAttributeMessage(element, attributeName));
+ }
+
+ /**
+ * Return a helpful message indicating the specified attribute is missing
+ * from the specified element.
+ */
+ public static String buildMissingAttributeMessage(IConfigurationElement element, String attributeName) {
+ return bind(JptCommonCoreMessages.REGISTRY_MISSING_ATTRIBUTE,
+ attributeName,
+ element.getName(),
+ element.getDeclaringExtension().getExtensionPointUniqueIdentifier(),
+ element.getContributor().getName()
+ );
}
/**
- * Instantiate the specified class.
+ * Return a helpful message indicating the specified attribute
+ * from the specified element has an invalid value.
*/
- public static <T> T instantiate(String pluginId, String extensionPoint, Class<T> clazz) {
- try {
- return clazz.newInstance();
- } catch (Exception ex) {
- logFailedInstantiation(ex, pluginId, extensionPoint, clazz.getName());
- return null;
- }
+ public static String buildInvalidValueMessage(IConfigurationElement element, String attributeName, String invalidValue) {
+ return bind(JptCommonCoreMessages.REGISTRY_INVALID_VALUE,
+ invalidValue,
+ attributeName,
+ element.getDeclaringExtension().getExtensionPointUniqueIdentifier(),
+ element.getContributor().getName()
+ );
}
+ private static String bind(String msg, Object... args) {
+ return NLS.bind(msg, args);
+ }
+
+ /**
+ * Load the specified class, using the specified bundle, and, if it is a
+ * sub-type the specified interface, instantiate it and return the resulting
+ * object, cast appropriately.
+ * Log an error and return <code>null</code> for any of the following
+ * conditions:<ul>
+ * <li>the bundle cannot be resolved
+ * <li>the class fails to load
+ * <li>the loaded class is not a sub-type of the specified interface
+ * <li>the loaded class cannot be instantiated.
+ * </ul>
+ */
+ public static <T> T instantiate(String pluginID, String extensionPoint, String className, Class<T> interfaze) {
+ Class<T> clazz = loadClass(pluginID, extensionPoint, className, interfaze);
+ return (clazz == null) ? null : instantiate(pluginID, extensionPoint, clazz);
+ }
+
/**
- * Load the specified class and cast it to the specified interface.
+ * Load the specified class, using the specified bundle, and cast it to the
+ * specified interface before returning it.
+ * Log an error and return <code>null</code> for any of the following
+ * conditions:<ul>
+ * <li>the bundle cannot be resolved
+ * <li>the class fails to load
+ * <li>the loaded class is not a sub-type of the specified interface
+ * </ul>
*/
- private static <T> Class<T> loadClass(String pluginId, String extensionPoint, String className, Class<T> interfaze) {
- Bundle bundle = Platform.getBundle(pluginId);
+ private static <T> Class<T> loadClass(String pluginID, String extensionPoint, String className, Class<T> interfaze) {
+ Bundle bundle = Platform.getBundle(pluginID);
+ if (bundle == null) {
+ logMissingBundle(pluginID);
+ return null;
+ }
Class<?> clazz;
try {
clazz = bundle.loadClass(className);
} catch (Exception ex) {
- logFailedClassLoad(ex, pluginId, extensionPoint, className);
+ logFailedClassLoad(ex, pluginID, extensionPoint, className);
return null;
}
-
- if (interfaze.isAssignableFrom(clazz)) {
- @SuppressWarnings("unchecked")
- Class<T> clazzT = (Class<T>) clazz;
- return clazzT;
+
+ if ( ! interfaze.isAssignableFrom(clazz)) {
+ logFailedInterfaceAssignment(pluginID, extensionPoint, clazz, interfaze);
+ return null;
}
-
- logFailedInterfaceAssignment(pluginId, extensionPoint, className, interfaze.getName());
- return null;
- }
-
- public static void logDuplicateExtension(String extensionPoint, String nodeName, String value) {
- log(JptCommonCoreMessages.REGISTRY_DUPLICATE, extensionPoint, nodeName, value);
- }
-
- public static void logMissingAttribute(IConfigurationElement configElement, String attributeName) {
- log(JptCommonCoreMessages.REGISTRY_MISSING_ATTRIBUTE,
- attributeName,
- configElement.getName(),
- configElement.getDeclaringExtension().getExtensionPointUniqueIdentifier(),
- configElement.getContributor().getName());
+
+ @SuppressWarnings("unchecked")
+ Class<T> clazzT = (Class<T>) clazz;
+ return clazzT;
}
- public static void logInvalidValue(
- IConfigurationElement configElement, String nodeName, String invalidValue) {
-
- log(JptCommonCoreMessages.REGISTRY_INVALID_VALUE,
- invalidValue,
- nodeName,
- configElement.getDeclaringExtension().getExtensionPointUniqueIdentifier(),
- configElement.getContributor().getName());
+ private static void logMissingBundle(String pluginID) {
+ logError(JptCommonCoreMessages.REGISTRY_MISSING_BUNDLE, pluginID);
}
- private static void logFailedClassLoad(Exception ex, String pluginId, String extensionPoint, String className) {
- log(ex, JptCommonCoreMessages.REGISTRY_FAILED_CLASS_LOAD,
+ private static void logFailedClassLoad(Exception ex, String pluginID, String extensionPoint, String className) {
+ logError(ex, JptCommonCoreMessages.REGISTRY_FAILED_CLASS_LOAD,
className,
extensionPoint,
- pluginId);
+ pluginID
+ );
}
- private static void logFailedInterfaceAssignment(
- String pluginId, String extensionPoint, String className, String interfaceName) {
-
- log(JptCommonCoreMessages.REGISTRY_FAILED_INTERFACE_ASSIGNMENT,
- className,
+ private static void logFailedInterfaceAssignment(String pluginID, String extensionPoint, Class<?> clazz, Class<?> interfaze) {
+ logError(JptCommonCoreMessages.REGISTRY_FAILED_INTERFACE_ASSIGNMENT,
+ clazz.getName(),
extensionPoint,
- pluginId,
- interfaceName);
+ pluginID,
+ interfaze.getName()
+ );
}
- private static void logFailedInstantiation(Exception ex, String pluginId, String extensionPoint, String className) {
- log(ex, JptCommonCoreMessages.REGISTRY_FAILED_INSTANTIATION,
- className,
+ /**
+ * Instantiate the specified class.
+ * Log an error and return <code>null</code> if the instantiation fails.
+ */
+ private static <T> T instantiate(String pluginID, String extensionPoint, Class<T> clazz) {
+ try {
+ return clazz.newInstance();
+ } catch (Exception ex) {
+ logFailedInstantiation(ex, pluginID, extensionPoint, clazz);
+ return null;
+ }
+ }
+
+ private static void logFailedInstantiation(Exception ex, String pluginID, String extensionPoint, Class<?> clazz) {
+ logError(ex, JptCommonCoreMessages.REGISTRY_FAILED_INSTANTIATION,
+ clazz.getName(),
extensionPoint,
- pluginId);
+ pluginID
+ );
}
- public static void log(String msg, String... bindings) {
- JptCommonCorePlugin.log(NLS.bind(msg, bindings));
+ private static void logError(String msg, Object... args) {
+ JptCommonCorePlugin.instance().logError(msg, args);
}
- public static void log(Throwable ex, String msg, String... bindings) {
- JptCommonCorePlugin.log(NLS.bind(msg, bindings), ex);
+ private static void logError(Throwable ex, String msg, Object... args) {
+ JptCommonCorePlugin.instance().logError(ex, msg, args);
}
-
- public static void log(Throwable ex) {
- JptCommonCorePlugin.log(ex);
+
+ private static void logError(String msg) {
+ JptCommonCorePlugin.instance().logError(msg);
}
-
-
+
+ private XPointTools() {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * exception
+ */
public static final class XPointException extends Exception {
private static final long serialVersionUID = 1L;
}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/command/RepeatingJobCommandWrapper.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/command/RepeatingJobCommandWrapper.java
index ce34a4765c..35617e7329 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/command/RepeatingJobCommandWrapper.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/command/RepeatingJobCommandWrapper.java
@@ -14,7 +14,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Status;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
+import org.eclipse.jpt.common.core.internal.plugin.JptCommonCorePlugin;
import org.eclipse.jpt.common.core.utility.command.JobCommand;
import org.eclipse.jpt.common.core.utility.command.JobCommandExecutor;
import org.eclipse.jpt.common.core.utility.command.RepeatingJobCommand;
@@ -85,7 +85,7 @@ public class RepeatingJobCommandWrapper
private final ArrayList<StackTrace> stackTraces = debug() ? new ArrayList<StackTrace>() : null;
private static boolean debug() {
- return JptCommonCorePlugin.instance().isDebugging();
+ return JptCommonCorePlugin.instance().isDebugEnabled();
}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/resource/ProjectResourceLocator.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/resource/ProjectResourceLocator.java
index e8c05d6045..e05278f149 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/resource/ProjectResourceLocator.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/resource/ProjectResourceLocator.java
@@ -20,7 +20,7 @@ import org.eclipse.core.runtime.IPath;
* ProjectResourceLocator locator = (ProjectResourceLocator) project.getAdapter(ProjectResourceLocator.class);
* </pre>
* <p>
- * See <code>org.eclipse.jpt.common.core/plugin.xml</code>.
+ * See <code>org.eclipse.jpt.common.core/plugin.xml:org.eclipse.core.runtime.adapters</code>.
* <p>
* Provisional API: This interface is part of an interim API that is still
* under development and expected to change significantly before reaching
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/resource/java/JavaResourceCompilationUnit.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/resource/java/JavaResourceCompilationUnit.java
index 0a752f4137..99339e7b82 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/resource/java/JavaResourceCompilationUnit.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/resource/java/JavaResourceCompilationUnit.java
@@ -9,13 +9,17 @@
******************************************************************************/
package org.eclipse.jpt.common.core.resource.java;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.plugin.JptCommonCorePlugin;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationEditFormatter;
import org.eclipse.jpt.common.utility.command.CommandExecutor;
/**
- * Dali resource for JDT compilation unit.
+ * Dali resource for JDT compilation unit (i.e. a Java source code file).
* <p>
* Provisional API: This interface is part of an interim API that is still
* under development and expected to change significantly before reaching
@@ -70,4 +74,17 @@ public interface JavaResourceCompilationUnit
* Build an AST for the compilation unit with its bindings resolved.
*/
CompilationUnit buildASTRoot();
+
+
+ // ********** content types **********
+
+ /**
+ * The content type for Java source code files.
+ */
+ IContentType CONTENT_TYPE = Platform.getContentTypeManager().getContentType(JavaCore.JAVA_SOURCE_CONTENT_TYPE);
+
+ /**
+ * The content type for <code>package-info</code> Java source code files.
+ */
+ IContentType PACKAGE_INFO_CONTENT_TYPE = JptCommonCorePlugin.instance().getContentType("javaPackageInfo"); //$NON-NLS-1$
}
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/resource/java/JavaResourcePackageFragmentRoot.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/resource/java/JavaResourcePackageFragmentRoot.java
index 12082c6532..fd8200c7e9 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/resource/java/JavaResourcePackageFragmentRoot.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/resource/java/JavaResourcePackageFragmentRoot.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2012 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.
@@ -9,10 +9,14 @@
******************************************************************************/
package org.eclipse.jpt.common.core.resource.java;
+import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.jpt.common.core.internal.plugin.JptCommonCorePlugin;
+
/**
- * Java package fragement root
- *
+ * Java package fragement root (i.e. a claspath entry: either a directory or
+ * a <code>.jar</code>).
+ * <p>
* Provisional API: This interface is part of an interim API that is still
* under development and expected to change significantly before reaching
* stability. It is available at this early stage to solicit feedback from
@@ -26,6 +30,11 @@ public interface JavaResourcePackageFragmentRoot
extends JavaResourceNode.Root
{
/**
+ * The content type for Java archives (<code>.jar</code>).
+ */
+ IContentType JAR_CONTENT_TYPE = JptCommonCorePlugin.instance().getContentType("jar"); //$NON-NLS-1$
+
+ /**
* Return the package fragment root's package fragments.
*/
Iterable<JavaResourcePackageFragment> getPackageFragments();
@@ -35,5 +44,4 @@ public interface JavaResourcePackageFragmentRoot
* Return the size of the package fragment root's package fragments.
*/
int getPackageFragmentsSize();
-
}
diff --git a/common/plugins/org.eclipse.jpt.common.eclipselink.core/.classpath b/common/plugins/org.eclipse.jpt.common.eclipselink.core/.classpath
index 042690f1e1..9500b6fc96 100644
--- a/common/plugins/org.eclipse.jpt.common.eclipselink.core/.classpath
+++ b/common/plugins/org.eclipse.jpt.common.eclipselink.core/.classpath
@@ -5,6 +5,8 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
<accessrules>
+ <accessrule kind="nonaccessible" pattern="org/eclipse/jpt/**/plugin/**"/>
+ <accessrule kind="accessible" pattern="org/eclipse/jpt/common/core/**"/>
<accessrule kind="nonaccessible" pattern="org/eclipse/jpt/common/utility/model/value/**"/>
<accessrule kind="nonaccessible" pattern="org/eclipse/jpt/common/utility/internal/model/listener/awt/**"/>
<accessrule kind="nonaccessible" pattern="org/eclipse/jpt/common/utility/internal/model/value/**"/>
diff --git a/common/plugins/org.eclipse.jpt.common.eclipselink.core/META-INF/MANIFEST.MF b/common/plugins/org.eclipse.jpt.common.eclipselink.core/META-INF/MANIFEST.MF
index 10d2d0b159..7dbb4c0d76 100644
--- a/common/plugins/org.eclipse.jpt.common.eclipselink.core/META-INF/MANIFEST.MF
+++ b/common/plugins/org.eclipse.jpt.common.eclipselink.core/META-INF/MANIFEST.MF
@@ -4,7 +4,7 @@ Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.jpt.common.eclipselink.core;singleton:=true
Bundle-Version: 1.2.0.qualifier
-Bundle-Activator: org.eclipse.jpt.common.eclipselink.core.JptCommonEclipseLinkCorePlugin
+Bundle-Activator: org.eclipse.jpt.common.eclipselink.core.internal.plugin.JptCommonEclipseLinkCorePlugin
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .
Bundle-Localization: plugin
@@ -12,10 +12,10 @@ Bundle-RequiredExecutionEnvironment: J2SE-1.5
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.7.0,4.0.0)",
org.eclipse.jdt.core;bundle-version="[3.7.0,4.0.0)",
org.eclipse.jpt.common.utility;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.jpt.common.core;bundle-version="[1.2.0,2.0.0)",
org.eclipse.jst.common.project.facet.core;bundle-version="[1.4.200,2.0.0)",
org.eclipse.wst.xml.core;bundle-version="[1.1.600,2.0.0)"
-Export-Package: org.eclipse.jpt.common.eclipselink.core,
- org.eclipse.jpt.common.eclipselink.core.internal;
+Export-Package: org.eclipse.jpt.common.eclipselink.core.internal;
x-friends:="org.eclipse.jpt.jpa.eclipselink.core,
org.eclipse.jpt.jaxb.eclipselink.core",
org.eclipse.jpt.common.eclipselink.core.internal.libval;
diff --git a/common/plugins/org.eclipse.jpt.common.eclipselink.core/src/org/eclipse/jpt/common/eclipselink/core/JptCommonEclipseLinkCorePlugin.java b/common/plugins/org.eclipse.jpt.common.eclipselink.core/src/org/eclipse/jpt/common/eclipselink/core/JptCommonEclipseLinkCorePlugin.java
deleted file mode 100644
index 60cb45646a..0000000000
--- a/common/plugins/org.eclipse.jpt.common.eclipselink.core/src/org/eclipse/jpt/common/eclipselink/core/JptCommonEclipseLinkCorePlugin.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 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.eclipselink.core;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.core.runtime.Status;
-import org.osgi.framework.BundleContext;
-
-
-public class JptCommonEclipseLinkCorePlugin
- extends Plugin {
-
- // ********** public constants **********
-
- /**
- * The plug-in identifier of the jpt common core support
- * (value <code>"org.eclipse.jpt.common.core"</code>).
- */
- public static final String PLUGIN_ID = "org.eclipse.jpt.common.eclipselink.core"; //$NON-NLS-1$
- public static final String PLUGIN_ID_ = PLUGIN_ID + '.';
-
-
- // ********** singleton **********
-
- private static JptCommonEclipseLinkCorePlugin INSTANCE;
-
- /**
- * Return the singleton jpt common eclipselink core plug-in.
- */
- public static JptCommonEclipseLinkCorePlugin instance() {
- return INSTANCE;
- }
-
-
- // ********** public static methods **********
-
- /**
- * Log the specified status.
- */
- public static void log(IStatus status) {
- INSTANCE.getLog().log(status);
- }
-
- /**
- * Log the specified message.
- */
- public static void log(String msg) {
- log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, msg, null));
- }
-
- /**
- * Log the specified exception or error.
- */
- public static void log(Throwable throwable) {
- log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, throwable.getLocalizedMessage(), throwable));
- }
-
-
- // ********** plug-in implementation **********
-
- public JptCommonEclipseLinkCorePlugin() {
- super();
- if (INSTANCE != null) {
- throw new IllegalStateException();
- }
- // this convention is *wack*... ~bjv
- INSTANCE = this;
- }
-
-
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- // nothing yet...
- }
-
- @Override
- public void stop(BundleContext context) throws Exception {
- super.stop(context);
- // nothing yet...
- }
-}
diff --git a/common/plugins/org.eclipse.jpt.common.eclipselink.core/src/org/eclipse/jpt/common/eclipselink/core/internal/libval/EclipseLinkLibValUtil.java b/common/plugins/org.eclipse.jpt.common.eclipselink.core/src/org/eclipse/jpt/common/eclipselink/core/internal/libval/EclipseLinkLibValUtil.java
index 1ad52aba44..fd710e3dce 100644
--- a/common/plugins/org.eclipse.jpt.common.eclipselink.core/src/org/eclipse/jpt/common/eclipselink/core/internal/libval/EclipseLinkLibValUtil.java
+++ b/common/plugins/org.eclipse.jpt.common.eclipselink.core/src/org/eclipse/jpt/common/eclipselink/core/internal/libval/EclipseLinkLibValUtil.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2011 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
- *******************************************************************************/
+ * Copyright (c) 2011, 2012 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.eclipselink.core.internal.libval;
import java.util.Set;
@@ -16,8 +16,8 @@ import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.ToolFactory;
import org.eclipse.jdt.core.util.IClassFileReader;
import org.eclipse.jdt.core.util.IFieldInfo;
-import org.eclipse.jpt.common.eclipselink.core.JptCommonEclipseLinkCorePlugin;
import org.eclipse.jpt.common.eclipselink.core.internal.JptCommonEclipseLinkCoreMessages;
+import org.eclipse.jpt.common.eclipselink.core.internal.plugin.JptCommonEclipseLinkCorePlugin;
import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.osgi.service.resolver.VersionRange;
import org.osgi.framework.Version;
@@ -54,31 +54,27 @@ public class EclipseLinkLibValUtil {
}
if (versionString != null) {
if (version != null) {
- return new Status(
- IStatus.ERROR, JptCommonEclipseLinkCorePlugin.PLUGIN_ID,
- JptCommonEclipseLinkCoreMessages.EclipseLinkLibraryValidator_multipleEclipseLinkVersions);
- }
- else {
- version = new Version(versionString);
+ return buildErrorStatus(JptCommonEclipseLinkCoreMessages.EclipseLinkLibraryValidator_multipleEclipseLinkVersions);
}
+ version = new Version(versionString);
}
}
}
if (version == null) {
- return new Status(
- IStatus.ERROR, JptCommonEclipseLinkCorePlugin.PLUGIN_ID,
- JptCommonEclipseLinkCoreMessages.EclipseLinkLibraryValidator_noEclipseLinkVersion);
+ return buildErrorStatus(JptCommonEclipseLinkCoreMessages.EclipseLinkLibraryValidator_noEclipseLinkVersion);
}
for (VersionRange versionRange : versionRanges) {
if (! versionRange.isIncluded(version)) {
- return new Status(
- IStatus.ERROR, JptCommonEclipseLinkCorePlugin.PLUGIN_ID,
- JptCommonEclipseLinkCoreMessages.EclipseLinkLibraryValidator_improperEclipseLinkVersion);
+ return buildErrorStatus(JptCommonEclipseLinkCoreMessages.EclipseLinkLibraryValidator_improperEclipseLinkVersion);
}
}
return Status.OK_STATUS;
}
+
+ private static IStatus buildErrorStatus(String message) {
+ return JptCommonEclipseLinkCorePlugin.instance().buildErrorStatus(message);
+ }
}
diff --git a/common/plugins/org.eclipse.jpt.common.eclipselink.core/src/org/eclipse/jpt/common/eclipselink/core/internal/plugin/JptCommonEclipseLinkCorePlugin.java b/common/plugins/org.eclipse.jpt.common.eclipselink.core/src/org/eclipse/jpt/common/eclipselink/core/internal/plugin/JptCommonEclipseLinkCorePlugin.java
new file mode 100644
index 0000000000..ede4bd5b65
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.eclipselink.core/src/org/eclipse/jpt/common/eclipselink/core/internal/plugin/JptCommonEclipseLinkCorePlugin.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012 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.eclipselink.core.internal.plugin;
+
+import org.eclipse.jpt.common.core.internal.utility.JptPlugin;
+
+public class JptCommonEclipseLinkCorePlugin
+ extends JptPlugin
+{
+ // ********** singleton **********
+
+ private static volatile JptCommonEclipseLinkCorePlugin INSTANCE;
+
+ /**
+ * Return the singleton Dali common EclipseLink core plug-in.
+ */
+ public static JptCommonEclipseLinkCorePlugin instance() {
+ return INSTANCE;
+ }
+
+
+ // ********** Dali plug-in **********
+
+ public JptCommonEclipseLinkCorePlugin() {
+ super();
+ }
+
+
+ @Override
+ protected void setInstance(JptPlugin plugin) {
+ INSTANCE = (JptCommonEclipseLinkCorePlugin) plugin;
+ }
+}
diff --git a/common/plugins/org.eclipse.jpt.common.ui/.options b/common/plugins/org.eclipse.jpt.common.ui/.options
new file mode 100644
index 0000000000..aba6e266fb
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.ui/.options
@@ -0,0 +1,7 @@
+# debugging options for the plug-in org.eclipse.jpt.common.ui
+
+# turn on debugging for the plug-in org.eclipse.jpt.common.ui
+org.eclipse.jpt.common.ui/debug=true
+
+# turn on debugging for all panes
+org.eclipse.jpt.common.ui/debug/Pane=false
diff --git a/common/plugins/org.eclipse.jpt.common.ui/META-INF/MANIFEST.MF b/common/plugins/org.eclipse.jpt.common.ui/META-INF/MANIFEST.MF
index 279bd0b65e..f184f9571c 100644
--- a/common/plugins/org.eclipse.jpt.common.ui/META-INF/MANIFEST.MF
+++ b/common/plugins/org.eclipse.jpt.common.ui/META-INF/MANIFEST.MF
@@ -4,7 +4,7 @@ Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.jpt.common.ui;singleton:=true
Bundle-Version: 1.2.0.qualifier
-Bundle-Activator: org.eclipse.jpt.common.ui.JptCommonUiPlugin
+Bundle-Activator: org.eclipse.jpt.common.ui.internal.plugin.JptCommonUiPlugin
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .
Bundle-Localization: plugin
@@ -23,6 +23,7 @@ Require-Bundle: org.eclipse.core.resources;bundle-version="[3.4.0,4.0.0)",
org.eclipse.ui.navigator;bundle-version="[3.3.100,4.0.0)",
org.eclipse.ui.views.properties.tabbed;bundle-version="[3.4.0,4.0.0)",
org.eclipse.wst.common.project.facet.ui;bundle-version="[1.3.0,2.0.0)"
+Import-Package: com.ibm.icu.text;version="4.0.1"
Dali-Comment: *NO* EclipseLink friends!
Export-Package: org.eclipse.jpt.common.ui,
org.eclipse.jpt.common.ui.gen,
@@ -71,4 +72,3 @@ Export-Package: org.eclipse.jpt.common.ui,
org.eclipse.jpt.jpa.db.ui,
org.eclipse.jpt.jpa.ui",
org.eclipse.jpt.common.ui.jface
-Import-Package: com.ibm.icu.text;version="4.0.1"
diff --git a/common/plugins/org.eclipse.jpt.common.ui/plugin.properties b/common/plugins/org.eclipse.jpt.common.ui/plugin.properties
index 4caf90e773..ddf0f2bbe9 100644
--- a/common/plugins/org.eclipse.jpt.common.ui/plugin.properties
+++ b/common/plugins/org.eclipse.jpt.common.ui/plugin.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2011 Oracle. All rights reserved.
+# Copyright (c) 2011, 2012 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.
@@ -19,5 +19,7 @@
# ====================================================================
# %%% END OF TRANSLATED PROPERTIES %%%
# ====================================================================
-pluginName= Dali Java Persistence Tools - Common UI
-providerName=Eclipse Web Tools Platform
+pluginName = Dali Java Persistence Tools - Common UI
+providerName = Eclipse Web Tools Platform
+
+DALI = Dali
diff --git a/common/plugins/org.eclipse.jpt.common.ui/plugin.xml b/common/plugins/org.eclipse.jpt.common.ui/plugin.xml
new file mode 100644
index 0000000000..0fc6153177
--- /dev/null
+++ b/common/plugins/org.eclipse.jpt.common.ui/plugin.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<!--
+ Copyright (c) 2011, 2012 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
+ -->
+
+<plugin>
+
+ <!-- ***** tracing ***** -->
+
+ <extension
+ point="org.eclipse.ui.trace.traceComponents">
+
+ <component
+ id="org.eclipse.jpt.common.core.trace.component"
+ label="%DALI">
+
+ <bundle name="org.eclipse.jpt.*"/>
+
+ </component>
+
+ </extension>
+
+</plugin>
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/gen/AbstractJptGenerateJob.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/gen/AbstractJptGenerateJob.java
index 7fd04061e7..7fcbf80273 100644
--- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/gen/AbstractJptGenerateJob.java
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/gen/AbstractJptGenerateJob.java
@@ -1,12 +1,12 @@
/*******************************************************************************
-* Copyright (c) 2012 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
-*******************************************************************************/
+ * Copyright (c) 2012 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.ui.gen;
import org.eclipse.core.resources.IFile;
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/JptUIPlugin.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/JptUIPlugin.java
index 6cbe2d57c1..d5fff9d145 100644
--- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/JptUIPlugin.java
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/JptUIPlugin.java
@@ -9,273 +9,349 @@
******************************************************************************/
package org.eclipse.jpt.common.ui.internal;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.draw2d.ImageUtilities;
+import org.eclipse.jface.dialogs.DialogSettings;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.jpt.common.core.internal.utility.JptPlugin;
+import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.osgi.service.debug.DebugOptions;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-import org.osgi.util.tracker.ServiceTracker;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.preferences.ScopedPreferenceStore;
+import org.osgi.framework.Bundle;
/**
- * Common Dali UI plug-in behavior.
- * See JptPlugin
+ * Common Dali UI plug-in behavior:<ul>
+ * <li>dialog settings
+ * <li>image registry
+ * <li>UI preference store
+ * </ul>
*/
-public class JptUIPlugin
- extends AbstractUIPlugin
+public abstract class JptUIPlugin
+ extends JptPlugin
{
- protected BundleContext bundleContext;
- protected ServiceTracker<DebugOptions, DebugOptions> debugOptionsServiceTracker;
+ // NB: the plug-in must be synchronized whenever accessing any of this state
+ private IDialogSettings dialogSettings;
+ private ImageRegistry imageRegistry;
+ private IPreferenceStore preferenceStore;
+ /**
+ * Default constructor is required. Of course, subclass constructors must
+ * be <code>public</code>.
+ */
protected JptUIPlugin() {
super();
}
- // ********** logging **********
+ // ********** plug-in lifecycle **********
- /**
- * Log the specified message with a severity of
- * {@link IStatus#ERROR ERROR}.
- * @see #log(int, String)
- * @see IStatus
- */
- public void logError(String message) {
- this.log(IStatus.ERROR, message);
- }
+ @Override
+ protected void start_() throws Exception {
+ super.start_();
+ }
- /**
- * Log the specified message with the specified severity.
- * @see IStatus#getSeverity()
- */
- public void log(int severity, String message) {
- this.log(severity, message, null);
- }
+ @Override
+ protected void stop_() throws Exception {
+ try {
+ if (this.imageRegistry != null) {
+ this.imageRegistry.dispose();
+ }
+ if (this.dialogSettings != null) {
+ this.saveDialogSettings();
+ }
+ } finally {
+ this.imageRegistry = null;
+ this.dialogSettings = null;
+ super.stop_();
+ }
+ }
+
+
+ // ********** dialog settings **********
/**
- * Log the specified exception or error with a severity of
- * {@link IStatus#ERROR ERROR}.
- * @see #log(int, Throwable)
- * @see IStatus
+ * Return the dialog settings for the UI plug-in.
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#getDialogSettings()
*/
- public void logError(Throwable throwable) {
- this.log(IStatus.ERROR, throwable);
+ public synchronized IDialogSettings getDialogSettings() {
+ if ((this.dialogSettings == null) && this.isActive()) {
+ this.dialogSettings = this.buildDialogSettings();
+ }
+ return dialogSettings;
}
/**
- * Log the specified exception or error with the specified severity.
- * @see IStatus#getSeverity()
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#loadDialogSettings()
*/
- public void log(int severity, Throwable throwable) {
- this.log(severity, throwable.getLocalizedMessage(), throwable);
+ protected IDialogSettings buildDialogSettings() {
+ IDialogSettings result = this.buildDialogSettings_();
+ String settingsFileName = this.getDialogSettingsFileName();
+ if (settingsFileName == null) {
+ return result;
+ }
+ File settingsFile = new File(settingsFileName);
+ if (settingsFile.exists()) {
+ try {
+ result.load(settingsFileName);
+ } catch (IOException ex) {
+ // if there are problems, return an empty settings container
+ return this.buildDialogSettings_();
+ }
+ }
+ return result;
}
- /**
- * Log the specified message and exception or error with a severity of
- * {@link IStatus#ERROR ERROR}.
- * @see #log(int, String, Throwable)
- * @see IStatus
- */
- public void logError(String msg, Throwable throwable) {
- this.log(IStatus.ERROR, msg, throwable);
+ protected IDialogSettings buildDialogSettings_() {
+ return new DialogSettings(this.getDialogSettingsSectionName());
+ }
+
+ protected String getDialogSettingsSectionName() {
+ return DIALOG_SETTINGS_SECTION_NAME;
}
/**
- * Log the specified message and exception or error
- * with the specified severity.
- * @see IStatus#getSeverity()
- * @see IStatus#getCode()
+ * Value: <code>{@value}</code>
*/
- public void log(int severity, String msg, Throwable throwable) {
- this.log(severity, IStatus.OK, msg, throwable);
- }
+ protected static final String DIALOG_SETTINGS_SECTION_NAME = "Workbench"; //$NON-NLS-1$
/**
- * Log the specified message and exception or error
- * with the specified severity and code.
- * @see IStatus#getSeverity()
- * @see IStatus#getCode()
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#saveDialogSettings()
*/
- public void log(int severity, int code, String msg, Throwable throwable) {
- this.getLog().log(new Status(severity, this.getPluginID(), code, msg, throwable));
+ protected void saveDialogSettings() {
+ String settingsFileName = this.getDialogSettingsFileName();
+ if (settingsFileName != null) {
+ try {
+ this.dialogSettings.save(settingsFileName);
+ } catch (IOException ex) {
+ // ignore silently
+ }
+ }
}
+ protected String getDialogSettingsFileName() {
+ IPath stateLocation = this.getStateLocation();
+ if (stateLocation == null) {
+ return null;
+ }
+ return stateLocation.append(this.getRelativeDialogSettingsFileName()).toOSString();
+ }
- // ********** debug options **********
-
- /**
- * Return the specified debug option as a <code>boolean</code> value.
- * Return <code>false</code> if no such option is found.
- * <p>
- * The debug option is within the scope of the plug-in's debug options
- * (e.g. for the plug-in <code>"org.eclipse.jpt.common.core"</code>,
- * the specified option <code>"foo"</code> will be mapped to
- * the {@link Platform} option
- * <code>"org.eclipse.jpt.common.core/debug/foo"</code>).
- */
- public boolean getBooleanDebugOption(String option) {
- return this.getBooleanDebugOption(option, false);
+ protected String getRelativeDialogSettingsFileName() {
+ return RELATIVE_DIALOG_SETTINGS_FILE_NAME;
}
/**
- * Return the specified debug option as a <code>boolean</code> value.
- * Return the specified default value if no such option is found.
- * <p>
- * The debug option is within the scope of the plug-in's debug options
- * (e.g. for the plug-in <code>"org.eclipse.jpt.common.core"</code>,
- * the specified option <code>"foo"</code> will be mapped to
- * the {@link Platform} option
- * <code>"org.eclipse.jpt.common.core/debug/foo"</code>).
+ * Value: <code>{@value}</code>
*/
- public boolean getBooleanDebugOption(String option, boolean defaultValue) {
- String value = this.getDebugOption(option);
- return (value == null) ? defaultValue : Boolean.parseBoolean(value.trim());
- }
+ protected static final String RELATIVE_DIALOG_SETTINGS_FILE_NAME = "dialog_settings.xml"; //$NON-NLS-1$
+
+
+ // ********** images **********
/**
- * Return the specified debug option as an <code>int</code> value.
- * Return <code>-1</code> if no such option is found.
- * <p>
- * The debug option is within the scope of the plug-in's debug options
- * (e.g. for the plug-in <code>"org.eclipse.jpt.common.core"</code>,
- * the specified option <code>"foo"</code> will be mapped to
- * the {@link Platform} option
- * <code>"org.eclipse.jpt.common.core/debug/foo"</code>).
+ * Return a "normal" (as opposed to "ghost") image for the specified key.
+ * The key will be transformed into the name of a
+ * <code>.gif</code> file in the plug-in's <code>icons</code> folder.
+ * This image is built, held, and disposed by the plug-in.
+ *
+ * @see #getGhostImage(String)
+ * @see #getImage(String, boolean)
+ * @see org.eclipse.ui.IWorkbench#getSharedImages()
*/
- public int getIntegerDebugOption(String option) {
- return this.getIntegerDebugOption(option, -1);
+ public Image getImage(String key) {
+ return this.getImage(key, false); // false = normal (non-ghost)
}
/**
- * Return the specified debug option as an <code>int</code> value.
- * Return the specified default value if no such option is found.
- * <p>
- * The debug option is within the scope of the plug-in's debug options
- * (e.g. for the plug-in <code>"org.eclipse.jpt.common.core"</code>,
- * the specified option <code>"foo"</code> will be mapped to
- * the {@link Platform} option
- * <code>"org.eclipse.jpt.common.core/debug/foo"</code>).
+ * Return a "ghost" image for the specified key.
+ * The key will be transformed into the name of a
+ * <code>.gif</code> file in the plug-in's <code>icons</code> folder.
+ * This image is built, held, and disposed by the plug-in.
+ *
+ * @see #getImage(String)
+ * @see #getImage(String, boolean)
+ * @see org.eclipse.ui.IWorkbench#getSharedImages()
*/
- public int getIntegerDebugOption(String option, int defaultValue) {
- String value = this.getDebugOption(option);
- return (value == null) ? defaultValue : Integer.parseInt(value.trim());
+ public Image getGhostImage(String key) {
+ return this.getImage(key, true); // true = ghost
}
/**
- * Return the specified debug option.
- * Return <code>null</code> if no such option is found.
- * <p>
- * The debug option is within the scope of the plug-in's debug options
- * (e.g. for the plug-in <code>"org.eclipse.jpt.common.core"</code>,
- * the specified option <code>"foo"</code> will be mapped to
- * the {@link Platform} option
- * <code>"org.eclipse.jpt.common.core/debug/foo"</code>).
+ * Return an image for the specified key. "Ghost" the image if the specified
+ * flag is <code>true</code>.
+ * The key will be transformed into the name of a
+ * <code>.gif</code> file in the plug-in's <code>icons</code> folder.
+ * This image is built, held, and disposed by the plug-in.
+ *
+ * @see #getGhostImage(String)
+ * @see #getImage(String)
+ * @see org.eclipse.ui.IWorkbench#getSharedImages()
*/
- public String getDebugOption(String option) {
- return this.getDebugOption(option, null);
+ public Image getImage(String key, boolean ghost) {
+ this.checkImageKey(key);
+ ImageRegistry registry = this.getImageRegistry();
+ if (registry == null) {
+ return null;
+ }
+ // lock the registry while retrieving (and possibly building) the image
+ synchronized (registry) {
+ return ghost ? this.getGhostImage(registry, key) : this.getImage(registry, key);
+ }
}
/**
- * Return the specified debug option.
- * Return the specified default value if no such option is found.
- * <p>
- * The debug option is within the scope of the plug-in's debug options
- * (e.g. for the plug-in <code>"org.eclipse.jpt.common.core"</code>,
- * the specified option <code>"foo"</code> will be mapped to
- * the {@link Platform} option
- * <code>"org.eclipse.jpt.common.core/debug/foo"</code>).
+ * Pre-condition: The specified registry is <code>synchronized</code>.
*/
- public String getDebugOption(String option, String defaultValue) {
- return this.isDebugging() ? this.getDebugOption_(option, defaultValue) : defaultValue;
+ protected Image getGhostImage(ImageRegistry registry, String key) {
+ String ghostKey = this.buildGhostImageKey(key);
+ Image ghostImage = registry.get(ghostKey);
+ if (ghostImage == null) {
+ ghostImage = this.buildGhostImage(registry, key);
+ registry.put(ghostKey, ghostImage);
+ }
+ return ghostImage;
}
- protected String getDebugOption_(String option, String defaultValue) {
- if (StringTools.stringIsEmpty(option)) {
- throw new IllegalArgumentException("debug option cannot be blank"); //$NON-NLS-1$
- }
- String value = this.getDebugOption_(option);
- return (value != null) ? value : defaultValue;
+ protected String buildGhostImageKey(String key) {
+ return key + '-' + this.getGhostImageKeySuffix();
}
- protected String getDebugOption_(String option) {
- DebugOptions debugOptions = this.getDebugOptions();
- return (debugOptions == null) ? null : debugOptions.getOption(this.getPluginDebugOption() + option);
+ protected String getGhostImageKeySuffix() {
+ return GHOST_IMAGE_KEY_SUFFIX;
}
- protected DebugOptions getDebugOptions() {
- ServiceTracker<DebugOptions, DebugOptions> tracker = this.getDebugOptionsServiceTracker();
- return (tracker == null) ? null : tracker.getService();
+ /**
+ * Value: <code>{@value}</code>
+ */
+ protected static final String GHOST_IMAGE_KEY_SUFFIX = "gray"; //$NON-NLS-1$
+
+ protected Image buildGhostImage(ImageRegistry registry, String key) {
+ Image image = this.getImage(registry, key);
+ Color lightGray = new Color(image.getDevice(), 223, 223, 223);
+ Image shadedImage = new Image(image.getDevice(), ImageUtilities.createShadedImage(image, lightGray));
+ Image ghostImage = new Image(image.getDevice(), shadedImage, SWT.IMAGE_GRAY);
+ shadedImage.dispose();
+ lightGray.dispose();
+ return ghostImage;
}
- private synchronized ServiceTracker<DebugOptions, DebugOptions> getDebugOptionsServiceTracker() {
- if (this.isActive() && (this.debugOptionsServiceTracker == null)) {
- this.debugOptionsServiceTracker = this.buildDebugOptionsServiceTracker();
- this.debugOptionsServiceTracker.open();
+ /**
+ * Pre-condition: The specified registry is <code>synchronized</code>.
+ */
+ protected Image getImage(ImageRegistry registry, String key) {
+ Image image = registry.get(key);
+ if (image == null) {
+ // a bad image descriptor will result in a "default" image
+ registry.put(key, this.buildImageDescriptor_(key));
+ image = registry.get(key);
}
- return this.debugOptionsServiceTracker;
+ return image;
}
- private ServiceTracker<DebugOptions, DebugOptions> buildDebugOptionsServiceTracker() {
- return new ServiceTracker<DebugOptions, DebugOptions>(this.bundleContext, DebugOptions.class, null);
+ /**
+ * Return an image descriptor for the specified key.
+ * The key will be transformed into the name of a
+ * <code>.gif</code> file in the plug-in's <code>icons</code> folder.
+ */
+ public ImageDescriptor buildImageDescriptor(String key) {
+ this.checkImageKey(key);
+ return this.buildImageDescriptor_(key);
}
/**
- * Return the plug-in's debug option path.
+ * Pre-condition: the specified key is not blank.
*/
- protected String getPluginDebugOption() {
- return this.getPluginID() + DEBUG_OPTION_SCOPE;
+ protected ImageDescriptor buildImageDescriptor_(String key) {
+ Bundle bundle = this.getBundle();
+ if (bundle == null) {
+ return null;
+ }
+
+ IPath path = this.buildImageFilePath(key);
+ URL url = FileLocator.find(bundle, path, null);
+ return (url == null) ? null : ImageDescriptor.createFromURL(url);
}
- protected static final String DEBUG_OPTION_SCOPE = "/debug/"; //$NON-NLS-1$
+ protected IPath buildImageFilePath(String key) {
+ return new Path(this.buildRelativeImageFileName(key));
+ }
- // ********** plug-in lifecycle **********
+ protected String buildRelativeImageFileName(String key) {
+ return this.getRelativeImageDirectoryName() + '/' + key + '.' + this.getImageFileExt();
+ }
- @Override
- public synchronized void start(BundleContext context) throws Exception {
- super.start(context);
- this.bundleContext = context;
+ protected String getRelativeImageDirectoryName() {
+ return RELATIVE_IMAGE_DIRECTORY_NAME;
}
+ /**
+ * Value: <code>{@value}</code>
+ */
+ protected static final String RELATIVE_IMAGE_DIRECTORY_NAME = "icons"; //$NON-NLS-1$
- @Override
- public synchronized void stop(BundleContext context) throws Exception {
- try {
- this.stop_();
- } finally {
- this.bundleContext = null;
- super.stop(context);
+ protected String getImageFileExt() {
+ return IMAGE_FILE_EXT;
+ }
+ /**
+ * Value: <code>{@value}</code>
+ */
+ protected static final String IMAGE_FILE_EXT = "gif"; //$NON-NLS-1$
+
+ protected void checkImageKey(String key) {
+ if (StringTools.stringIsEmpty(key)) {
+ throw new IllegalArgumentException("image key cannot be blank"); //$NON-NLS-1$
}
}
- protected void stop_() throws Exception {
- if (this.debugOptionsServiceTracker != null) {
- this.debugOptionsServiceTracker.close();
- this.debugOptionsServiceTracker = null;
+ /**
+ * Return the image registry for the UI plug-in.
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#getImageRegistry()
+ */
+ protected synchronized ImageRegistry getImageRegistry() {
+ if ((this.imageRegistry == null) && this.isActive()) {
+ this.imageRegistry = this.buildImageRegistry();
}
+ return imageRegistry;
}
+ // TODO the image registry holds icons for the life of the plug-in
+ // (i.e. until the workspace is closed). This is better than before when
+ // we constantly created new images(!), but:
+ // Bug 306437 is about cleaning this up and using Local Resource Managers
+ // on our views so that closing the JPA perspective would mean the icons are disposed.
+ // But then do we have multiple versions of the same icon?
+ protected ImageRegistry buildImageRegistry() {
+ return new ImageRegistry(SWTUtil.getDisplay());
+ }
- // ********** misc **********
- public String getPluginID() {
- return this.getBundle().getSymbolicName();
- }
+ // ********** preference store **********
/**
- * Return whether the plug-in is active; i.e. it has been
- * {@link #start(BundleContext) started}.
+ * Return the preference store for the UI plug-in.
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#getPreferenceStore()
*/
- public synchronized boolean isActive() {
- return this.bundleContext != null;
+ public synchronized IPreferenceStore getPreferenceStore() {
+ if ((this.preferenceStore == null) && this.isActive()) {
+ this.preferenceStore = this.buildPreferenceStore();
+ }
+ return preferenceStore;
}
- /**
- * Return whether the plug-in is inactive; i.e. it has been
- * {@link #stop(BundleContext) stopped} or not yet
- * {@link #start(BundleContext) started}.
- */
- public boolean isInactive() {
- return ! this.isActive();
+ protected IPreferenceStore buildPreferenceStore() {
+ String id = this.getPluginID();
+ return (id == null) ? null : new ScopedPreferenceStore(InstanceScope.INSTANCE, id);
}
}
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/Tracing.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/Tracing.java
deleted file mode 100644
index 7826015d18..0000000000
--- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/Tracing.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2011 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.ui.internal;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jpt.common.ui.JptCommonUiPlugin;
-
-/**
- * This tracing class manages to convert the string value into boolean values or
- * integer values that are associated with the tracing debug flags. Those flags
- * are specified in the .options file. The supported keys are defined here as
- * constants for quick reference.
- *
- * @version 2.0
- * @since 2.0
- */
-@SuppressWarnings("nls")
-public final class Tracing
-{
- /**
- * A constant used to retrieve the value associated with "/debug".
- */
- public static final String DEBUG = "/debug";
-
- /**
- * A constant used to retrieve the value associated with "/debug/ui/db".
- */
- public static final String UI_DB = "/debug/ui/db";
-
- /**
- * A constant used to retrieve the value associated with "/debug/ui/detailsView".
- */
- public static final String UI_DETAILS_VIEW = "/debug/ui/detailsView";
-
- /**
- * A constant used to retrieve the value associated with "/debug/ui/layout".
- */
- public static final String UI_LAYOUT = "/debug/ui/layout";
-
- /**
- * A constant used to retrieve the value associated with "/unit-tests".
- */
- public static final String UNIT_TESTS = "/unit-tests";
-
- /**
- * Can't instantiate this <code>Tracing</code> class.
- */
- private Tracing()
- {
- super();
- throw new UnsupportedOperationException("Tracing cannot be instantiated");
- }
-
- /**
- * Retrieves the debug value associated with the given flag. The default
- * value is <code>false</code>.
- *
- * @param flag The flag to retrieve the debug value, which should be
- * contained in the .options file, the flag should start with "/"
- * @return <code>true</code> if the given flag is active; <code>false</code>
- * otherwise
- */
- public static boolean booleanDebugOption(String flag)
- {
- return booleanDebugOption(flag, false);
- }
-
- /**
- * Retrieves the debug value associated with the given flag.
- *
- * @param flag The flag to retrieve the debug value, which should be
- * contained in the .options file, the flag should start with "/"
- * @param defaultValue The default value if the value associated with the
- * given flag could not be found
- * @return <code>true</code> if the given flag is active; <code>false</code>
- * otherwise
- */
- public static boolean booleanDebugOption(String flag, boolean defaultValue)
- {
- String string = Platform.getDebugOption(JptCommonUiPlugin.PLUGIN_ID + flag);
- return (string == null) ? defaultValue : Boolean.parseBoolean(string.trim());
- }
-
- /**
- * Retrieves the debug value associated with the given flag. The default value
- * is 0.
- *
- * @param flag The flag to retrieve the debug value, which should be
- * contained in the .options file, the flag should start with "/"
- * @return The value associated with the given flag, or the given default
- * value
- */
- public static int intDebugOption(String flag)
- {
- return intDebugOption(flag, 0);
- }
-
- /**
- * Retrieves the debug value associated with the given flag.
- *
- * @param flag The flag to retrieve the debug value, which should be
- * contained in the .options file, the flag should start with "/"
- * @param defaultValue The default value if the value associated with the
- * given flag could not be found
- * @return The value associated with the given flag, or the given default
- * value
- */
- public static int intDebugOption(String flag, int defaultValue)
- {
- String string = Platform.getDebugOption(JptCommonUiPlugin.PLUGIN_ID + flag);
- return (string == null) ? defaultValue : Integer.parseInt(string);
- }
-
- /**
- * Logs the given messages, appends it with this plug-in id.
- *
- * @param message The message to be logged
- */
- public static void log(String message)
- {
- System.out.print("[" + JptCommonUiPlugin.PLUGIN_ID + "] ");
- System.out.println(message);
- }
-
- /**
- * Retrieves the debug value associated with the given flag. The default value
- * is an empty string.
- *
- * @param flag The flag to retrieve the debug value, which should be
- * contained in the .options file, the flag should start with "/"
- * @return The value associated with the given flag, or the given default
- * value
- */
- public static String stringDebugOption(String flag)
- {
- return stringDebugOption(flag, "");
- }
-
- /**
- * Retrieves the debug value associated with the given flag.
- *
- * @param flag The flag to retrieve the debug value, which should be
- * contained in the .options file, the flag should start with "/"
- * @param defaultValue The default value if the value associated with the
- * given flag could not be found
- * @return The value associated with the given flag, or the given default
- * value
- */
- public static String stringDebugOption(String flag, String defaultValue)
- {
- String string = Platform.getDebugOption(JptCommonUiPlugin.PLUGIN_ID + flag);
- return (string != null) ? string : defaultValue;
- }
-}
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/AbstractItemStructuredStateProviderManager.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/AbstractItemStructuredStateProviderManager.java
index 0bf4676761..a5c1924dda 100644
--- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/AbstractItemStructuredStateProviderManager.java
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/AbstractItemStructuredStateProviderManager.java
@@ -22,6 +22,7 @@ import org.eclipse.jpt.common.ui.jface.ItemStructuredContentProvider;
import org.eclipse.jpt.common.ui.jface.StructuredStateProvider;
import org.eclipse.jpt.common.utility.internal.RunnableAdapter;
import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.Tools;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Control;
@@ -77,7 +78,7 @@ public abstract class AbstractItemStructuredStateProviderManager<V extends Struc
public Object[] getElements(Object inputElement) {
CP provider = this.getItemContentProvider(inputElement);
- return (provider == null) ? EMPTY_ARRAY : provider.getElements();
+ return (provider == null) ? Tools.EMPTY_OBJECT_ARRAY : provider.getElements();
}
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/ArchiveFileViewerFilter.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/ArchiveFileViewerFilter.java
index bbff5516fc..06099a76cb 100644
--- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/ArchiveFileViewerFilter.java
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/ArchiveFileViewerFilter.java
@@ -1,13 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2009 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
- *******************************************************************************/
+ * Copyright (c) 2009, 2012 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.ui.internal.jface;
import org.eclipse.core.resources.IFile;
@@ -17,7 +16,7 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.jpt.common.ui.JptCommonUiPlugin;
+import org.eclipse.jpt.common.ui.internal.plugin.JptCommonUiPlugin;
/**
* This filter will deny showing any file that are not JAR files or folders
@@ -51,7 +50,7 @@ public class ArchiveFileViewerFilter
}
catch (CoreException ce) {
// just skip this one, then
- JptCommonUiPlugin.log(ce);
+ JptCommonUiPlugin.instance().logError(ce);
}
}
return false;
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/ItemTreeStateProviderManager.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/ItemTreeStateProviderManager.java
index b5d40efa54..813f101c0a 100644
--- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/ItemTreeStateProviderManager.java
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/ItemTreeStateProviderManager.java
@@ -16,6 +16,7 @@ import org.eclipse.jpt.common.ui.jface.ItemTreeContentProvider;
import org.eclipse.jpt.common.ui.jface.ItemTreeContentProviderFactory;
import org.eclipse.jpt.common.ui.jface.TreeStateProvider;
import org.eclipse.jpt.common.utility.internal.RunnableAdapter;
+import org.eclipse.jpt.common.utility.internal.Tools;
/**
* @see AbstractItemStructuredStateProviderManager
@@ -53,7 +54,7 @@ public class ItemTreeStateProviderManager
public Object[] getChildren(Object parentElement) {
ItemTreeContentProvider provider = this.getItemContentProvider(parentElement);
- return (provider == null) ? EMPTY_ARRAY : provider.getChildren();
+ return (provider == null) ? Tools.EMPTY_OBJECT_ARRAY : provider.getChildren();
}
public Object getParent(Object element) {
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/SimpleMessageTreeContent.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/SimpleMessageTreeContent.java
index ca019ef46e..48233d6265 100644
--- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/SimpleMessageTreeContent.java
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/SimpleMessageTreeContent.java
@@ -12,6 +12,7 @@ package org.eclipse.jpt.common.ui.internal.jface;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.Tools;
/**
* Tree content with a root with a single child, the message that will be
@@ -69,7 +70,7 @@ public class SimpleMessageTreeContent {
String msg = ((SimpleMessageTreeContent) element).getMessage();
return new Object[] { msg };
}
- return EMPTY_ARRAY;
+ return Tools.EMPTY_OBJECT_ARRAY;
}
}
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/StaticItemTreeContentProvider.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/StaticItemTreeContentProvider.java
index 4eddce1fa0..384cf0cd90 100644
--- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/StaticItemTreeContentProvider.java
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/StaticItemTreeContentProvider.java
@@ -11,6 +11,7 @@ package org.eclipse.jpt.common.ui.internal.jface;
import org.eclipse.jpt.common.ui.jface.ItemTreeContentProvider;
import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.Tools;
/**
* Item tree content provider that contains unchanging parent and children.
@@ -36,7 +37,7 @@ public class StaticItemTreeContentProvider
* parent but no children.
*/
public StaticItemTreeContentProvider(Object parent) {
- this(parent, EMPTY_ARRAY);
+ this(parent, Tools.EMPTY_OBJECT_ARRAY);
}
/**
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/StructuredContentProvider.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/StructuredContentProvider.java
index 891c15309b..5fb9c37fdb 100644
--- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/StructuredContentProvider.java
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/StructuredContentProvider.java
@@ -10,6 +10,7 @@
package org.eclipse.jpt.common.ui.internal.jface;
import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jpt.common.utility.internal.Tools;
/**
* Convenience implementation of {@link IStructuredContentProvider}.
@@ -25,8 +26,6 @@ public class StructuredContentProvider
}
public Object[] getElements(Object inputElement) {
- return EMPTY_ARRAY;
+ return Tools.EMPTY_OBJECT_ARRAY;
}
-
- protected static final Object[] EMPTY_ARRAY = new Object[0];
}
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/TreeContentProvider.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/TreeContentProvider.java
index 86fcbcd311..66ee7eca89 100644
--- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/TreeContentProvider.java
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/TreeContentProvider.java
@@ -10,6 +10,7 @@
package org.eclipse.jpt.common.ui.internal.jface;
import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jpt.common.utility.internal.Tools;
/**
* Convenience implementation of {@link ITreeContentProvider}.
@@ -39,6 +40,6 @@ public class TreeContentProvider
}
public Object[] getChildren(Object element) {
- return EMPTY_ARRAY;
+ return Tools.EMPTY_OBJECT_ARRAY;
}
}
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/JptCommonUiPlugin.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/plugin/JptCommonUiPlugin.java
index b72827853f..aacdd6cb58 100644
--- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/JptCommonUiPlugin.java
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/plugin/JptCommonUiPlugin.java
@@ -7,10 +7,10 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.common.ui;
+package org.eclipse.jpt.common.ui.internal.plugin;
+import org.eclipse.jpt.common.core.internal.utility.JptPlugin;
import org.eclipse.jpt.common.ui.internal.JptUIPlugin;
-import org.osgi.framework.BundleContext;
/**
* Dali UI plug-in.
@@ -24,14 +24,6 @@ import org.osgi.framework.BundleContext;
public class JptCommonUiPlugin
extends JptUIPlugin
{
- // ********** constants **********
-
- /**
- * The plug-in identifier of JPT Common UI support (value {@value}).
- */
- public static final String PLUGIN_ID = "org.eclipse.jpt.common.ui"; //$NON-NLS-1$
- public static final String PLUGIN_ID_ = PLUGIN_ID + '.';
-
// ********** singleton **********
private static JptCommonUiPlugin INSTANCE;
@@ -44,40 +36,14 @@ public class JptCommonUiPlugin
}
- // ********** logging **********
-
- public static void log(String msg) {
- INSTANCE.logError(msg);
- }
-
- public static void log(Throwable throwable) {
- INSTANCE.logError(throwable);
- }
-
-
- // ********** construction **********
+ // ********** Dali plug-in **********
public JptCommonUiPlugin() {
super();
- if (INSTANCE != null) {
- throw new IllegalStateException();
- }
- // this convention is *wack*... ~bjv
- INSTANCE = this;
- }
-
- @Override
- public synchronized void start(BundleContext context) throws Exception {
- super.start(context);
- // nothing yet...
}
@Override
- public synchronized void stop(BundleContext context) throws Exception {
- try {
- // nothing yet...
- } finally {
- super.stop(context);
- }
+ protected void setInstance(JptPlugin plugin) {
+ INSTANCE = (JptCommonUiPlugin) plugin;
}
}
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/properties/JptProjectPropertiesPage.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/properties/JptProjectPropertiesPage.java
index f739b28dc4..156c7a62fb 100644
--- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/properties/JptProjectPropertiesPage.java
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/properties/JptProjectPropertiesPage.java
@@ -26,16 +26,17 @@ import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.operation.IRunnableContext;
import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
+import org.eclipse.jpt.common.ui.internal.plugin.JptCommonUiPlugin;
+import org.eclipse.jpt.common.ui.internal.properties.JptProjectPropertiesPage.OkRunnableWithProgress.OkWorkspaceRunnable;
import org.eclipse.jpt.common.utility.internal.ArrayTools;
import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.model.value.BufferedWritablePropertyValueModel;
+import org.eclipse.jpt.common.utility.internal.model.value.BufferedModifiablePropertyValueModel;
import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel;
import org.eclipse.jpt.common.utility.model.Model;
-import org.eclipse.jpt.common.utility.model.listener.ChangeListener;
import org.eclipse.jpt.common.utility.model.listener.AbstractChangeListener;
-import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
+import org.eclipse.jpt.common.utility.model.listener.ChangeListener;
import org.eclipse.jpt.common.utility.model.value.ModifiablePropertyValueModel;
+import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
import org.eclipse.jst.common.project.facet.core.libprov.IPropertyChangeListener;
import org.eclipse.jst.common.project.facet.core.libprov.LibraryInstallDelegate;
import org.eclipse.jst.common.project.facet.ui.libprov.LibraryFacetPropertyPage;
@@ -59,7 +60,7 @@ public abstract class JptProjectPropertiesPage
extends LibraryFacetPropertyPage {
protected final ModifiablePropertyValueModel<IProject> projectModel;
- protected final BufferedWritablePropertyValueModel.Trigger trigger;
+ protected final BufferedModifiablePropertyValueModel.Trigger trigger;
protected final ChangeListener validationListener;
@@ -68,7 +69,7 @@ public abstract class JptProjectPropertiesPage
super();
this.projectModel = new SimplePropertyValueModel<IProject>();
- this.trigger = new BufferedWritablePropertyValueModel.Trigger();
+ this.trigger = new BufferedModifiablePropertyValueModel.Trigger();
this.buildModels();
@@ -328,7 +329,7 @@ public abstract class JptProjectPropertiesPage
* Return whether any of the models are buffering a change.
*/
private boolean isBuffering() {
- for (BufferedWritablePropertyValueModel<?> model : this.buildBufferedModels()) {
+ for (BufferedModifiablePropertyValueModel<?> model : this.buildBufferedModels()) {
if (model.isBuffering()) {
return true;
}
@@ -336,7 +337,7 @@ public abstract class JptProjectPropertiesPage
return false;
}
- protected abstract BufferedWritablePropertyValueModel<?>[] buildBufferedModels();
+ protected abstract BufferedModifiablePropertyValueModel<?>[] buildBufferedModels();
@Override
protected void performDefaults() {
@@ -411,7 +412,7 @@ public abstract class JptProjectPropertiesPage
}
protected IStatus buildStatus(int severity, String message) {
- return new Status(severity, JptCommonCorePlugin.PLUGIN_ID, message);
+ return JptCommonUiPlugin.instance().buildStatus(severity, message);
}
@Override
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/SWTUtil.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/SWTUtil.java
index eaa395c23d..0aa60f9ab0 100644
--- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/SWTUtil.java
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/SWTUtil.java
@@ -25,6 +25,7 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.Widget;
+import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.forms.widgets.ScrolledForm;
@@ -79,12 +80,13 @@ public class SWTUtil {
* Execute the specified runnable if the current thread is the UI thread;
* otherwise asynchrounously dispatch the runnable to the UI thread,
* returning immediately. This is useful for event handlers when it is not
- * obviously whether the events are fired on the UI thread.
+ * obvious whether the events are fired on the UI thread.
*
* @see Display#asyncExec(Runnable)
* @see #asyncExec(Runnable)
* @see #syncExec(Runnable)
* @see #timerExec(int, Runnable)
+ * @see IWorkbench#getDisplay()
*/
public static void execute(Runnable runnable) {
Display display = Display.getCurrent();
@@ -92,7 +94,7 @@ public class SWTUtil {
// the current thread is the UI thread
runnable.run();
} else {
- Display.getDefault().asyncExec(runnable);
+ getWorkbenchDisplay().asyncExec(runnable);
}
}
@@ -166,7 +168,7 @@ public class SWTUtil {
}
// No shell could be found, revert back to the active workbench window
- shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+ shell = getWorkbench().getActiveWorkbenchWindow().getShell();
return (shell != null) ? shell : new Shell();
}
@@ -174,11 +176,25 @@ public class SWTUtil {
* Return the most appropriate {@link Display display}; i.e. return the
* {@link Display#getCurrent() display associated with the current thread}
* if it is present; otherwise return the
- * {@link Display#getDefault() default display}.
+ * {@link IWorkbench#getDisplay() Eclipse workbench
+ * display} (but, explicitly, not the "default display"
+ * {@link Display#getDefault()} -
+ * see the comment at {@link IWorkbench#getDisplay()}).
*/
public static Display getDisplay() {
Display display = Display.getCurrent();
- return (display != null) ? display : Display.getDefault();
+ return (display != null) ? display : getWorkbenchDisplay();
+ }
+
+ public static Display getWorkbenchDisplay() {
+ return getWorkbench().getDisplay();
+ }
+
+ public static IWorkbench getWorkbench() {
+ if ( ! PlatformUI.isWorkbenchRunning()) {
+ throw new IllegalStateException("workbench is not running"); //$NON-NLS-1$
+ }
+ return PlatformUI.getWorkbench();
}
/**
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/ClassChooserPane.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/ClassChooserPane.java
index 5e5351e94a..eaba7211f6 100644
--- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/ClassChooserPane.java
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/ClassChooserPane.java
@@ -30,9 +30,9 @@ import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.window.Window;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.jpt.common.core.internal.utility.JDTTools;
-import org.eclipse.jpt.common.ui.JptCommonUiPlugin;
import org.eclipse.jpt.common.ui.internal.JptCommonUiMessages;
import org.eclipse.jpt.common.ui.internal.listeners.SWTPropertyChangeListenerWrapper;
+import org.eclipse.jpt.common.ui.internal.plugin.JptCommonUiPlugin;
import org.eclipse.jpt.common.utility.internal.ClassName;
import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.common.utility.model.Model;
@@ -312,10 +312,10 @@ public abstract class ClassChooserPane<T extends Model> extends ChooserPane<T>
JavaUI.openInEditor(type, true, true);
}
catch (JavaModelException e) {
- JptCommonUiPlugin.log(e);
+ JptCommonUiPlugin.instance().logError(e);
}
catch (PartInitException e) {
- JptCommonUiPlugin.log(e);
+ JptCommonUiPlugin.instance().logError(e);
}
}
@@ -371,7 +371,7 @@ public abstract class ClassChooserPane<T extends Model> extends ChooserPane<T>
);
}
catch (JavaModelException e) {
- JptCommonUiPlugin.log(e);
+ JptCommonUiPlugin.instance().logError(e);
return null;
}
@@ -426,7 +426,7 @@ public abstract class ClassChooserPane<T extends Model> extends ChooserPane<T>
try {
return this.getJavaProject().getPackageFragmentRoots()[0];
} catch (JavaModelException ex) {
- JptCommonUiPlugin.log(ex);
+ JptCommonUiPlugin.instance().logError(ex);
return null;
}
}
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/ComboPane.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/ComboPane.java
index e45646fa1c..a8b98e6a21 100644
--- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/ComboPane.java
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/ComboPane.java
@@ -300,4 +300,9 @@ public abstract class ComboPane<T extends Model>
return (this.comboBox.getItemCount() > 0)
&& value.equals(this.comboBox.getItem(0));
}
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this);
+ }
}
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/FileChooserPane.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/FileChooserPane.java
index 83fac632a7..ad3551a143 100644
--- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/FileChooserPane.java
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/FileChooserPane.java
@@ -13,7 +13,7 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.jpt.common.ui.JptCommonUiPlugin;
+import org.eclipse.jpt.common.ui.internal.plugin.JptCommonUiPlugin;
import org.eclipse.jpt.common.utility.model.Model;
import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
import org.eclipse.jpt.common.utility.model.value.ModifiablePropertyValueModel;
@@ -115,12 +115,8 @@ public abstract class FileChooserPane<T extends Model> extends ChooserPane<T>
protected ISelectionStatusValidator buildValidator() {
return new ISelectionStatusValidator() {
public IStatus validate(Object[] selection) {
-
- if (selection.length != 1) {
- return new Status(IStatus.ERROR, JptCommonUiPlugin.PLUGIN_ID, "");
- }
-
- return new Status(IStatus.OK, JptCommonUiPlugin.PLUGIN_ID, "");
+ int status = (selection.length == 1) ? IStatus.OK : IStatus.ERROR;
+ return JptCommonUiPlugin.instance().buildStatus(status);
}
};
}
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/IntegerCombo.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/IntegerCombo.java
index 85981e6364..0d135b5800 100644
--- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/IntegerCombo.java
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/IntegerCombo.java
@@ -15,7 +15,7 @@ import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
import org.eclipse.jpt.common.utility.internal.StringConverter;
import org.eclipse.jpt.common.utility.internal.model.value.PropertyListValueModelAdapter;
import org.eclipse.jpt.common.utility.internal.model.value.TransformationPropertyValueModel;
-import org.eclipse.jpt.common.utility.internal.model.value.TransformationWritablePropertyValueModel;
+import org.eclipse.jpt.common.utility.internal.model.value.TransformationModifiablePropertyValueModel;
import org.eclipse.jpt.common.utility.model.Model;
import org.eclipse.jpt.common.utility.model.value.ListValueModel;
import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
@@ -156,7 +156,7 @@ public abstract class IntegerCombo<T extends Model>
}
protected ModifiablePropertyValueModel<String> buildSelectedItemStringHolder() {
- return new TransformationWritablePropertyValueModel<Integer, String>(buildSelectedItemHolder()) {
+ return new TransformationModifiablePropertyValueModel<Integer, String>(buildSelectedItemHolder()) {
@Override
protected String transform(Integer v) {
return (v == null) ? getDefaultValueString() : v.toString();
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/PackageChooserPane.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/PackageChooserPane.java
index b840e3aacb..42d2433c48 100644
--- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/PackageChooserPane.java
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/PackageChooserPane.java
@@ -19,9 +19,9 @@ import org.eclipse.jdt.ui.JavaElementLabelProvider;
import org.eclipse.jdt.ui.JavaUI;
import org.eclipse.jface.fieldassist.FieldDecorationRegistry;
import org.eclipse.jface.window.Window;
-import org.eclipse.jpt.common.ui.JptCommonUiPlugin;
import org.eclipse.jpt.common.ui.internal.JptCommonUiMessages;
import org.eclipse.jpt.common.ui.internal.listeners.SWTPropertyChangeListenerWrapper;
+import org.eclipse.jpt.common.ui.internal.plugin.JptCommonUiPlugin;
import org.eclipse.jpt.common.utility.model.Model;
import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent;
import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener;
@@ -168,7 +168,7 @@ public abstract class PackageChooserPane<T extends Model> extends ChooserPane<T>
);
}
catch (JavaModelException e) {
- JptCommonUiPlugin.log(e);
+ JptCommonUiPlugin.instance().logError(e);
return null;
}
@@ -226,7 +226,7 @@ public abstract class PackageChooserPane<T extends Model> extends ChooserPane<T>
try {
return this.getJavaProject().getPackageFragmentRoots()[0];
} catch (JavaModelException ex) {
- JptCommonUiPlugin.log(ex);
+ JptCommonUiPlugin.instance().logError(ex);
return null;
}
}
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/Pane.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/Pane.java
index d63c61b0e2..a0ca1c10a7 100644
--- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/Pane.java
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/Pane.java
@@ -17,8 +17,8 @@ import org.eclipse.jface.fieldassist.FieldDecorationRegistry;
import org.eclipse.jface.viewers.ComboViewer;
import org.eclipse.jface.viewers.IBaseLabelProvider;
import org.eclipse.jpt.common.ui.WidgetFactory;
-import org.eclipse.jpt.common.ui.internal.Tracing;
import org.eclipse.jpt.common.ui.internal.listeners.SWTPropertyChangeListenerWrapper;
+import org.eclipse.jpt.common.ui.internal.plugin.JptCommonUiPlugin;
import org.eclipse.jpt.common.ui.internal.swt.ComboModelAdapter;
import org.eclipse.jpt.common.ui.internal.swt.DateTimeModelAdapter;
import org.eclipse.jpt.common.ui.internal.swt.SpinnerModelAdapter;
@@ -35,8 +35,8 @@ import org.eclipse.jpt.common.utility.model.Model;
import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent;
import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener;
import org.eclipse.jpt.common.utility.model.value.ListValueModel;
-import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
import org.eclipse.jpt.common.utility.model.value.ModifiablePropertyValueModel;
+import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
@@ -2353,7 +2353,7 @@ public abstract class Pane<T extends Model>
* @category Populate
*/
protected void doPopulate() {
- this.log(Tracing.UI_LAYOUT, " ->doPopulate()");
+ JptCommonUiPlugin.instance().trace(TRACE_OPTION, "doPopulate");
}
private void controlEnabledState(Control... controls) {
@@ -2402,7 +2402,7 @@ public abstract class Pane<T extends Model>
* specified subject is not null
*/
protected void engageListeners_(T subject) {
- this.log(Tracing.UI_LAYOUT, " ->engageListeners_(" + subject + ')');
+ JptCommonUiPlugin.instance().trace(TRACE_OPTION, "engageListeners_({0})", subject);
for (String propertyName : this.getPropertyNames()) {
subject.addPropertyChangeListener(propertyName, this.aspectChangeListener);
@@ -2422,7 +2422,7 @@ public abstract class Pane<T extends Model>
* specified subject is not null
*/
protected void disengageListeners_(T subject) {
- this.log(Tracing.UI_LAYOUT, " ->disengageListeners_(" + subject + ')');
+ JptCommonUiPlugin.instance().trace(TRACE_OPTION, "disengageListeners_({0})", subject);
for (String propertyName : this.getPropertyNames()) {
subject.removePropertyChangeListener(propertyName, this.aspectChangeListener);
@@ -2493,37 +2493,13 @@ public abstract class Pane<T extends Model>
}
/**
- * Logs the given message if the <code>Tracing.DEBUG_LAYOUT</code> is enabled.
- *
- * @param flag
- * @param message The logging message
- */
- protected void log(String flag, String message) {
- if (flag.equals(Tracing.UI_LAYOUT) && Tracing.booleanDebugOption(Tracing.UI_LAYOUT)) {
- this.log(message);
- }
- }
-
- protected void log(String message) {
- Class<?> thisClass = this.getClass();
- String className = thisClass.getSimpleName();
-
- if (thisClass.isAnonymousClass()) {
- className = className.substring(0, className.indexOf('$'));
- className += "->" + thisClass.getSuperclass().getSimpleName();
- }
-
- Tracing.log(className + ": " + message);
- }
-
- /**
* Notifies this pane to populate itself using the subject's information.
*
* @category Populate
*/
private void populate() {
if (!this.getControl().isDisposed()) {
- this.log(Tracing.UI_LAYOUT, "populate()");
+ JptCommonUiPlugin.instance().trace(TRACE_OPTION, "populate");
this.repopulate();
}
}
@@ -2560,8 +2536,7 @@ public abstract class Pane<T extends Model>
* @category Populate
*/
protected final void repopulate() {
-
- this.log(Tracing.UI_LAYOUT, " ->repopulate()");
+ JptCommonUiPlugin.instance().trace(TRACE_OPTION, "repopulate");
// Populate this pane
try {
@@ -2638,7 +2613,7 @@ public abstract class Pane<T extends Model>
protected final void subjectChanged(T oldSubject, T newSubject) {
if (!this.getControl().isDisposed()) {
- this.log(Tracing.UI_LAYOUT, "subjectChanged()");
+ JptCommonUiPlugin.instance().trace(TRACE_OPTION, "subjectChanged({0}, {1})", oldSubject, newSubject);
this.disengageListeners(oldSubject);
this.repopulate();
@@ -2688,7 +2663,7 @@ public abstract class Pane<T extends Model>
}
public void dispose() {
- this.log(Tracing.UI_LAYOUT, "dispose()");
+ JptCommonUiPlugin.instance().trace(TRACE_OPTION, "dispose");
// Dispose this pane
this.disengageListeners(getSubject());
@@ -2700,4 +2675,5 @@ public abstract class Pane<T extends Model>
}
}
-} \ No newline at end of file
+ private static final String TRACE_OPTION = Pane.class.getSimpleName();
+}
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/ItemStructuredContentProvider.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/ItemStructuredContentProvider.java
index 0ddbfe980c..f21f42816d 100644
--- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/ItemStructuredContentProvider.java
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/ItemStructuredContentProvider.java
@@ -11,6 +11,7 @@ package org.eclipse.jpt.common.ui.jface;
import java.io.Serializable;
import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.Tools;
/**
* Implementations of this interface can be used to maintain the elements
@@ -48,12 +49,6 @@ public interface ItemStructuredContentProvider {
/**
- * Convenience constant for when no children are present.
- */
- Object[] EMPTY_ARRAY = new Object[0];
-
-
- /**
* An item structured content provider's manager is notified whenever the
* input element's elements have changed.
*/
@@ -87,7 +82,7 @@ public interface ItemStructuredContentProvider {
super();
}
public Object[] getElements() {
- return EMPTY_ARRAY;
+ return Tools.EMPTY_OBJECT_ARRAY;
}
public void dispose() {
// NOP
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/ItemTreeContentProvider.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/ItemTreeContentProvider.java
index 32c3d90c05..6779f6603e 100644
--- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/ItemTreeContentProvider.java
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/ItemTreeContentProvider.java
@@ -11,6 +11,7 @@ package org.eclipse.jpt.common.ui.jface;
import java.io.Serializable;
import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.Tools;
/**
* Implementations of this interface can be used to maintain the content of a
@@ -84,13 +85,13 @@ public interface ItemTreeContentProvider
super();
}
public Object[] getElements() {
- return EMPTY_ARRAY;
+ return Tools.EMPTY_OBJECT_ARRAY;
}
public Object getParent() {
return null;
}
public Object[] getChildren() {
- return EMPTY_ARRAY;
+ return Tools.EMPTY_OBJECT_ARRAY;
}
public boolean hasChildren() {
return false;
diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/StructuredStateProvider.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/StructuredStateProvider.java
index 027b876ebd..f01f3c5b3f 100644
--- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/StructuredStateProvider.java
+++ b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/StructuredStateProvider.java
@@ -25,8 +25,5 @@ import org.eclipse.jface.viewers.IStructuredContentProvider;
public interface StructuredStateProvider
extends IStructuredContentProvider, ExtendedLabelProvider
{
- /**
- * Convenience constant for when no elements are present.
- */
- Object[] EMPTY_ARRAY = new Object[0];
+ // combine interfaces
}
diff --git a/common/plugins/org.eclipse.jpt.common.utility/META-INF/MANIFEST.MF b/common/plugins/org.eclipse.jpt.common.utility/META-INF/MANIFEST.MF
index 15b0ba4fe1..32e2a3b888 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/META-INF/MANIFEST.MF
+++ b/common/plugins/org.eclipse.jpt.common.utility/META-INF/MANIFEST.MF
@@ -2,8 +2,10 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
-Bundle-SymbolicName: org.eclipse.jpt.common.utility
+Bundle-SymbolicName: org.eclipse.jpt.common.utility;singleton:=true
Bundle-Version: 2.1.0.qualifier
+Bundle-ActivationPolicy: lazy
+Bundle-ClassPath: .
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Dali-Comment-1: *NO* EclipseLink friends!
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ArrayTools.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ArrayTools.java
index 4f152023e7..3d5ae01a6f 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ArrayTools.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ArrayTools.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2005, 2012 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.
@@ -22,7 +22,6 @@ import java.util.Random;
* Array-related utility methods.
*/
public final class ArrayTools {
- public static final Object[] EMPTY_OBJECT_ARRAY = new Object[0];
public static final char[] EMPTY_CHAR_ARRAY = new char[0];
public static final int[] EMPTY_INT_ARRAY = new int[0];
@@ -144,7 +143,7 @@ public final class ArrayTools {
public static Object[] array(Iterator<?> iterator) {
return iterator.hasNext() ?
CollectionTools.list(iterator).toArray() :
- EMPTY_OBJECT_ARRAY;
+ Tools.EMPTY_OBJECT_ARRAY;
}
/**
@@ -157,7 +156,7 @@ public final class ArrayTools {
public static Object[] array(Iterator<?> iterator, int iteratorSize) {
return iterator.hasNext() ?
CollectionTools.list(iterator, iteratorSize).toArray() :
- EMPTY_OBJECT_ARRAY;
+ Tools.EMPTY_OBJECT_ARRAY;
}
/**
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/NullList.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/NullList.java
index 826593db6b..4a91ceb9ca 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/NullList.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/NullList.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2012 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.
@@ -129,9 +129,8 @@ public final class NullList<E>
return this;
}
- private static final Object[] EMPTY_OBJECT_ARRAY = new Object[0];
public Object[] toArray() {
- return EMPTY_OBJECT_ARRAY;
+ return Tools.EMPTY_OBJECT_ARRAY;
}
public <T> T[] toArray(T[] a) {
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ReflectionTools.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ReflectionTools.java
index d3617b9795..ea82159dec 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ReflectionTools.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ReflectionTools.java
@@ -38,7 +38,6 @@ import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
public final class ReflectionTools {
public static final Class<?>[] ZERO_PARAMETER_TYPES = new Class[0];
- public static final Object[] ZERO_ARGUMENTS = new Object[0];
private static final String CR = StringTools.CR;
public static final Class<?> VOID_CLASS = void.class;
@@ -283,7 +282,7 @@ public final class ReflectionTools {
* <code>Object.execute(String methodName)</code>
*/
public static Object executeMethod(Object receiver, String methodName) {
- return executeMethod(receiver, methodName, ZERO_PARAMETER_TYPES, ZERO_ARGUMENTS);
+ return executeMethod(receiver, methodName, ZERO_PARAMETER_TYPES, Tools.EMPTY_OBJECT_ARRAY);
}
/**
@@ -295,7 +294,7 @@ public final class ReflectionTools {
* <p>
* <code>Object.execute(String methodName, Class<?> parameterType, Object argument)</code>
*/
- public static Object executeMethod(Object receiver, String methodName, Class<?> parameterType, Object argument) {
+ public static <T> Object executeMethod(Object receiver, String methodName, Class<T> parameterType, T argument) {
return executeMethod(receiver, methodName, new Class[] {parameterType}, new Object[] {argument});
}
@@ -339,7 +338,7 @@ public final class ReflectionTools {
public static Object executeMethod_(Object receiver, String methodName)
throws NoSuchMethodException, IllegalAccessException, InvocationTargetException
{
- return executeMethod_(receiver, methodName, ZERO_PARAMETER_TYPES, ZERO_ARGUMENTS);
+ return executeMethod_(receiver, methodName, ZERO_PARAMETER_TYPES, Tools.EMPTY_OBJECT_ARRAY);
}
/**
@@ -383,7 +382,7 @@ public final class ReflectionTools {
* <code>Class.executeStaticMethod(String methodName)</code>
*/
public static Object executeStaticMethod(Class<?> javaClass, String methodName) {
- return executeStaticMethod(javaClass, methodName, ZERO_PARAMETER_TYPES, ZERO_ARGUMENTS);
+ return executeStaticMethod(javaClass, methodName, ZERO_PARAMETER_TYPES, Tools.EMPTY_OBJECT_ARRAY);
}
/**
@@ -431,7 +430,7 @@ public final class ReflectionTools {
public static Object executeStaticMethod_(Class<?> javaClass, String methodName)
throws NoSuchMethodException, IllegalAccessException, InvocationTargetException
{
- return executeStaticMethod_(javaClass, methodName, ZERO_PARAMETER_TYPES, ZERO_ARGUMENTS);
+ return executeStaticMethod_(javaClass, methodName, ZERO_PARAMETER_TYPES, Tools.EMPTY_OBJECT_ARRAY);
}
/**
@@ -1101,7 +1100,7 @@ public final class ReflectionTools {
* <code>Class.newInstance()</code>
*/
public static <T> T newInstance(Class<T> javaClass) {
- return newInstance(javaClass, ZERO_PARAMETER_TYPES, ZERO_ARGUMENTS);
+ return newInstance(javaClass, ZERO_PARAMETER_TYPES, Tools.EMPTY_OBJECT_ARRAY);
}
/**
@@ -1145,7 +1144,7 @@ public final class ReflectionTools {
public static <T> T newInstance_(Class<T> javaClass)
throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException
{
- return newInstance_(javaClass, ZERO_PARAMETER_TYPES, ZERO_ARGUMENTS);
+ return newInstance_(javaClass, ZERO_PARAMETER_TYPES, Tools.EMPTY_OBJECT_ARRAY);
}
/**
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ReverseComparator.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ReverseComparator.java
index 948b8588e4..47eed92971 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ReverseComparator.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ReverseComparator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2008 Oracle. All rights reserved.
+ * Copyright (c) 2005, 2012 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.
@@ -14,27 +14,32 @@ import java.util.Comparator;
/**
* This comparator will reverse the order of the specified comparator.
- * If the comparator is null, the natural ordering of the objects will be used.
+ * If the specified comparator is <code>null</code>,
+ * the natural ordering of the objects will be used.
*/
public class ReverseComparator<E extends Comparable<? super E>>
implements Comparator<E>, Serializable
{
private final Comparator<E> comparator;
+ /**
+ * Construct a reverse comparator that will reverse the natural order of
+ * the compared elements.
+ */
public ReverseComparator() {
this(null);
}
+ /**
+ * Construct a reverse comparator that will reverse the order of
+ * the compared elements as calculated by the specified comparator.
+ */
public ReverseComparator(Comparator<E> comparator) {
super();
this.comparator = comparator;
}
public int compare(E e1, E e2) {
- return (this.comparator == null) ?
- e2.compareTo(e1)
- :
- this.comparator.compare(e2, e1);
+ return (this.comparator == null) ? e2.compareTo(e1) : this.comparator.compare(e2, e1);
}
-
}
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/StackTrace.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/StackTrace.java
index 714e06c5ce..b43b984bc1 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/StackTrace.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/StackTrace.java
@@ -30,33 +30,66 @@ public class StackTrace
public StackTrace() {
- this(Thread.currentThread());
+ this(StringTools.EMPTY_STRING_ARRAY);
+ }
+
+ public StackTrace(Class<?>... traceClasses) {
+ this(convertToNames(traceClasses));
+ }
+
+ public StackTrace(String... traceClasses) {
+ this(Thread.currentThread(), traceClasses);
}
public StackTrace(Thread thread) {
+ this(thread, StringTools.EMPTY_STRING_ARRAY);
+ }
+
+ public StackTrace(Thread thread, Class<?>... traceClasses) {
+ this(thread, convertToNames(traceClasses));
+ }
+
+ public StackTrace(Thread thread, String... traceClasses) {
super();
- if (thread == null) {
+ if ((thread == null) || (traceClasses == null)) {
throw new NullPointerException();
}
this.thread = thread;
- this.elements = this.buildElements();
+ this.elements = this.buildElements(traceClasses);
+ }
+
+ private static String[] convertToNames(Class<?>[] classes) {
+ int len = classes.length;
+ if (len == 0) {
+ return StringTools.EMPTY_STRING_ARRAY;
+ }
+ String[] names = new String[len];
+ for (int i = 0; i < len; i++) {
+ names[i] = classes[i].getName();
+ }
+ return names;
}
/**
- * Strip off all the elements associated with this class and {@link Thread}.
+ * Strip off all the elements associated with this class, the specified
+ * "trace" classes, and the {@link Thread} class.
+ * The "trace" classes are specified by the client at construction time and
+ * are those classes that should not appear on the top of the stack trace.
+ * The "trace" classes can appear elsewhere in the stack trace, just not at
+ * the top.
*/
- private StackTraceElement[] buildElements() {
+ private StackTraceElement[] buildElements(String[] traceClasses) {
StackTraceElement[] result = this.thread.getStackTrace();
int len = result.length;
if (len == 0) {
return result;
}
- String className = this.getClass().getName();
+ traceClasses = ArrayTools.add(traceClasses, this.getClass().getName());
boolean found = false;
int i = 0;
while (i < len) {
- if (result[i].getClassName().equals(className)) {
+ if (ArrayTools.contains(traceClasses, result[i].getClassName())) {
found = true;
} else {
if (found) {
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Tools.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Tools.java
index 10e36e7b22..953d9ddfd9 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Tools.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Tools.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2012 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.
@@ -14,6 +14,8 @@ package org.eclipse.jpt.common.utility.internal;
*/
@SuppressWarnings("nls")
public final class Tools {
+ /** empty object array */
+ public static final Object[] EMPTY_OBJECT_ARRAY = new Object[0];
// ********** object comparison **********
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/VersionComparator.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/VersionComparator.java
index 9aa9603a9d..901428f745 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/VersionComparator.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/VersionComparator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 Oracle. All rights reserved.
+ * Copyright (c) 2011, 2012 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.
@@ -15,8 +15,9 @@ import java.util.Comparator;
import java.util.StringTokenizer;
/**
- * This comparator can be used to compare version strings (e.g. "2.2.2" vs.
- * "2.14.3"). Clients can specify the delimiter(s) that separates a version's
+ * This comparator can be used to compare version strings
+ * (e.g. <code>"2.2.2"</code> vs. <code>"2.14.3"</code>).
+ * Clients can specify the delimiter(s) that separates a version's
* <em>segments</em> as well as a parser to be used for parsing each
* <em>segment</em>.
*
@@ -33,42 +34,33 @@ public class VersionComparator<T extends Comparable<T>>
* Static implementation of the version comparator interface that converts
* each version into a series of integers and compares them.
* <p>
- * <strong>NB:</strong> With this comparator <code>"2.14" > "2.2"</code>
+ * <strong>NB:</strong> With this comparator
+ * <code>"2.<strong>14</strong>" > "2.<strong>2</strong>"</code>
+ * is <code>true</code>.
*/
public static final Comparator<String> INTEGER_VERSION_COMPARATOR = new VersionComparator<Integer>(SegmentParser.IntegerSegmentParser.instance());
/**
+ * Use the specified segment parser.
* The default delimiter is <code>'.'</code>.
- * The default segment parser is disabled.
- * <p>
- * <strong>NB:</strong> Subclass must override:<ul>
- * <li>{@link #parseSegment(int, String)}
- * <li>{@link #getZero()}
- * </ul>
*/
- protected VersionComparator() {
- this("."); //$NON-NLS-1$
+ public VersionComparator(SegmentParser<T> segmentParser) {
+ this(".", segmentParser); //$NON-NLS-1$
}
/**
- * The default segment parser is disabled.
- * <p>
- * <strong>NB:</strong> Subclass must override:<ul>
- * <li>{@link #parseSegment(int, String)}
- * <li>{@link #getZero()}
- * </ul>
+ * Use the specified delimiters and segment parser.
*/
- protected VersionComparator(String delimiters) {
- this(delimiters, SegmentParser.Disabled.<T>instance());
+ public VersionComparator(char delimiter, SegmentParser<T> segmentParser) {
+ this(new char[] {delimiter}, segmentParser);
}
/**
- * Use the specified segment parser.
- * The default delimiter is <code>'.'</code>.
+ * Use the specified delimiters and segment parser.
*/
- public VersionComparator(SegmentParser<T> segmentParser) {
- this(".", segmentParser); //$NON-NLS-1$
+ public VersionComparator(char[] delimiters, SegmentParser<T> segmentParser) {
+ this(new String(delimiters), segmentParser);
}
/**
@@ -82,7 +74,7 @@ public class VersionComparator<T extends Comparable<T>>
/**
- * <strong>NB:</strong> Callers must handle any exceptions thrown by the
+ * <strong>NB:</strong> Callers must handle any runtime exceptions thrown by the
* segment parser supplied to the comparator. In particular, the pre-built
* integer segment parser {@link #INTEGER_VERSION_COMPARATOR} can throw a
* {@link NumberFormatException} if any segement string contains non-numeric
@@ -133,20 +125,11 @@ public class VersionComparator<T extends Comparable<T>>
ArrayList<T> segments = new ArrayList<T>();
int i = 0;
for (StringTokenizer stream = new StringTokenizer(s, this.delimiters); stream.hasMoreTokens(); ) {
- segments.add(this.parseSegment(i++, stream.nextToken()));
+ segments.add(this.segmentParser.parse(i++, stream.nextToken()));
}
return segments;
}
- /**
- * Parse the specified segment into the appropriate comparable.
- * Subclasses must override this method if a segment parser is not passed
- * to the version comparator's constructor.
- */
- protected T parseSegment(int index, String s) {
- return this.segmentParser.parse(index, s);
- }
-
protected T getZero() {
return this.segmentParser.getZero();
}
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/ChangeSupport.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/ChangeSupport.java
index 6774ac4b6d..28bc0247ec 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/ChangeSupport.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/ChangeSupport.java
@@ -80,6 +80,7 @@ import org.eclipse.jpt.common.utility.model.listener.TreeChangeListener;
* @see Model
* @see AbstractModel
*/
+// TODO add ExceptionHandler
public class ChangeSupport
implements Serializable
{
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AspectListValueModelAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AspectListValueModelAdapter.java
index da7db5c4f4..b20111ec30 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AspectListValueModelAdapter.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AspectListValueModelAdapter.java
@@ -15,6 +15,7 @@ import java.util.ListIterator;
import org.eclipse.jpt.common.utility.internal.ArrayTools;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.Tools;
import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.common.utility.internal.iterators.EmptyListIterator;
import org.eclipse.jpt.common.utility.model.listener.ListChangeListener;
@@ -68,11 +69,6 @@ public abstract class AspectListValueModelAdapter<S, E>
extends AspectAdapter<S, List<E>>
implements ListValueModel<E>
{
- private static final Object[] EMPTY_ARRAY = new Object[0];
-
-
- // ********** constructors **********
-
/**
* Construct a list value model adapter for an aspect of the
* specified subject.
@@ -146,7 +142,7 @@ public abstract class AspectListValueModelAdapter<S, E>
* Return an array manifestation of the subject's list aspect.
*/
public Object[] toArray() {
- return this.subject == null ? EMPTY_ARRAY : this.toArray_();
+ return this.subject == null ? Tools.EMPTY_OBJECT_ARRAY : this.toArray_();
}
/**
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/BufferedWritablePropertyValueModel.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/BufferedModifiablePropertyValueModel.java
index 2f292b8c53..ff4234e0e6 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/BufferedWritablePropertyValueModel.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/BufferedModifiablePropertyValueModel.java
@@ -16,7 +16,7 @@ import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
import org.eclipse.jpt.common.utility.model.value.ModifiablePropertyValueModel;
/**
- * A <code>BufferedWritablePropertyValueModel</code> is used to hold a temporary
+ * A <code>BufferedModifiablePropertyValueModel</code> is used to hold a temporary
* copy of the value
* in another property value model (the "wrapped" value model). The application
* can modify this temporary copy, ad nauseam; but the temporary copy is only
@@ -46,7 +46,7 @@ import org.eclipse.jpt.common.utility.model.value.ModifiablePropertyValueModel;
* @param <V> the type of the model's value
* @see PropertyAspectAdapter
*/
-public class BufferedWritablePropertyValueModel<V>
+public class BufferedModifiablePropertyValueModel<V>
extends PropertyValueModelWrapper<V>
implements ModifiablePropertyValueModel<V>
{
@@ -90,7 +90,7 @@ public class BufferedWritablePropertyValueModel<V>
* property value model and trigger model.
*/
// TODO wrap the value model in a CachingPVMWrapper and get rid of accepting flag
- public BufferedWritablePropertyValueModel(ModifiablePropertyValueModel<V> valueModel, PropertyValueModel<Boolean> triggerModel) {
+ public BufferedModifiablePropertyValueModel(ModifiablePropertyValueModel<V> valueModel, PropertyValueModel<Boolean> triggerModel) {
super(valueModel);
if (triggerModel == null) {
throw new NullPointerException();
@@ -111,7 +111,7 @@ public class BufferedWritablePropertyValueModel<V>
{
@Override
public void propertyChanged(PropertyChangeEvent event) {
- BufferedWritablePropertyValueModel.this.triggerChanged(event);
+ BufferedModifiablePropertyValueModel.this.triggerChanged(event);
}
}
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/FilteringWritablePropertyValueModel.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/FilteringModifiablePropertyValueModel.java
index 4a3c040eb7..dd8dfe33d4 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/FilteringWritablePropertyValueModel.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/FilteringModifiablePropertyValueModel.java
@@ -13,7 +13,7 @@ import org.eclipse.jpt.common.utility.Filter;
import org.eclipse.jpt.common.utility.model.value.ModifiablePropertyValueModel;
/**
- * A <code>FilteringWritablePropertyValueModel</code> wraps another
+ * A <code>FilteringModifiablePropertyValueModel</code> wraps another
* {@link ModifiablePropertyValueModel} and uses a pair of {@link Filter}s
* to determine when the wrapped value is to be returned by calls
* to {@link #getValue()} and modified by calls to
@@ -35,7 +35,7 @@ import org.eclipse.jpt.common.utility.model.value.ModifiablePropertyValueModel;
* @param <V> the type of the model's <em>filtered</em> value
* @see Filter
*/
-public class FilteringWritablePropertyValueModel<V>
+public class FilteringModifiablePropertyValueModel<V>
extends FilteringPropertyValueModel<V>
implements ModifiablePropertyValueModel<V>
{
@@ -53,7 +53,7 @@ public class FilteringWritablePropertyValueModel<V>
* property value model, <em>get</em> filter, and <em>set</em> filter.
* The default value will be <code>null</code>.
*/
- public FilteringWritablePropertyValueModel(ModifiablePropertyValueModel<V> valueModel, Filter<V> getFilter, Filter<V> setFilter) {
+ public FilteringModifiablePropertyValueModel(ModifiablePropertyValueModel<V> valueModel, Filter<V> getFilter, Filter<V> setFilter) {
this(valueModel, getFilter, setFilter, null);
}
@@ -62,7 +62,7 @@ public class FilteringWritablePropertyValueModel<V>
* property value model, <em>get</em> filter, <em>set</em> filter,
* and default value.
*/
- public FilteringWritablePropertyValueModel(ModifiablePropertyValueModel<V> valueModel, Filter<V> getFilter, Filter<V> setFilter, V defaultValue) {
+ public FilteringModifiablePropertyValueModel(ModifiablePropertyValueModel<V> valueModel, Filter<V> getFilter, Filter<V> setFilter, V defaultValue) {
super(valueModel, getFilter, defaultValue);
if (setFilter == null) {
throw new NullPointerException();
@@ -71,7 +71,7 @@ public class FilteringWritablePropertyValueModel<V>
}
- // ********** WritablePropertyValueModel implementation **********
+ // ********** ModifiablePropertyValueModel implementation **********
public void setValue(V value) {
if (this.setFilter.accept(value)) {
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/NullListValueModel.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/NullListValueModel.java
index 78801cce30..8db3507680 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/NullListValueModel.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/NullListValueModel.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 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.
@@ -12,6 +12,7 @@ package org.eclipse.jpt.common.utility.internal.model.value;
import java.util.Iterator;
import java.util.ListIterator;
+import org.eclipse.jpt.common.utility.internal.Tools;
import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
import org.eclipse.jpt.common.utility.internal.iterators.EmptyListIterator;
import org.eclipse.jpt.common.utility.internal.model.AbstractModel;
@@ -27,9 +28,6 @@ public final class NullListValueModel<E>
extends AbstractModel
implements ListValueModel<E>
{
- private static final Object[] EMPTY_ARRAY = new Object[0];
- private static final long serialVersionUID = 1L;
-
/**
* Default constructor.
*/
@@ -57,7 +55,7 @@ public final class NullListValueModel<E>
}
public Object[] toArray() {
- return EMPTY_ARRAY;
+ return Tools.EMPTY_OBJECT_ARRAY;
}
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/PropertyListValueModelAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/PropertyListValueModelAdapter.java
index c845d4fa5e..87a37a1716 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/PropertyListValueModelAdapter.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/PropertyListValueModelAdapter.java
@@ -11,8 +11,8 @@ package org.eclipse.jpt.common.utility.internal.model.value;
import java.util.Iterator;
import java.util.ListIterator;
-
import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.Tools;
import org.eclipse.jpt.common.utility.internal.iterators.EmptyListIterator;
import org.eclipse.jpt.common.utility.internal.iterators.SingleElementListIterator;
import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent;
@@ -104,9 +104,8 @@ public class PropertyListValueModelAdapter<E>
return this.value;
}
- protected static final Object[] EMPTY_OBJECT_ARRAY = new Object[0];
public Object[] toArray() {
- return (this.value == null) ? EMPTY_OBJECT_ARRAY : new Object[] {this.value};
+ return (this.value == null) ? Tools.EMPTY_OBJECT_ARRAY : new Object[] {this.value};
}
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ReadOnlyWritablePropertyValueModelWrapper.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ReadOnlyModifiablePropertyValueModelWrapper.java
index 9c7fbc7a18..4c9adc2102 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ReadOnlyWritablePropertyValueModelWrapper.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ReadOnlyModifiablePropertyValueModelWrapper.java
@@ -15,15 +15,15 @@ import org.eclipse.jpt.common.utility.model.value.ModifiablePropertyValueModel;
/**
* A simple implementation of {@link ModifiablePropertyValueModel} that actually
- * ... <em>isn't</em> ... writable. It can however be used in places that require a
+ * ... <em>isn't</em> ... modifiable. It can however be used in places that require a
* {@link ModifiablePropertyValueModel} and where the developer is sure that no
* attempt will be made to write to it.
*/
-public class ReadOnlyWritablePropertyValueModelWrapper<T>
+public class ReadOnlyModifiablePropertyValueModelWrapper<T>
extends PropertyValueModelWrapper<T>
implements ModifiablePropertyValueModel<T>
{
- public ReadOnlyWritablePropertyValueModelWrapper(PropertyValueModel<? extends T> valueModel) {
+ public ReadOnlyModifiablePropertyValueModelWrapper(PropertyValueModel<? extends T> valueModel) {
super(valueModel);
}
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/TransformationWritablePropertyValueModel.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/TransformationModifiablePropertyValueModel.java
index 01213ae8c2..b89cc0830f 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/TransformationWritablePropertyValueModel.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/TransformationModifiablePropertyValueModel.java
@@ -42,7 +42,7 @@ import org.eclipse.jpt.common.utility.model.value.ModifiablePropertyValueModel;
* @param <V2> the type of the model's <em>transformed</em> value
* @see Transformer
*/
-public class TransformationWritablePropertyValueModel<V1, V2>
+public class TransformationModifiablePropertyValueModel<V1, V2>
extends TransformationPropertyValueModel<V1, V2>
implements ModifiablePropertyValueModel<V2>
{
@@ -59,7 +59,7 @@ public class TransformationWritablePropertyValueModel<V1, V2>
* (or {@link #transform(Object)} and {@link #reverseTransform(Object)})
* methods instead of building {@link Transformer}s.
*/
- public TransformationWritablePropertyValueModel(ModifiablePropertyValueModel<V1> valueModel) {
+ public TransformationModifiablePropertyValueModel(ModifiablePropertyValueModel<V1> valueModel) {
super(valueModel);
this.reverseTransformer = this.buildReverseTransformer();
}
@@ -68,7 +68,7 @@ public class TransformationWritablePropertyValueModel<V1, V2>
* Construct a writable property value model with the specified nested
* writable property value model and transformers.
*/
- public TransformationWritablePropertyValueModel(ModifiablePropertyValueModel<V1> valueModel, Transformer<V1, V2> transformer, Transformer<V2, V1> reverseTransformer) {
+ public TransformationModifiablePropertyValueModel(ModifiablePropertyValueModel<V1> valueModel, Transformer<V1, V2> transformer, Transformer<V2, V1> reverseTransformer) {
super(valueModel, transformer);
if (reverseTransformer == null) {
throw new NullPointerException();
@@ -140,7 +140,7 @@ public class TransformationWritablePropertyValueModel<V1, V2>
implements Transformer<V2, V1>
{
public V1 transform(V2 v) {
- return (v == null) ? null : TransformationWritablePropertyValueModel.this.reverseTransform_(v);
+ return (v == null) ? null : TransformationModifiablePropertyValueModel.this.reverseTransform_(v);
}
}
}
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/ObjectListSelectionModel.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/ObjectListSelectionModel.java
index 98538e7061..35ea39a4da 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/ObjectListSelectionModel.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/ObjectListSelectionModel.java
@@ -18,6 +18,7 @@ import javax.swing.event.ListDataEvent;
import javax.swing.event.ListDataListener;
import javax.swing.event.ListSelectionListener;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.Tools;
/**
* This ListSelectionModel is aware of the ListModel and
@@ -156,7 +157,7 @@ public class ObjectListSelectionModel
int max = this.getMaxSelectionIndex();
if ((min < 0) || (max < 0)) {
- return new Object[0];
+ return Tools.EMPTY_OBJECT_ARRAY;
}
int maxSize = (max - min) + 1;
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/RadioButtonModelAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/RadioButtonModelAdapter.java
index f37251c757..97a46227e2 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/RadioButtonModelAdapter.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/RadioButtonModelAdapter.java
@@ -11,8 +11,8 @@ package org.eclipse.jpt.common.utility.internal.model.value.swing;
import org.eclipse.jpt.common.utility.Filter;
import org.eclipse.jpt.common.utility.internal.Transformer;
-import org.eclipse.jpt.common.utility.internal.model.value.FilteringWritablePropertyValueModel;
-import org.eclipse.jpt.common.utility.internal.model.value.TransformationWritablePropertyValueModel;
+import org.eclipse.jpt.common.utility.internal.model.value.FilteringModifiablePropertyValueModel;
+import org.eclipse.jpt.common.utility.internal.model.value.TransformationModifiablePropertyValueModel;
import org.eclipse.jpt.common.utility.model.value.ModifiablePropertyValueModel;
/**
@@ -61,8 +61,8 @@ public class RadioButtonModelAdapter
* value to the button value.
*/
public static ModifiablePropertyValueModel<Boolean> buildBooleanHolder(ModifiablePropertyValueModel<Object> valueHolder, Object buttonValue) {
- ModifiablePropertyValueModel<Object> filteringPVM = new FilteringWritablePropertyValueModel<Object>(valueHolder, Filter.Transparent.instance(), new SetRadioButtonFilter(buttonValue));
- return new TransformationWritablePropertyValueModel<Object, Boolean>(filteringPVM, new RadioButtonTransformer(buttonValue), new ReverseRadioButtonTransformer(buttonValue));
+ ModifiablePropertyValueModel<Object> filteringPVM = new FilteringModifiablePropertyValueModel<Object>(valueHolder, Filter.Transparent.instance(), new SetRadioButtonFilter(buttonValue));
+ return new TransformationModifiablePropertyValueModel<Object, Boolean>(filteringPVM, new RadioButtonTransformer(buttonValue), new ReverseRadioButtonTransformer(buttonValue));
}
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/node/AbstractNode.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/node/AbstractNode.java
index 449642da78..dc1079a5de 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/node/AbstractNode.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/node/AbstractNode.java
@@ -19,6 +19,7 @@ import java.util.ListIterator;
import java.util.Set;
import java.util.Vector;
+import org.eclipse.jpt.common.utility.internal.Tools;
import org.eclipse.jpt.common.utility.internal.iterators.CloneIterator;
import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator;
import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator;
@@ -72,7 +73,6 @@ public abstract class AbstractNode
* allowing for asynchronous modification from another thread.
*/
private Vector<Problem> problems; // pseudo-final
- private static final Object[] EMPTY_PROBLEM_MESSAGE_ARGUMENTS = new Object[0];
/**
* Cache the node's "branch" problems, as calculated during validation.
@@ -711,7 +711,7 @@ public abstract class AbstractNode
}
protected final Problem buildProblem(String messageKey, int messageType) {
- return this.buildProblem(messageKey, messageType, EMPTY_PROBLEM_MESSAGE_ARGUMENTS);
+ return this.buildProblem(messageKey, messageType, Tools.EMPTY_OBJECT_ARRAY);
}
/**
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/FilteringListBrowser.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/FilteringListBrowser.java
index 68ee9aa0ec..7d5593bbb3 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/FilteringListBrowser.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/FilteringListBrowser.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 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.
@@ -13,6 +13,7 @@ import javax.swing.Icon;
import javax.swing.JComboBox;
import javax.swing.JOptionPane;
import javax.swing.ListModel;
+import org.eclipse.jpt.common.utility.internal.Tools;
/**
* This implementation of LongListComponent.Browser uses a
@@ -118,11 +119,11 @@ public class FilteringListBrowser<T>
// ********** custom panel **********
- protected static class LocalFilteringListPanel<S> extends FilteringListPanel<S> {
- protected static final Object[] EMPTY_ARRAY = new Object[0];
-
+ protected static class LocalFilteringListPanel<S>
+ extends FilteringListPanel<S>
+ {
protected LocalFilteringListPanel() {
- super(EMPTY_ARRAY, null);
+ super(Tools.EMPTY_OBJECT_ARRAY, null);
}
/**
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/MultiMethodReflectiveChangeListener.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/MultiMethodReflectiveChangeListener.java
index 45762bf06c..f6364cffad 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/MultiMethodReflectiveChangeListener.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/MultiMethodReflectiveChangeListener.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 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.
@@ -10,8 +10,8 @@
package org.eclipse.jpt.common.utility.model.listener;
import java.lang.reflect.Method;
-
import org.eclipse.jpt.common.utility.internal.ReflectionTools;
+import org.eclipse.jpt.common.utility.internal.Tools;
import org.eclipse.jpt.common.utility.model.event.CollectionAddEvent;
import org.eclipse.jpt.common.utility.model.event.CollectionChangeEvent;
import org.eclipse.jpt.common.utility.model.event.CollectionClearEvent;
@@ -73,7 +73,7 @@ class MultiMethodReflectiveChangeListener
private void invoke(Method method, CollectionEvent event) {
if (method.getParameterTypes().length == 0) {
- ReflectionTools.executeMethod(method, this.target, EMPTY_OBJECT_ARRAY);
+ ReflectionTools.executeMethod(method, this.target, Tools.EMPTY_OBJECT_ARRAY);
} else {
ReflectionTools.executeMethod(method, this.target, new CollectionEvent[] {event});
}
@@ -100,7 +100,7 @@ class MultiMethodReflectiveChangeListener
private void invoke(Method method, ListEvent event) {
if (method.getParameterTypes().length == 0) {
- ReflectionTools.executeMethod(method, this.target, EMPTY_OBJECT_ARRAY);
+ ReflectionTools.executeMethod(method, this.target, Tools.EMPTY_OBJECT_ARRAY);
} else {
ReflectionTools.executeMethod(method, this.target, new ListEvent[] {event});
}
@@ -135,7 +135,7 @@ class MultiMethodReflectiveChangeListener
private void invoke(Method method, TreeEvent event) {
if (method.getParameterTypes().length == 0) {
- ReflectionTools.executeMethod(method, this.target, EMPTY_OBJECT_ARRAY);
+ ReflectionTools.executeMethod(method, this.target, Tools.EMPTY_OBJECT_ARRAY);
} else {
ReflectionTools.executeMethod(method, this.target, new TreeEvent[] {event});
}
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/ReflectiveChangeListener.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/ReflectiveChangeListener.java
index 8a24cd5073..4baba0215d 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/ReflectiveChangeListener.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/ReflectiveChangeListener.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 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.
@@ -134,8 +134,6 @@ public abstract class ReflectiveChangeListener {
@SuppressWarnings("unchecked")
protected static final Class<TreeChangeEvent>[] TREE_CHANGE_EVENT_CLASS_ARRAY = new Class[] {TREE_CHANGE_EVENT_CLASS};
- protected static final Object[] EMPTY_OBJECT_ARRAY = new Object[0];
-
// ********** helper methods **********
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/SingleMethodReflectiveChangeListener.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/SingleMethodReflectiveChangeListener.java
index 146e75ffd3..298e86400e 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/SingleMethodReflectiveChangeListener.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/SingleMethodReflectiveChangeListener.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 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.
@@ -11,6 +11,7 @@ package org.eclipse.jpt.common.utility.model.listener;
import java.lang.reflect.Method;
import org.eclipse.jpt.common.utility.internal.ReflectionTools;
+import org.eclipse.jpt.common.utility.internal.Tools;
import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent;
import org.eclipse.jpt.common.utility.model.event.StateChangeEvent;
@@ -40,7 +41,7 @@ class SingleMethodReflectiveChangeListener
public void stateChanged(StateChangeEvent event) {
if (this.methodIsZeroArgument) {
- ReflectionTools.executeMethod(this.method, this.target, EMPTY_OBJECT_ARRAY);
+ ReflectionTools.executeMethod(this.method, this.target, Tools.EMPTY_OBJECT_ARRAY);
} else {
ReflectionTools.executeMethod(this.method, this.target, new StateChangeEvent[] {event});
}
@@ -51,7 +52,7 @@ class SingleMethodReflectiveChangeListener
public void propertyChanged(PropertyChangeEvent event) {
if (this.methodIsZeroArgument) {
- ReflectionTools.executeMethod(this.method, this.target, EMPTY_OBJECT_ARRAY);
+ ReflectionTools.executeMethod(this.method, this.target, Tools.EMPTY_OBJECT_ARRAY);
} else {
ReflectionTools.executeMethod(this.method, this.target, new PropertyChangeEvent[] {event});
}
diff --git a/common/tests/org.eclipse.jpt.common.core.tests/META-INF/MANIFEST.MF b/common/tests/org.eclipse.jpt.common.core.tests/META-INF/MANIFEST.MF
index 1d370da61b..81e03aa192 100644
--- a/common/tests/org.eclipse.jpt.common.core.tests/META-INF/MANIFEST.MF
+++ b/common/tests/org.eclipse.jpt.common.core.tests/META-INF/MANIFEST.MF
@@ -4,9 +4,10 @@ Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.jpt.common.core.tests;singleton:=true
Bundle-Version: 1.2.0.qualifier
+Bundle-ActivationPolicy: lazy
+Bundle-ClassPath: .
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Bundle-ActivationPolicy: lazy
Require-Bundle: org.eclipse.core.resources;bundle-version="[3.4.0,4.0.0)",
org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)",
org.eclipse.jdt.core;bundle-version="[3.4.0,4.0.0)",
@@ -15,7 +16,8 @@ Require-Bundle: org.eclipse.core.resources;bundle-version="[3.4.0,4.0.0)",
org.eclipse.jpt.common.utility.tests;bundle-version="[2.0.0,3.0.0)",
org.eclipse.wst.common.project.facet.core;bundle-version="[1.3.0,2.0.0)",
org.junit;bundle-version="[4.0.0,5.0.0)"
-Export-Package: org.eclipse.jpt.common.core.tests.internal;x-internal:=true,
+Export-Package: org.eclipse.jpt.common.core.tests,
+ org.eclipse.jpt.common.core.tests.internal;x-internal:=true,
org.eclipse.jpt.common.core.tests.internal.projects;x-internal:=true,
org.eclipse.jpt.common.core.tests.internal.resource.java;x-internal:=true,
org.eclipse.jpt.common.core.tests.internal.utility.jdt;x-internal:=true
diff --git a/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/BundleActivatorTest.java b/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/BundleActivatorTest.java
new file mode 100644
index 0000000000..76f4fb5a9b
--- /dev/null
+++ b/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/BundleActivatorTest.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.tests;
+
+import org.eclipse.jpt.common.utility.internal.ReflectionTools;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleReference;
+import junit.framework.TestCase;
+
+/**
+ * This test case will verify that a class's "bundle activator" class
+ * (i.e. its "plug-in" class - e.g. <code>JptCommonCorePlugin</code>)
+ * has not been exported (accidentally).
+ * <p>
+ * Construct the test case with any class exported by the plug-in to be verified.
+ * <p>
+ * We use reflection(!) to fetch the bundle activator from the class's bundle
+ * and then attempt to dynamically load the activator's class. This will fail
+ * if the activator's class is <em>not</em> exported; which is what we want.
+ */
+@SuppressWarnings("nls")
+public class BundleActivatorTest
+ extends TestCase
+{
+ private final Class<?> clazz;
+ private final Bundle bundle;
+
+ public BundleActivatorTest(Class<?> clazz) {
+ super(buildName(clazz));
+ this.bundle = buildBundle(clazz);
+ this.clazz = clazz;
+ }
+
+ private static String buildName(Class<?> clazz) {
+ Bundle bundle = buildBundle(clazz);
+ return BundleActivatorTest.class.getSimpleName() + ": " + bundle.getSymbolicName();
+ }
+
+ private static Bundle buildBundle(Class<?> clazz) {
+ ClassLoader classLoader = clazz.getClassLoader();
+ return (classLoader instanceof BundleReference) ? ((BundleReference) classLoader).getBundle() : null;
+ }
+
+ @Override
+ protected void runTest() throws Throwable {
+ if (this.bundle == null) {
+ fail("non-bundle class: " + this.clazz);
+ }
+ BundleContext bundleContext = this.bundle.getBundleContext();
+ // a little hackery:
+ BundleActivator activator = (BundleActivator) ReflectionTools.getFieldValue(bundleContext, "activator");
+ String activatorClassName = activator.getClass().getName();
+ try {
+ Class<?> activatorClass = Class.forName(activatorClassName);
+ fail("activator class is exported: " + activatorClass);
+ } catch (ClassNotFoundException ex) {
+ // success
+ }
+ }
+}
diff --git a/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/CoreTestTools.java b/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/CoreTestTools.java
new file mode 100644
index 0000000000..5c22a75318
--- /dev/null
+++ b/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/CoreTestTools.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.tests;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+
+/**
+ * Various tools that can be used by test cases.
+ */
+@SuppressWarnings("nls")
+public final class CoreTestTools {
+
+ /**
+ * Delete the specified project, making multiple attempts because open
+ * files etc. can prevent a project from being deleted.
+ */
+ public static void delete(IProject project) throws Exception {
+ int i = 0;
+ boolean deleted = false;
+ while ( ! deleted) {
+ try {
+ project.delete(true, true, null);
+ deleted = true;
+ } catch (CoreException ex) {
+ if (i == 3) {
+ throw new RuntimeException("unable to delete project: " + project.getName(), ex);
+ }
+ Thread.sleep((1 << i) * 1000);
+ i++;
+ }
+ }
+ }
+
+ /**
+ * suppressed constructor
+ */
+ private CoreTestTools() {
+ super();
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/PreferencesTests.java b/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/PreferencesTests.java
new file mode 100644
index 0000000000..b8986bd7bc
--- /dev/null
+++ b/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/PreferencesTests.java
@@ -0,0 +1,148 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.tests;
+
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.Properties;
+import junit.framework.TestCase;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.jpt.common.core.internal.utility.JptPlugin;
+import org.eclipse.jpt.common.core.tests.internal.projects.TestJavaProject;
+import org.eclipse.jpt.common.utility.internal.ReflectionTools;
+import org.eclipse.jpt.common.utility.tests.internal.TestTools;
+
+/**
+ * Provide a little infrastructure for testing the backward-compatibility of
+ * preferences
+ */
+@SuppressWarnings("nls")
+public abstract class PreferencesTests
+ extends TestCase
+{
+ private TestJavaProject javaProjectHarness;
+ private String workspacePrefsFilePath;
+ private String projectPrefsFilePath;
+
+ private static final String WORKSPACE_PREFS_DIR_NAME = "/.metadata/.plugins/org.eclipse.core.runtime/.settings/";
+ private static final String PROJECT_PREFS_DIR_NAME = "/.settings/";
+
+
+ public PreferencesTests(String name) {
+ super(name);
+ }
+
+ // ********** set up/tear down **********
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ this.javaProjectHarness = this.buildJavaProjectHarness(false); // false = no auto-build
+ this.workspacePrefsFilePath = this.getWorkspaceRoot().getLocation().toString() + WORKSPACE_PREFS_DIR_NAME + this.getWorkspacePrefsFileName();
+ this.projectPrefsFilePath = this.getProject().getLocation().toString() + PROJECT_PREFS_DIR_NAME + this.getProjectPrefsFileName();
+ }
+
+ protected abstract String getWorkspacePrefsFileName();
+
+ protected abstract String getProjectPrefsFileName();
+
+ private TestJavaProject buildJavaProjectHarness(boolean autoBuild) throws Exception {
+ return this.buildJavaProjectHarness(this.getName(), autoBuild);
+ }
+
+ private TestJavaProject buildJavaProjectHarness(String projectName, boolean autoBuild) throws Exception {
+ return new TestJavaProject(projectName, autoBuild);
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ this.getPlugin().removePreferences();
+ this.flushWorkspacePrefs();
+ // no need to remove project prefs, as we simply delete the entire project here
+ CoreTestTools.delete(this.getProject());
+ TestTools.clear(this);
+ super.tearDown();
+ }
+
+
+ // ********** convenience methods **********
+
+ protected IWorkspaceRoot getWorkspaceRoot() {
+ return ResourcesPlugin.getWorkspace().getRoot();
+ }
+
+ protected IProject getProject() {
+ return this.javaProjectHarness.getProject();
+ }
+
+ protected Properties readProjectPrefs() {
+ return this.readProperties(this.projectPrefsFilePath);
+ }
+
+ protected Properties readWorkspacePrefs() {
+ return this.readProperties(this.workspacePrefsFilePath);
+ }
+
+ /**
+ * read preferences directly from file
+ */
+ protected Properties readProperties(String path) {
+ Properties properties = new Properties();
+ FileInputStream stream;
+ try {
+ stream = new FileInputStream(path);
+ } catch (FileNotFoundException ex) {
+ throw new RuntimeException(ex);
+ }
+
+ try {
+ properties.load(stream);
+ } catch (IOException ex) {
+ throw new RuntimeException(ex);
+ } finally {
+ try {
+ stream.close();
+ } catch (IOException ex) {
+ throw new RuntimeException(ex);
+ }
+ }
+
+ return properties;
+ }
+
+ protected void flushWorkspacePrefs() throws Exception {
+ JptPlugin plugin = this.getPlugin();
+ IEclipsePreferences prefs = (IEclipsePreferences) ReflectionTools.executeMethod(plugin, "getWorkspacePreferences");
+ prefs.flush();
+ }
+
+ protected void flushProjectPrefs() throws Exception {
+ JptPlugin plugin = this.getPlugin();
+ IEclipsePreferences prefs = (IEclipsePreferences) ReflectionTools.executeMethod(plugin, "getProjectPreferences", IProject.class, this.getProject());
+ prefs.flush();
+ }
+
+ protected JptPlugin getPlugin() throws Exception {
+ return (JptPlugin) ReflectionTools.executeStaticMethod(this.getPreferencesClass(), "getPlugin");
+ }
+
+ /**
+ * Return the public facade class used by clients to read and write
+ * the plug-in's preferences (e.g. <code>JpaPreferences.class</code>).
+ * The expectation is this class implements the (private) static method
+ * <code>getPlugin()</code> and the returned plug-in is an instance of
+ * a subclass of {@link JptPlugin}.
+ */
+ protected abstract Class<?> getPreferencesClass();
+}
diff --git a/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/JptCommonCoreTests.java b/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/JptCommonCoreTests.java
index b53253a105..3484a85aeb 100644
--- a/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/JptCommonCoreTests.java
+++ b/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/JptCommonCoreTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 Oracle. All rights reserved.
+ * Copyright (c) 2011, 2012 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.
@@ -11,6 +11,8 @@ package org.eclipse.jpt.common.core.tests.internal;
import junit.framework.Test;
import junit.framework.TestSuite;
+import org.eclipse.jpt.common.core.AnnotationProvider;
+import org.eclipse.jpt.common.core.tests.BundleActivatorTest;
import org.eclipse.jpt.common.core.tests.internal.resource.java.JptCommonCoreResourceJavaTests;
import org.eclipse.jpt.common.core.tests.internal.utility.jdt.JptCommonCoreUtilityJdtTests;
@@ -20,6 +22,7 @@ public class JptCommonCoreTests {
TestSuite suite = new TestSuite(JptCommonCoreTests.class.getPackage().getName());
suite.addTest(JptCommonCoreResourceJavaTests.suite());
suite.addTest(JptCommonCoreUtilityJdtTests.suite());
+ suite.addTest(new BundleActivatorTest(AnnotationProvider.class));
return suite;
}
diff --git a/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/utility/jdt/AnnotationTestCase.java b/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/utility/jdt/AnnotationTestCase.java
index 7eca5e2f1b..7a81879015 100644
--- a/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/utility/jdt/AnnotationTestCase.java
+++ b/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/utility/jdt/AnnotationTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2012 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.
@@ -45,6 +45,7 @@ import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools;
import org.eclipse.jpt.common.core.internal.utility.jdt.JDTFieldAttribute;
import org.eclipse.jpt.common.core.internal.utility.jdt.JDTMethodAttribute;
import org.eclipse.jpt.common.core.internal.utility.jdt.JDTType;
+import org.eclipse.jpt.common.core.tests.CoreTestTools;
import org.eclipse.jpt.common.core.tests.internal.projects.TestJavaProject;
import org.eclipse.jpt.common.core.tests.internal.projects.TestJavaProject.SourceWriter;
import org.eclipse.jpt.common.core.utility.jdt.ModifiedDeclaration;
@@ -105,28 +106,11 @@ public abstract class AnnotationTestCase
@Override
protected void tearDown() throws Exception {
// this.dumpSource();
- this.deleteProject();
+ CoreTestTools.delete(this.javaProject.getProject());
TestTools.clear(this);
super.tearDown();
}
- protected void deleteProject() throws Exception {
- int i = 1;
- boolean deleted = false;
- while ( ! deleted) {
- try {
- this.javaProject.getProject().delete(true, true, null);
- deleted = true;
- } catch (CoreException ex) {
- if (i == 4) {
- throw new RuntimeException(this.getName() + " - unable to delete project", ex);
- }
- Thread.sleep(1000);
- i++;
- }
- }
- }
-
protected void dumpSource(ICompilationUnit cu) throws Exception {
System.out.println("*** " + this.getName() + " ****");
System.out.println(this.getSource(cu));
diff --git a/common/tests/org.eclipse.jpt.common.core.tests/test.xml b/common/tests/org.eclipse.jpt.common.core.tests/test.xml
index 0034685b7a..50a14c399d 100644
--- a/common/tests/org.eclipse.jpt.common.core.tests/test.xml
+++ b/common/tests/org.eclipse.jpt.common.core.tests/test.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?> <!--
- Copyright (c) 2007, 2010 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 -->
+ Copyright (c) 2007, 2012 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 -->
<project name="testsuite" default="run" basedir=".">
<!-- The property ${eclipse-home} should be passed into this script -->
@@ -20,8 +20,7 @@
</delete>
</target>
- <!-- This target defines the tests that need to be run. -->
- <target name="suite1">
+ <!-- This target defines the tests that need to be run. --> <target name="suite">
<property file="${testRoot}/testServer.properties"/>
<property name="jpt-folder" value="${eclipse-home}/jpt_folder"/>
<delete dir="${jpt-folder}" quiet="true"/>
@@ -31,7 +30,7 @@
<property name="plugin-name" value="${plugin-name}"/>
<property name="classname" value="org.eclipse.jpt.common.core.tests.internal.JptCommonCoreTests" />
<property name="plugin-path" value="${eclipse-home}/plugins/${plugin-name}"/>
- </ant> </target>
+ </ant> </target>
<!-- This target holds code to cleanup the testing environment after -->
<!-- after all of the tests have been run. You can use this target to -->
<!-- delete temporary files that have been created. -->
@@ -40,6 +39,6 @@
<!-- This target runs the test suite. Any actions that need to happen -->
<!-- after all the tests have been run should go here. -->
- <target name="run" depends="init, suite1,cleanup">
+ <target name="run" depends="init, suite, cleanup">
</target>
</project> \ No newline at end of file
diff --git a/common/tests/org.eclipse.jpt.common.ui.tests/META-INF/MANIFEST.MF b/common/tests/org.eclipse.jpt.common.ui.tests/META-INF/MANIFEST.MF
index a8ccfe3992..93f23db55c 100644
--- a/common/tests/org.eclipse.jpt.common.ui.tests/META-INF/MANIFEST.MF
+++ b/common/tests/org.eclipse.jpt.common.ui.tests/META-INF/MANIFEST.MF
@@ -2,13 +2,17 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
-Bundle-SymbolicName: org.eclipse.jpt.common.ui.tests
+Bundle-SymbolicName: org.eclipse.jpt.common.ui.tests;singleton:=true
Bundle-Version: 1.1.0.qualifier
+Bundle-ActivationPolicy: lazy
+Bundle-ClassPath: .
+Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Require-Bundle:
org.eclipse.core.runtime;bundle-version="[3.6.100,4.0.0)",
org.eclipse.jface;bundle-version="[3.7.0,4.0.0)",
org.eclipse.jpt.common.utility;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.jpt.common.core.tests;bundle-version="[1.0.0,2.0.0)",
org.eclipse.jpt.common.ui;bundle-version="[1.0.0,2.0.0)",
org.eclipse.ui.forms;bundle-version="[3.5.100,4.0.0)",
org.eclipse.ui.workbench;bundle-version="[3.7.0,4.0.0)",
diff --git a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/JptCommonUiTests.java b/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/JptCommonUiTests.java
index bb3b72fe07..0deaf5b069 100644
--- a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/JptCommonUiTests.java
+++ b/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/JptCommonUiTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2012 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.
@@ -11,18 +11,18 @@ package org.eclipse.jpt.common.ui.tests;
import junit.framework.Test;
import junit.framework.TestSuite;
+import org.eclipse.jpt.common.core.tests.BundleActivatorTest;
+import org.eclipse.jpt.common.ui.WidgetFactory;
import org.eclipse.jpt.common.ui.tests.internal.swt.JptUiSWTTests;
import org.eclipse.jpt.common.ui.tests.internal.util.JptUiUtilTests;
-/**
- * Runs all JPT UI Tests
- */
public class JptCommonUiTests {
public static Test suite() {
TestSuite suite = new TestSuite(JptCommonUiTests.class.getPackage().getName());
suite.addTest(JptUiSWTTests.suite());
suite.addTest(JptUiUtilTests.suite());
+ suite.addTest(new BundleActivatorTest(WidgetFactory.class));
return suite;
}
@@ -30,5 +30,4 @@ public class JptCommonUiTests {
super();
throw new UnsupportedOperationException();
}
-
}
diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/META-INF/MANIFEST.MF b/common/tests/org.eclipse.jpt.common.utility.tests/META-INF/MANIFEST.MF
index cf9398b9f3..810de02604 100644
--- a/common/tests/org.eclipse.jpt.common.utility.tests/META-INF/MANIFEST.MF
+++ b/common/tests/org.eclipse.jpt.common.utility.tests/META-INF/MANIFEST.MF
@@ -2,8 +2,10 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
-Bundle-SymbolicName: org.eclipse.jpt.common.utility.tests
+Bundle-SymbolicName: org.eclipse.jpt.common.utility.tests;singleton:=true
Bundle-Version: 2.1.0.qualifier
+Bundle-ActivationPolicy: lazy
+Bundle-ClassPath: .
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Require-Bundle: org.eclipse.jpt.common.utility;bundle-version="[2.0.0,3.0.0)",
diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/TestTools.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/TestTools.java
index 5fff2ff48b..579ff670a9 100644
--- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/TestTools.java
+++ b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/TestTools.java
@@ -217,13 +217,7 @@ public final class TestTools {
}
}
- /**
- * Return the value of the specified class's <code>DEBUG</code> constant.
- */
- public static boolean debug(Class<?> clazz) {
- Boolean debug = (Boolean) ReflectionTools.getStaticFieldValue(clazz, "DEBUG");
- return debug.booleanValue();
- }
+ private static final Class<TestCase> TestCase_class = TestCase.class;
/**
* Verify the specified class's <code>DEBUG</code> constant is set to
@@ -233,7 +227,13 @@ public final class TestTools {
Assert.assertFalse("Recompile with \"DEBUG = false\": " + clazz.getName(), debug(clazz));
}
- private static final Class<TestCase> TestCase_class = TestCase.class;
+ /**
+ * Return the value of the specified class's <code>DEBUG</code> constant.
+ */
+ public static boolean debug(Class<?> clazz) {
+ Boolean debug = (Boolean) ReflectionTools.getStaticFieldValue(clazz, "DEBUG");
+ return debug.booleanValue();
+ }
/**
* Workaround for a JUnit bug: JUnit does not configure the testing {@link Thread}
diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/VersionComparatorTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/VersionComparatorTests.java
index 3a7eff17a3..ec9e73c5e6 100644
--- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/VersionComparatorTests.java
+++ b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/VersionComparatorTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 Oracle. All rights reserved.
+ * Copyright (c) 2011, 2012 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.
@@ -67,7 +67,7 @@ public class VersionComparatorTests
}
public void testVersionIsGreater_integer_comma() {
- Comparator<String> versionComparator = new VersionComparator<BigDecimal>(",", DecimalSegmentParser.instance());
+ Comparator<String> versionComparator = new VersionComparator<BigDecimal>(',', DecimalSegmentParser.instance());
assertTrue(versionComparator.compare("2,0,2", "2,0,1") > 0);
assertTrue(versionComparator.compare("2,0,2.1", "2,0,1") > 0);
assertTrue(versionComparator.compare("2,0,2", "2,0,1.9") > 0);
@@ -75,16 +75,7 @@ public class VersionComparatorTests
}
public void testVersionIsEqual_subclass() {
- Comparator<String> versionComparator = new VersionComparator<Integer>() {
- @Override
- protected Integer parseSegment(int index, String s) {
- return Integer.valueOf(s);
- }
- @Override
- protected Integer getZero() {
- return Integer.valueOf(0);
- }
- };
+ Comparator<String> versionComparator = VersionComparator.INTEGER_VERSION_COMPARATOR;
assertTrue(versionComparator.compare("2.0.0", "2.0.0") == 0);
assertTrue(versionComparator.compare("2.0.0", "2.0.0.0") == 0);
assertTrue(versionComparator.compare("2.0.0.0", "2.0") == 0);
@@ -92,16 +83,7 @@ public class VersionComparatorTests
}
public void testVersionIsLess_subclass() {
- Comparator<String> versionComparator = new VersionComparator<Integer>() {
- @Override
- protected Integer parseSegment(int index, String s) {
- return Integer.valueOf(s);
- }
- @Override
- protected Integer getZero() {
- return Integer.valueOf(0);
- }
- };
+ Comparator<String> versionComparator = VersionComparator.INTEGER_VERSION_COMPARATOR;
assertTrue(versionComparator.compare("2.0.0", "2.0.1") < 0);
assertTrue(versionComparator.compare("2.5.0", "2.14") < 0);
assertTrue(versionComparator.compare("2.5.0", "2.5.0.0.1.0") < 0);
@@ -110,16 +92,7 @@ public class VersionComparatorTests
}
public void testVersionIsGreater_subclass() {
- Comparator<String> versionComparator = new VersionComparator<Integer>() {
- @Override
- protected Integer parseSegment(int index, String s) {
- return Integer.valueOf(s);
- }
- @Override
- protected Integer getZero() {
- return Integer.valueOf(0);
- }
- };
+ Comparator<String> versionComparator = VersionComparator.INTEGER_VERSION_COMPARATOR;
assertTrue(versionComparator.compare("2.0.2", "2.0.1") > 0);
assertTrue(versionComparator.compare("2.0.2", "2.0.1") > 0);
assertTrue(versionComparator.compare("2.5.0.0.1.0", "2.5.0") > 0);
@@ -138,40 +111,6 @@ public class VersionComparatorTests
assertTrue(exCaught);
}
- public void testBogusSubclass1() {
- Comparator<String> versionComparator = new VersionComparator<Integer>() {
- // bogus - must override parseSegment(...)
- @Override
- protected Integer getZero() {
- return Integer.valueOf(0);
- }
- };
- boolean exCaught = false;
- try {
- assertTrue(versionComparator.compare("2.0.0", "2.0.0") == 0);
- } catch (UnsupportedOperationException ex) {
- exCaught = true;
- }
- assertTrue(exCaught);
- }
-
- public void testBogusSubclass2() {
- Comparator<String> versionComparator = new VersionComparator<Integer>() {
- @Override
- protected Integer parseSegment(int index, String s) {
- return Integer.valueOf(s);
- }
- // bogus - must getZero()
- };
- boolean exCaught = false;
- try {
- assertTrue(versionComparator.compare("2.0.0", "2.0.0.0.0") == 0);
- } catch (UnsupportedOperationException ex) {
- exCaught = true;
- }
- assertTrue(exCaught);
- }
-
static final class DecimalSegmentParser
implements SegmentParser<BigDecimal>, Serializable
diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/BufferedWritablePropertyValueModelTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/BufferedModifiablePropertyValueModelTests.java
index 9e38380992..e94243bed3 100644
--- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/BufferedWritablePropertyValueModelTests.java
+++ b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/BufferedModifiablePropertyValueModelTests.java
@@ -14,7 +14,7 @@ import java.util.Date;
import junit.framework.TestCase;
import org.eclipse.jpt.common.utility.internal.model.AbstractModel;
-import org.eclipse.jpt.common.utility.internal.model.value.BufferedWritablePropertyValueModel;
+import org.eclipse.jpt.common.utility.internal.model.value.BufferedModifiablePropertyValueModel;
import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapter;
import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel;
import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent;
@@ -26,7 +26,9 @@ import org.eclipse.jpt.common.utility.model.value.ModifiablePropertyValueModel;
import org.eclipse.jpt.common.utility.tests.internal.TestTools;
@SuppressWarnings("nls")
-public class BufferedWritablePropertyValueModelTests extends TestCase {
+public class BufferedModifiablePropertyValueModelTests
+ extends TestCase
+{
private Employee employee;
private ModifiablePropertyValueModel<Employee> employeeHolder;
PropertyChangeEvent employeeEvent;
@@ -36,13 +38,13 @@ public class BufferedWritablePropertyValueModelTests extends TestCase {
private ModifiablePropertyValueModel<Date> hireDateAdapter;
PropertyChangeEvent adapterEvent;
- private BufferedWritablePropertyValueModel.Trigger trigger;
- private BufferedWritablePropertyValueModel<Integer> bufferedIDHolder;
- private BufferedWritablePropertyValueModel<String> bufferedNameHolder;
- private BufferedWritablePropertyValueModel<Date> bufferedHireDateHolder;
+ private BufferedModifiablePropertyValueModel.Trigger trigger;
+ private BufferedModifiablePropertyValueModel<Integer> bufferedIDHolder;
+ private BufferedModifiablePropertyValueModel<String> bufferedNameHolder;
+ private BufferedModifiablePropertyValueModel<Date> bufferedHireDateHolder;
PropertyChangeEvent bufferedEvent;
- public BufferedWritablePropertyValueModelTests(String name) {
+ public BufferedModifiablePropertyValueModelTests(String name) {
super(name);
}
@@ -53,16 +55,16 @@ public class BufferedWritablePropertyValueModelTests extends TestCase {
this.employee = new Employee(17, "Freddy", new Date());
this.employeeHolder = new SimplePropertyValueModel<Employee>(this.employee);
- this.trigger = new BufferedWritablePropertyValueModel.Trigger();
+ this.trigger = new BufferedModifiablePropertyValueModel.Trigger();
this.idAdapter = this.buildIDAdapter(this.employeeHolder);
- this.bufferedIDHolder = new BufferedWritablePropertyValueModel<Integer>(this.idAdapter, this.trigger);
+ this.bufferedIDHolder = new BufferedModifiablePropertyValueModel<Integer>(this.idAdapter, this.trigger);
this.nameAdapter = this.buildNameAdapter(this.employeeHolder);
- this.bufferedNameHolder = new BufferedWritablePropertyValueModel<String>(this.nameAdapter, this.trigger);
+ this.bufferedNameHolder = new BufferedModifiablePropertyValueModel<String>(this.nameAdapter, this.trigger);
this.hireDateAdapter = this.buildHireDateAdapter(this.employeeHolder);
- this.bufferedHireDateHolder = new BufferedWritablePropertyValueModel<Date>(this.hireDateAdapter, this.trigger);
+ this.bufferedHireDateHolder = new BufferedModifiablePropertyValueModel<Date>(this.hireDateAdapter, this.trigger);
}
private ModifiablePropertyValueModel<Integer> buildIDAdapter(PropertyValueModel<Employee> eHolder) {
@@ -425,7 +427,7 @@ public class BufferedWritablePropertyValueModelTests extends TestCase {
return new ChangeAdapter() {
@Override
public void propertyChanged(PropertyChangeEvent e) {
- BufferedWritablePropertyValueModelTests.this.bufferedEvent = e;
+ BufferedModifiablePropertyValueModelTests.this.bufferedEvent = e;
}
};
}
@@ -434,7 +436,7 @@ public class BufferedWritablePropertyValueModelTests extends TestCase {
return new ChangeAdapter() {
@Override
public void propertyChanged(PropertyChangeEvent e) {
- BufferedWritablePropertyValueModelTests.this.adapterEvent = e;
+ BufferedModifiablePropertyValueModelTests.this.adapterEvent = e;
}
};
}
@@ -443,7 +445,7 @@ public class BufferedWritablePropertyValueModelTests extends TestCase {
return new ChangeAdapter() {
@Override
public void propertyChanged(PropertyChangeEvent e) {
- BufferedWritablePropertyValueModelTests.this.employeeEvent = e;
+ BufferedModifiablePropertyValueModelTests.this.employeeEvent = e;
}
};
}
diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/FilteringPropertyValueModelTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/FilteringPropertyValueModelTests.java
index 8b2f4f0f86..d160814afa 100644
--- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/FilteringPropertyValueModelTests.java
+++ b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/FilteringPropertyValueModelTests.java
@@ -12,7 +12,7 @@ package org.eclipse.jpt.common.utility.tests.internal.model.value;
import junit.framework.TestCase;
import org.eclipse.jpt.common.utility.Filter;
import org.eclipse.jpt.common.utility.internal.model.AbstractModel;
-import org.eclipse.jpt.common.utility.internal.model.value.FilteringWritablePropertyValueModel;
+import org.eclipse.jpt.common.utility.internal.model.value.FilteringModifiablePropertyValueModel;
import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel;
import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent;
import org.eclipse.jpt.common.utility.model.listener.ChangeAdapter;
@@ -37,7 +37,7 @@ public class FilteringPropertyValueModelTests extends TestCase {
protected void setUp() throws Exception {
super.setUp();
this.objectHolder = new SimplePropertyValueModel<String>("foo");
- this.filteredObjectHolder = new FilteringWritablePropertyValueModel<String>(this.objectHolder, this.buildFilter(), this.buildSetFilter());
+ this.filteredObjectHolder = new FilteringModifiablePropertyValueModel<String>(this.objectHolder, this.buildFilter(), this.buildSetFilter());
}
private Filter<String> buildFilter() {
diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/JptUtilityModelValueTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/JptUtilityModelValueTests.java
index 8f256b46f3..6a08af27bd 100644
--- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/JptUtilityModelValueTests.java
+++ b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/JptUtilityModelValueTests.java
@@ -22,9 +22,9 @@ public class JptUtilityModelValueTests {
suite.addTest(JptUtilityModelValuePrefsTests.suite());
suite.addTest(JptUtilityModelValueSwingTests.suite());
- suite.addTestSuite(BufferedWritablePropertyValueModelTests.class);
+ suite.addTestSuite(BufferedModifiablePropertyValueModelTests.class);
suite.addTestSuite(CachingTransformationPropertyValueModelTests.class);
- suite.addTestSuite(CachingTransformationWritablePropertyValueModelTests.class);
+ suite.addTestSuite(TransformationModifiablePropertyValueModelTests.class);
suite.addTestSuite(CollectionAspectAdapterTests.class);
suite.addTestSuite(CollectionListValueModelAdapterTests.class);
suite.addTestSuite(CollectionPropertyValueModelAdapterTests.class);
@@ -50,7 +50,7 @@ public class JptUtilityModelValueTests {
suite.addTestSuite(PropertyAspectAdapterTests.class);
suite.addTestSuite(PropertyCollectionValueModelAdapterTests.class);
suite.addTestSuite(PropertyListValueModelAdapterTests.class);
- suite.addTestSuite(ReadOnlyWritablePropertyValueModelWrapperTests.class);
+ suite.addTestSuite(ReadOnlyModifiablePropertyValueModelWrapperTests.class);
suite.addTestSuite(SetCollectionValueModelTests.class);
suite.addTestSuite(SimpleCollectionValueModelTests.class);
suite.addTestSuite(SimpleListValueModelTests.class);
diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ReadOnlyWritablePropertyValueModelWrapperTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ReadOnlyModifiablePropertyValueModelWrapperTests.java
index b25ede951c..99d1de6ba6 100644
--- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ReadOnlyWritablePropertyValueModelWrapperTests.java
+++ b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ReadOnlyModifiablePropertyValueModelWrapperTests.java
@@ -12,7 +12,7 @@ package org.eclipse.jpt.common.utility.tests.internal.model.value;
import junit.framework.TestCase;
import org.eclipse.jpt.common.utility.internal.model.AbstractModel;
-import org.eclipse.jpt.common.utility.internal.model.value.ReadOnlyWritablePropertyValueModelWrapper;
+import org.eclipse.jpt.common.utility.internal.model.value.ReadOnlyModifiablePropertyValueModelWrapper;
import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel;
import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent;
import org.eclipse.jpt.common.utility.model.listener.ChangeAdapter;
@@ -22,7 +22,7 @@ import org.eclipse.jpt.common.utility.model.value.ModifiablePropertyValueModel;
import org.eclipse.jpt.common.utility.tests.internal.TestTools;
@SuppressWarnings("nls")
-public class ReadOnlyWritablePropertyValueModelWrapperTests
+public class ReadOnlyModifiablePropertyValueModelWrapperTests
extends TestCase
{
private ModifiablePropertyValueModel<String> objectHolder;
@@ -34,7 +34,7 @@ public class ReadOnlyWritablePropertyValueModelWrapperTests
PropertyChangeEvent wrapperEvent;
- public ReadOnlyWritablePropertyValueModelWrapperTests(String name) {
+ public ReadOnlyModifiablePropertyValueModelWrapperTests(String name) {
super(name);
}
@@ -43,7 +43,7 @@ public class ReadOnlyWritablePropertyValueModelWrapperTests
protected void setUp() throws Exception {
super.setUp();
this.objectHolder = new SimplePropertyValueModel<String>("foo");
- this.wrapperObjectHolder = new ReadOnlyWritablePropertyValueModelWrapper<String>(this.objectHolder);
+ this.wrapperObjectHolder = new ReadOnlyModifiablePropertyValueModelWrapper<String>(this.objectHolder);
}
@Override
@@ -134,7 +134,7 @@ public class ReadOnlyWritablePropertyValueModelWrapperTests
return new ChangeAdapter() {
@Override
public void propertyChanged(PropertyChangeEvent e) {
- ReadOnlyWritablePropertyValueModelWrapperTests.this.event = e;
+ ReadOnlyModifiablePropertyValueModelWrapperTests.this.event = e;
}
};
}
@@ -143,7 +143,7 @@ public class ReadOnlyWritablePropertyValueModelWrapperTests
return new ChangeAdapter() {
@Override
public void propertyChanged(PropertyChangeEvent e) {
- ReadOnlyWritablePropertyValueModelWrapperTests.this.wrapperEvent = e;
+ ReadOnlyModifiablePropertyValueModelWrapperTests.this.wrapperEvent = e;
}
};
}
diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CachingTransformationWritablePropertyValueModelTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/TransformationModifiablePropertyValueModelTests.java
index 7c711a316e..c00af5f22c 100644
--- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CachingTransformationWritablePropertyValueModelTests.java
+++ b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/TransformationModifiablePropertyValueModelTests.java
@@ -13,7 +13,7 @@ import junit.framework.TestCase;
import org.eclipse.jpt.common.utility.internal.Transformer;
import org.eclipse.jpt.common.utility.internal.model.AbstractModel;
import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.jpt.common.utility.internal.model.value.TransformationWritablePropertyValueModel;
+import org.eclipse.jpt.common.utility.internal.model.value.TransformationModifiablePropertyValueModel;
import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent;
import org.eclipse.jpt.common.utility.model.listener.ChangeAdapter;
import org.eclipse.jpt.common.utility.model.listener.ChangeListener;
@@ -22,7 +22,7 @@ import org.eclipse.jpt.common.utility.model.value.ModifiablePropertyValueModel;
import org.eclipse.jpt.common.utility.tests.internal.TestTools;
@SuppressWarnings("nls")
-public class CachingTransformationWritablePropertyValueModelTests
+public class TransformationModifiablePropertyValueModelTests
extends TestCase
{
private ModifiablePropertyValueModel<Person> objectHolder;
@@ -31,7 +31,7 @@ public class CachingTransformationWritablePropertyValueModelTests
private ModifiablePropertyValueModel<Person> transformationObjectHolder;
PropertyChangeEvent transformationEvent;
- public CachingTransformationWritablePropertyValueModelTests(String name) {
+ public TransformationModifiablePropertyValueModelTests(String name) {
super(name);
}
@@ -39,7 +39,7 @@ public class CachingTransformationWritablePropertyValueModelTests
protected void setUp() throws Exception {
super.setUp();
this.objectHolder = new SimplePropertyValueModel<Person>(new Person("Karen", "Peggy", null));
- this.transformationObjectHolder = new TransformationWritablePropertyValueModel<Person, Person>(this.objectHolder, this.buildTransformer(), this.buildReverseTransformer());
+ this.transformationObjectHolder = new TransformationModifiablePropertyValueModel<Person, Person>(this.objectHolder, this.buildTransformer(), this.buildReverseTransformer());
}
private Transformer<Person, Person> buildTransformer() {
@@ -190,7 +190,7 @@ public class CachingTransformationWritablePropertyValueModelTests
return new ChangeAdapter() {
@Override
public void propertyChanged(PropertyChangeEvent e) {
- CachingTransformationWritablePropertyValueModelTests.this.event = e;
+ TransformationModifiablePropertyValueModelTests.this.event = e;
}
};
}
@@ -199,7 +199,7 @@ public class CachingTransformationWritablePropertyValueModelTests
return new ChangeAdapter() {
@Override
public void propertyChanged(PropertyChangeEvent e) {
- CachingTransformationWritablePropertyValueModelTests.this.transformationEvent = e;
+ TransformationModifiablePropertyValueModelTests.this.transformationEvent = e;
}
};
}
diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/TransformationPropertyValueModelTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/TransformationPropertyValueModelTests.java
index 4c72608454..76b0265d93 100644
--- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/TransformationPropertyValueModelTests.java
+++ b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/TransformationPropertyValueModelTests.java
@@ -13,7 +13,7 @@ import junit.framework.TestCase;
import org.eclipse.jpt.common.utility.internal.Transformer;
import org.eclipse.jpt.common.utility.internal.model.AbstractModel;
import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.jpt.common.utility.internal.model.value.TransformationWritablePropertyValueModel;
+import org.eclipse.jpt.common.utility.internal.model.value.TransformationModifiablePropertyValueModel;
import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent;
import org.eclipse.jpt.common.utility.model.listener.ChangeAdapter;
import org.eclipse.jpt.common.utility.model.listener.ChangeListener;
@@ -39,7 +39,7 @@ public class TransformationPropertyValueModelTests
protected void setUp() throws Exception {
super.setUp();
this.objectHolder = new SimplePropertyValueModel<String>("foo");
- this.transformationObjectHolder = new TransformationWritablePropertyValueModel<String, String>(this.objectHolder, this.buildTransformer(), this.buildReverseTransformer());
+ this.transformationObjectHolder = new TransformationModifiablePropertyValueModel<String, String>(this.objectHolder, this.buildTransformer(), this.buildReverseTransformer());
}
private Transformer<String, String> buildTransformer() {
diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/META-INF/MANIFEST.MF b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/META-INF/MANIFEST.MF
index be182acf00..371e1a221c 100644
--- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/META-INF/MANIFEST.MF
+++ b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/META-INF/MANIFEST.MF
@@ -4,10 +4,12 @@ Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.jpt.dbws.eclipselink.core.gen;singleton:=true
Bundle-Version: 1.0.0.qualifier
+Bundle-ActivationPolicy: lazy
+Bundle-ClassPath: .
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Require-Bundle: org.eclipse.persistence.dbws.builder;bundle-version="[2.3.0,3.0.0)",
javax.wsdl;bundle-version="[1.6.2,2.0.0)"
+Import-Package: org.eclipse.persistence.oxm
Export-Package: org.eclipse.jpt.dbws.eclipselink.core.gen,
org.eclipse.jpt.dbws.eclipselink.core.gen.internal;x-internal:=true
-Import-Package: org.eclipse.persistence.oxm
diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/.classpath b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/.classpath
index 76f5da81fa..8f6b5b770f 100644
--- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/.classpath
+++ b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/.classpath
@@ -5,7 +5,9 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
<accessrules>
+ <accessrule kind="nonaccessible" pattern="org/eclipse/jpt/**/plugin/**"/>
<accessrule kind="accessible" pattern="org/eclipse/jpt/common/ui/**"/>
+ <accessrule kind="accessible" pattern="org/eclipse/jpt/common/core/**"/>
<accessrule kind="accessible" pattern="org/eclipse/jpt/common/utility/**"/>
<accessrule kind="accessible" pattern="org/eclipse/jst/**"/>
<accessrule kind="accessible" pattern="org/eclipse/wst/**"/>
diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/META-INF/MANIFEST.MF b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/META-INF/MANIFEST.MF
index 7afa8ef09c..91daa49d6f 100644
--- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/META-INF/MANIFEST.MF
+++ b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/META-INF/MANIFEST.MF
@@ -4,7 +4,7 @@ Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.jpt.dbws.eclipselink.ui;singleton:=true
Bundle-Version: 1.0.200.qualifier
-Bundle-Activator: org.eclipse.jpt.dbws.eclipselink.ui.JptDbwsUiPlugin
+Bundle-Activator: org.eclipse.jpt.dbws.eclipselink.ui.internal.plugin.JptDbwsEclipseLinkUiPlugin
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .
Bundle-Localization: plugin
@@ -24,7 +24,6 @@ Require-Bundle: org.eclipse.debug.core;bundle-version="[3.4.0,4.0.0)",
org.eclipse.wst.common.uriresolver;bundle-version="[1.1.401,2.0.0)",
org.eclipse.wst.xml.core;bundle-version="[1.1.500,2.0.0)"
Export-Package: org.eclipse.jpt.dbws.eclipselink.core.internal.gen;x-internal:=true,
- org.eclipse.jpt.dbws.eclipselink.ui,
org.eclipse.jpt.dbws.eclipselink.ui.internal;x-internal:=true,
org.eclipse.jpt.dbws.eclipselink.ui.internal.actions;x-internal:=true,
org.eclipse.jpt.dbws.eclipselink.ui.internal.wizards.gen;x-internal:=true
diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/JptDbwsUiPlugin.java b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/JptDbwsUiPlugin.java
deleted file mode 100644
index 25b0f74546..0000000000
--- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/JptDbwsUiPlugin.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2011 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.dbws.eclipselink.ui;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.eclipse.wst.xml.core.internal.XMLCorePlugin;
-import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalog;
-
-/**
- * The activator class controls the plug-in life cycle
- *
- *
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- */
-@SuppressWarnings("nls")
-public class JptDbwsUiPlugin extends AbstractUIPlugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.jpt.dbws.eclipselink.ui"; //$NON-NLS-1$
-
- public static final String USER_CATALOG_ID = XMLCorePlugin.USER_CATALOG_ID; //$NON-NLS-1$
- public static final String DEFAULT_CATALOG_ID = XMLCorePlugin.DEFAULT_CATALOG_ID; //$NON-NLS-1$
- public static final String SYSTEM_CATALOG_ID = XMLCorePlugin.SYSTEM_CATALOG_ID; //$NON-NLS-1$
-
- // ********** singleton **********
- private static JptDbwsUiPlugin INSTANCE;
-
- /**
- * Returns the singleton Plugin
- */
- public static JptDbwsUiPlugin instance() {
- return INSTANCE;
- }
-
- public static void log(IStatus status) {
- INSTANCE.getLog().log(status);
- }
-
- public static void log(String msg) {
- log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, msg, null));
- }
-
- public static void log(Throwable throwable) {
- log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, throwable.getLocalizedMessage(), throwable));
- }
-
- // ********** Image API **********
- /**
- * This gets a .gif from the icons folder.
- */
- public static ImageDescriptor getImageDescriptor(String key) {
- if (! key.startsWith("icons/")) {
- key = "icons/" + key;
- }
- if (! key.endsWith(".gif")) {
- key = key + ".gif";
- }
- return imageDescriptorFromPlugin(PLUGIN_ID, key);
- }
-
- /**
- * This returns an image for a .gif from the icons folder
- */
- //TODO we are using the ImageRegistry here and storing all our icons for the life of the plugin,
- //which means until the workspace is closed. This is better than before where we constantly
- //created new images. Bug 306437 is about cleaning this up and using Local Resource Managers
- //on our views so that closing the JPA perspective would mean our icons are disposed.
- public static Image getImage(String key) {
- ImageRegistry imageRegistry = instance().getImageRegistry();
- Image image = imageRegistry.get(key);
- if (image == null) {
- imageRegistry.put(key, getImageDescriptor(key));
- image = imageRegistry.get(key);
- }
- return image;
- }
-
-
- // ********** XMLCorePlugin API **********
-
- public ICatalog getDefaultXMLCatalog() {
- return XMLCorePlugin.getDefault().getDefaultXMLCatalog();
- }
-
-
- // ********** constructors **********
-
- public JptDbwsUiPlugin() {
- super();
- if(INSTANCE != null) {
- throw new IllegalStateException();
- }
- INSTANCE = this;
- }
-}
diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/DbwsGeneratorUi.java b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/DbwsGeneratorUi.java
index 8ca85f0a91..be3f3dd164 100644
--- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/DbwsGeneratorUi.java
+++ b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/DbwsGeneratorUi.java
@@ -11,7 +11,6 @@ package org.eclipse.jpt.dbws.eclipselink.ui.internal;
import java.io.File;
import java.util.Map;
-
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.WorkspaceJob;
@@ -28,7 +27,7 @@ import org.eclipse.jpt.common.core.gen.JptGenerator;
import org.eclipse.jpt.common.ui.gen.AbstractJptGenerateJob;
import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.dbws.eclipselink.core.internal.gen.DbwsGenerator;
-import org.eclipse.jpt.dbws.eclipselink.ui.JptDbwsUiPlugin;
+import org.eclipse.jpt.dbws.eclipselink.ui.internal.plugin.JptDbwsEclipseLinkUiPlugin;
import org.eclipse.jpt.dbws.eclipselink.ui.internal.wizards.gen.DbwsGeneratorWizard;
import org.eclipse.persistence.oxm.XMLContext;
import org.eclipse.persistence.oxm.XMLUnmarshaller;
@@ -77,7 +76,7 @@ public class DbwsGeneratorUi
catch (CoreException e) {
return false;
}
- return (facetedProject == null) ? false : facetedProject.hasProjectFacet(projectFacet);
+ return (facetedProject != null) && facetedProject.hasProjectFacet(projectFacet);
}
public static IPath getWebContentPath(IProject project){
@@ -281,8 +280,7 @@ public class DbwsGeneratorUi
@Override
protected void jptPluginLogException(Exception exception) {
- JptDbwsUiPlugin.log(exception);
+ JptDbwsEclipseLinkUiPlugin.instance().logError(exception);
}
-
}
}
diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/plugin/JptDbwsEclipseLinkUiPlugin.java b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/plugin/JptDbwsEclipseLinkUiPlugin.java
new file mode 100644
index 0000000000..512c74cee2
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/plugin/JptDbwsEclipseLinkUiPlugin.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012 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.dbws.eclipselink.ui.internal.plugin;
+
+import org.eclipse.jpt.common.core.internal.utility.JptPlugin;
+import org.eclipse.jpt.common.ui.internal.JptUIPlugin;
+
+public class JptDbwsEclipseLinkUiPlugin
+ extends JptUIPlugin
+{
+ // ********** singleton **********
+
+ private static volatile JptDbwsEclipseLinkUiPlugin INSTANCE;
+
+ /**
+ * Return the singleton Dali DBWS EclipseLink UI plug-in.
+ */
+ public static JptDbwsEclipseLinkUiPlugin instance() {
+ return INSTANCE;
+ }
+
+
+ // ********** Dali plug-in **********
+
+ public JptDbwsEclipseLinkUiPlugin() {
+ super();
+ }
+
+ @Override
+ protected void setInstance(JptPlugin plugin) {
+ INSTANCE = (JptDbwsEclipseLinkUiPlugin) plugin;
+ }
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/DbwsGeneratorWizard.java b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/DbwsGeneratorWizard.java
index 327a463419..9902ad2eb6 100644
--- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/DbwsGeneratorWizard.java
+++ b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/DbwsGeneratorWizard.java
@@ -1,12 +1,12 @@
/*******************************************************************************
-* Copyright (c) 2010, 2012 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
-*******************************************************************************/
+ * Copyright (c) 2010, 2012 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.dbws.eclipselink.ui.internal.wizards.gen;
import org.eclipse.core.resources.IFile;
@@ -20,10 +20,10 @@ import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.jpt.dbws.eclipselink.ui.JptDbwsUiPlugin;
import org.eclipse.jpt.dbws.eclipselink.ui.internal.DbwsGeneratorUi;
import org.eclipse.jpt.dbws.eclipselink.ui.internal.JptDbwsUiIcons;
import org.eclipse.jpt.dbws.eclipselink.ui.internal.JptDbwsUiMessages;
+import org.eclipse.jpt.dbws.eclipselink.ui.internal.plugin.JptDbwsEclipseLinkUiPlugin;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchWizard;
@@ -64,7 +64,7 @@ public class DbwsGeneratorWizard extends Wizard implements IWorkbenchWizard {
private void initialize() {
if(this.getDialogSettings() == null) {
- IDialogSettings dbwsSettings = JptDbwsUiPlugin.instance().getDialogSettings();
+ IDialogSettings dbwsSettings = JptDbwsEclipseLinkUiPlugin.instance().getDialogSettings();
IDialogSettings wizardSettings = dbwsSettings.getSection(DBWS_SECTION_NAME);
if(wizardSettings == null) {
wizardSettings = dbwsSettings.addNewSection(DBWS_SECTION_NAME);
@@ -80,7 +80,7 @@ public class DbwsGeneratorWizard extends Wizard implements IWorkbenchWizard {
this.setWindowTitle(JptDbwsUiMessages.DbwsGeneratorWizard_title);
- this.setDefaultPageImageDescriptor(JptDbwsUiPlugin.getImageDescriptor(JptDbwsUiIcons.DBWS_GEN_WIZ_BANNER));
+ this.setDefaultPageImageDescriptor(JptDbwsEclipseLinkUiPlugin.instance().buildImageDescriptor(JptDbwsUiIcons.DBWS_GEN_WIZ_BANNER));
this.setNeedsProgressMonitor(true);
}
diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/JdbcDriverWizardPage.java b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/JdbcDriverWizardPage.java
index 8f5c9d1f07..66f45847b1 100644
--- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/JdbcDriverWizardPage.java
+++ b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/JdbcDriverWizardPage.java
@@ -1,12 +1,12 @@
/*******************************************************************************
-* Copyright (c) 2010, 2011 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
-*******************************************************************************/
+ * Copyright (c) 2010, 2012 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.dbws.eclipselink.ui.internal.wizards.gen;
import java.io.File;
@@ -30,9 +30,9 @@ import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
import org.eclipse.jpt.common.ui.internal.util.TableLayoutComposite;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.dbws.eclipselink.ui.JptDbwsUiPlugin;
import org.eclipse.jpt.dbws.eclipselink.ui.internal.JptDbwsUiIcons;
import org.eclipse.jpt.dbws.eclipselink.ui.internal.JptDbwsUiMessages;
+import org.eclipse.jpt.dbws.eclipselink.ui.internal.plugin.JptDbwsEclipseLinkUiPlugin;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
@@ -74,7 +74,7 @@ public class JdbcDriverWizardPage extends WizardPage
protected void initialize() {
this.setTitle(JptDbwsUiMessages.JdbcDriverWizardPage_title);
this.setDescription(JptDbwsUiMessages.JdbcDriverWizardPage_desc);
- this.setImageDescriptor(JptDbwsUiPlugin.getImageDescriptor(JptDbwsUiIcons.DBWS_GEN_WIZ_BANNER));
+ this.setImageDescriptor(JptDbwsEclipseLinkUiPlugin.instance().buildImageDescriptor(JptDbwsUiIcons.DBWS_GEN_WIZ_BANNER));
}
// ********** intra-wizard methods **********
diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/SelectFileOrXMLCatalogIdPanel.java b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/SelectFileOrXMLCatalogIdPanel.java
index 7f36cc306f..f848ea46b5 100644
--- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/SelectFileOrXMLCatalogIdPanel.java
+++ b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/SelectFileOrXMLCatalogIdPanel.java
@@ -17,7 +17,7 @@ import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jpt.dbws.eclipselink.ui.JptDbwsUiPlugin;
+import org.eclipse.jpt.dbws.eclipselink.ui.internal.plugin.JptDbwsEclipseLinkUiPlugin;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
@@ -26,6 +26,7 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.part.PageBook;
+import org.eclipse.wst.xml.core.internal.XMLCorePlugin;
import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalog;
@@ -60,7 +61,7 @@ public class SelectFileOrXMLCatalogIdPanel extends Composite implements Selectio
this.setSingleFileViewDefaultSelection(selection);
// Catalog
- ICatalog xmlCatalog = JptDbwsUiPlugin.instance().getDefaultXMLCatalog();
+ ICatalog xmlCatalog = XMLCorePlugin.getDefault().getDefaultXMLCatalog();
selectXMLCatalogIdPanel = new SelectXMLCatalogIdPanel(pageBook, xmlCatalog);
selectXMLCatalogIdPanel.getTableViewer().addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/SelectXMLCatalogIdPanel.java b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/SelectXMLCatalogIdPanel.java
index 3e1ec46a64..536c1bcf52 100644
--- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/SelectXMLCatalogIdPanel.java
+++ b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/SelectXMLCatalogIdPanel.java
@@ -14,16 +14,16 @@ package org.eclipse.jpt.dbws.eclipselink.ui.internal.wizards.gen;
import java.util.Collection;
import java.util.List;
import java.util.Vector;
-
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jpt.dbws.eclipselink.ui.JptDbwsUiPlugin;
import org.eclipse.jpt.dbws.eclipselink.ui.internal.JptDbwsUiMessages;
+import org.eclipse.jpt.dbws.eclipselink.ui.internal.plugin.JptDbwsEclipseLinkUiPlugin;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
+import org.eclipse.wst.xml.core.internal.XMLCorePlugin;
import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalog;
import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalogEntry;
import org.eclipse.wst.xml.core.internal.catalog.provisional.INextCatalog;
@@ -95,12 +95,12 @@ public class SelectXMLCatalogIdPanel extends Composite {
INextCatalog catalog = nextCatalogs[i];
ICatalog referencedCatalog = catalog.getReferencedCatalog();
if (referencedCatalog != null) {
- if (JptDbwsUiPlugin.SYSTEM_CATALOG_ID.equals(referencedCatalog.getId())) {
+ if (XMLCorePlugin.SYSTEM_CATALOG_ID.equals(referencedCatalog.getId())) {
ICatalog systemCatalog = referencedCatalog;
addXMLCatalogEntries(result, systemCatalog.getCatalogEntries());
}
- else if (JptDbwsUiPlugin.USER_CATALOG_ID.equals(referencedCatalog.getId())) {
+ else if (XMLCorePlugin.USER_CATALOG_ID.equals(referencedCatalog.getId())) {
ICatalog userCatalog = referencedCatalog;
addXMLCatalogEntries(result, userCatalog.getCatalogEntries());
diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/XMLCatalogTableViewer.java b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/XMLCatalogTableViewer.java
index c556561adf..7947401523 100644
--- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/XMLCatalogTableViewer.java
+++ b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/wizards/gen/XMLCatalogTableViewer.java
@@ -25,7 +25,7 @@ import org.eclipse.jface.viewers.TableLayout;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.jpt.dbws.eclipselink.ui.JptDbwsUiPlugin;
+import org.eclipse.jpt.dbws.eclipselink.ui.internal.plugin.JptDbwsEclipseLinkUiPlugin;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
@@ -40,10 +40,10 @@ public class XMLCatalogTableViewer extends TableViewer {
protected static String ERROR_STATE_KEY = "errorstatekey"; //$NON-NLS-1$
- protected static Image dtdFileImage = JptDbwsUiPlugin.getImage("icons/full/obj16/dtdfile.gif"); //$NON-NLS-1$
- protected static Image unknownFileImage = JptDbwsUiPlugin.getImage("icons/full/obj16/text.gif"); //$NON-NLS-1$
- protected static Image xsdFileImage = JptDbwsUiPlugin.getImage("icons/full/obj16/XSDFile.gif"); //$NON-NLS-1$
- protected static Image errorImage = JptDbwsUiPlugin.getImage("icons/full/ovr16/error_ovr.gif"); //$NON-NLS-1$
+ protected static Image dtdFileImage = JptDbwsEclipseLinkUiPlugin.instance().getImage("full/obj16/dtdfile"); //$NON-NLS-1$
+ protected static Image unknownFileImage = JptDbwsEclipseLinkUiPlugin.instance().getImage("full/obj16/text"); //$NON-NLS-1$
+ protected static Image xsdFileImage = JptDbwsEclipseLinkUiPlugin.instance().getImage("full/obj16/XSDFile"); //$NON-NLS-1$
+ protected static Image errorImage = JptDbwsEclipseLinkUiPlugin.instance().getImage("full/ovr16/error_ovr"); //$NON-NLS-1$
// ********** constructor **********
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/META-INF/MANIFEST.MF b/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/META-INF/MANIFEST.MF
index 6bb4d25868..f525152176 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/META-INF/MANIFEST.MF
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/META-INF/MANIFEST.MF
@@ -4,6 +4,8 @@ Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.jpt.jaxb.core.schemagen;singleton:=true
Bundle-Version: 1.0.200.qualifier
+Bundle-ActivationPolicy: lazy
+Bundle-ClassPath: .
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Import-Package: javax.xml.bind
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/GenericJaxbProjectManager.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/GenericJaxbProjectManager.java
index d8fbf291a5..0dc40cf9d9 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/GenericJaxbProjectManager.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/GenericJaxbProjectManager.java
@@ -150,7 +150,7 @@ class GenericJaxbProjectManager
implements ExceptionHandler
{
public void handleException(Throwable t) {
- JptJaxbCorePlugin.log(t);
+ JptJaxbCorePlugin.instance().logError(t);
}
@Override
public String toString() {
@@ -241,7 +241,7 @@ class GenericJaxbProjectManager
FacetedProjectFramework.addListener(this.facetedProjectListener, FACETED_PROJECT_EVENT_TYPES);
JavaCore.addElementChangedListener(this.javaElementChangeListener, JAVA_CHANGE_EVENT_TYPES);
} catch (RuntimeException ex) {
- JptJaxbCorePlugin.log(ex);
+ JptJaxbCorePlugin.instance().logError(ex);
this.stop_();
}
}
@@ -255,7 +255,7 @@ class GenericJaxbProjectManager
} catch (CoreException ex) {
// if we have a problem, leave the currently built JAXB projects in
// place and keep executing (should be OK...)
- JptJaxbCorePlugin.log(ex);
+ JptJaxbCorePlugin.instance().logError(ex);
}
}
@@ -420,7 +420,7 @@ class GenericJaxbProjectManager
return platformDefinition.getFactory().buildJaxbProject(config);
}
catch (RuntimeException ex) {
- JptJaxbCorePlugin.log(ex);
+ JptJaxbCorePlugin.instance().logError(ex);
return null;
}
}
@@ -777,7 +777,7 @@ class GenericJaxbProjectManager
GenericJaxbProjectManager.this.lock.acquire();
this.execute_();
} catch (RuntimeException ex) {
- JptJaxbCorePlugin.log(ex);
+ JptJaxbCorePlugin.instance().logError(ex);
} finally {
GenericJaxbProjectManager.this.lock.release();
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JaxbFacet.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JaxbFacet.java
index 1f647ca770..80fe7000ec 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JaxbFacet.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JaxbFacet.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2010 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
- *******************************************************************************/
+ * Copyright (c) 2010, 2012 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.jaxb.core;
import org.eclipse.core.resources.IProject;
@@ -42,7 +42,7 @@ public class JaxbFacet {
return FacetedProjectFramework.hasProjectFacet(project, ID);
}
catch (CoreException e) {
- JptJaxbCorePlugin.log(e);
+ JptJaxbCorePlugin.instance().logError(e);
return false;
}
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JptJaxbCorePlugin.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JptJaxbCorePlugin.java
index c284fecf9f..f57bc70e1f 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JptJaxbCorePlugin.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JptJaxbCorePlugin.java
@@ -1,129 +1,86 @@
/*******************************************************************************
- * Copyright (c) 2010, 2012 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
- *******************************************************************************/
+ * Copyright (c) 2010, 2012 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.jaxb.core;
import java.util.List;
-
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.common.core.JptResourceType;
+import org.eclipse.jpt.common.core.internal.utility.JptPlugin;
import org.eclipse.jpt.jaxb.core.internal.platform.JaxbPlatformManagerImpl;
import org.eclipse.jpt.jaxb.core.internal.prefs.JaxbPreferencesManager;
import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription;
import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformManager;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.osgi.framework.BundleContext;
import org.osgi.service.prefs.Preferences;
-/**
- * The Dali JAXB core plug-in lifecycle implementation.
- * A number of globally-available constants and methods.
- * <p>
- * Provisional API: This class is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- *
- * @version 3.0
- * @since 3.0
- */
public class JptJaxbCorePlugin
- extends Plugin {
+ extends JptPlugin
+{
+ private volatile GenericJaxbProjectManager projectManager;
- // ********** public constants **********
-
- /**
- * The plug-in identifier of Dali JAXB core
- * (value <code>"org.eclipse.jpt.jaxb.core"</code>).
- */
- public static final String PLUGIN_ID = "org.eclipse.jpt.jaxb.core"; //$NON-NLS-1$
- public static final String PLUGIN_ID_ = PLUGIN_ID + '.';
- /**
- * The identifier for the JAXB validation marker
- * (value <code>"org.eclipse.jpt.jaxb.core.jaxbProblemMarker"</code>).
- */
- public static final String VALIDATION_MARKER_ID = PLUGIN_ID + ".jaxbProblemMarker"; //$NON-NLS-1$
+ // ********** singleton **********
- /**
- * The content type for jaxb.index files
- */
- public static final IContentType JAXB_INDEX_CONTENT_TYPE = getJaxbContentType("jaxbIndex");
-
- /**
- * The resource type for jaxb.index files
- */
- public static final JptResourceType JAXB_INDEX_RESOURCE_TYPE = new JptResourceType(JAXB_INDEX_CONTENT_TYPE);
-
- /**
- * The content type for jaxb.properties files
- */
- public static final IContentType JAXB_PROPERTIES_CONTENT_TYPE = getJaxbContentType("jaxbProperties");
-
- /**
- * The resource type for jaxb.properties files
- */
- public static final JptResourceType JAXB_PROPERTIES_RESOURCE_TYPE = new JptResourceType(JAXB_PROPERTIES_CONTENT_TYPE);
-
- private static IContentType getJaxbContentType(String contentType) {
- return getContentType(CONTENT_PREFIX_ + contentType);
- }
-
- public static final String CONTENT_PREFIX = PLUGIN_ID_ + "content"; //$NON-NLS-1$
-
- public static final String CONTENT_PREFIX_ = CONTENT_PREFIX + '.';
-
- private static IContentType getContentType(String contentType) {
- return Platform.getContentTypeManager().getContentType(contentType);
- }
-
-
- // **************** fields ************************************************
-
- private volatile GenericJaxbProjectManager projectManager;
-
-
- // **************** singleton *********************************************
-
private static JptJaxbCorePlugin INSTANCE;
-
+
/**
- * Return the singleton plug-in
+ * Return the Dali JAXB core plug-in.
*/
public static JptJaxbCorePlugin instance() {
return INSTANCE;
}
-
-
- // ********** public static methods **********
+
+
+ // ********** Dali plug-in **********
+
+ public JptJaxbCorePlugin() {
+ super();
+ }
+
+ @Override
+ protected void setInstance(JptPlugin plugin) {
+ INSTANCE = (JptJaxbCorePlugin) plugin;
+ }
+
+ @Override
+ protected void stop_() throws Exception {
+ try {
+ if (this.projectManager != null) {
+ this.projectManager.stop();
+ this.projectManager = null;
+ }
+ } finally {
+ super.stop_();
+ }
+ }
+
+
+ // ********** project manager **********
/**
* Return the singular JAXB project manager corresponding to the current workspace.
*/
- public static JaxbProjectManager getProjectManager() {
- return INSTANCE.getProjectManager_();
+ public synchronized JaxbProjectManager getProjectManager() {
+ if ((this.projectManager == null) && this.isActive()) {
+ this.projectManager = this.buildProjectManager();
+ this.projectManager.start();
+ }
+ return this.projectManager;
}
- /**
- * Return the JAXB project corresponding to the specified Eclipse project,
- * or <code>null</code> if unable to associate the specified project with a
- * JAXB project.
- */
- public static JaxbProject getJaxbProject(IProject project) {
- return getProjectManager().getJaxbProject(project);
+ private GenericJaxbProjectManager buildProjectManager() {
+ return new GenericJaxbProjectManager();
}
+
+
+ // ********** public static methods **********
public static JaxbPlatformManager getJaxbPlatformManager() {
return JaxbPlatformManagerImpl.instance();
@@ -230,67 +187,4 @@ public class JptJaxbCorePlugin
public static void setSchemaLocations(IProject project, List<String> schemaLocations) {
(new JaxbPreferencesManager(project)).setSchemaLocations(schemaLocations);
}
-
- /**
- * Log the specified status.
- */
- public static void log(IStatus status) {
- INSTANCE.getLog().log(status);
- }
-
- /**
- * Log the specified message.
- */
- public static void log(String msg) {
- log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, msg, null));
- }
-
- /**
- * Log the specified exception or error.
- */
- public static void log(Throwable throwable) {
- log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, throwable.getLocalizedMessage(), throwable));
- }
-
-
- // ********** plug-in implementation **************************************************
-
- public JptJaxbCorePlugin() {
- super();
- if (INSTANCE != null) {
- throw new IllegalStateException();
- }
- // this convention is *wack*... ~bjv
- INSTANCE = this;
- }
-
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- // nothing yet...
- }
-
- @Override
- public void stop(BundleContext context) throws Exception {
- try {
- if (this.projectManager != null) {
- this.projectManager.stop();
- this.projectManager = null;
- }
- } finally {
- super.stop(context);
- }
- }
-
- private synchronized GenericJaxbProjectManager getProjectManager_() {
- if (this.projectManager == null) {
- this.projectManager = this.buildProjectManager();
- this.projectManager.start();
- }
- return this.projectManager;
- }
-
- private GenericJaxbProjectManager buildProjectManager() {
- return new GenericJaxbProjectManager();
- }
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbContextNode.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbContextNode.java
index 9918f02d62..67cb961f77 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbContextNode.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbContextNode.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2012 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.
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jaxb.core.context;
-import org.eclipse.jpt.common.core.JptResourceType;
+import org.eclipse.jpt.common.core.JptResourceTypeReference;
import org.eclipse.jpt.jaxb.core.JaxbNode;
/**
@@ -26,18 +26,13 @@ import org.eclipse.jpt.jaxb.core.JaxbNode;
* @since 3.0
*/
public interface JaxbContextNode
- extends JaxbNode {
+ extends JaxbNode, JptResourceTypeReference {
/**
* Return the root of the context model
*/
JaxbContextRoot getContextRoot();
- /**
- * Return the resource type of the context node's resource.
- */
- JptResourceType getResourceType();
-
// ********** updating **********
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/AbstractJaxbProject.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/AbstractJaxbProject.java
index 8a3575ba13..788cf013e5 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/AbstractJaxbProject.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/AbstractJaxbProject.java
@@ -34,7 +34,6 @@ import org.eclipse.jdt.core.IPackageDeclaration;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
import org.eclipse.jpt.common.core.JptResourceModel;
import org.eclipse.jpt.common.core.JptResourceModelListener;
import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
@@ -43,6 +42,7 @@ import org.eclipse.jpt.common.core.resource.java.JavaResourceAbstractType;
import org.eclipse.jpt.common.core.resource.java.JavaResourceCompilationUnit;
import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.common.core.resource.java.JavaResourcePackage;
+import org.eclipse.jpt.common.core.resource.java.JavaResourcePackageFragmentRoot;
import org.eclipse.jpt.common.core.resource.java.JavaResourcePackageInfoCompilationUnit;
import org.eclipse.jpt.common.utility.command.Command;
import org.eclipse.jpt.common.utility.command.ExtendedCommandExecutor;
@@ -401,7 +401,7 @@ public abstract class AbstractJaxbProject
catch (Exception e) {
//log any developer exceptions and don't build a JaxbFile rather
//than completely failing to build the JaxbProject
- JptJaxbCorePlugin.log(e);
+ JptJaxbCorePlugin.instance().logError(e);
}
if (jaxbFile == null) {
return null;
@@ -415,8 +415,8 @@ public abstract class AbstractJaxbProject
protected boolean isJavaFile(IFile file) {
IContentType contentType = PlatformTools.getContentType(file);
return contentType != null
- && (contentType.isKindOf(JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE)
- || contentType.isKindOf(JptCommonCorePlugin.JAR_CONTENT_TYPE));
+ && (contentType.isKindOf(JavaResourceCompilationUnit.CONTENT_TYPE)
+ || contentType.isKindOf(JavaResourcePackageFragmentRoot.JAR_CONTENT_TYPE));
}
/* (non-java resource) file is in acceptable resource location */
@@ -585,7 +585,7 @@ public abstract class AbstractJaxbProject
return EmptyIterable.instance();
}
- if (contentType.isKindOf(JptCommonCorePlugin.JAVA_SOURCE_PACKAGE_INFO_CONTENT_TYPE)) {
+ if (contentType.isKindOf(JavaResourceCompilationUnit.PACKAGE_INFO_CONTENT_TYPE)) {
try {
return new FilteringIterable<JaxbPackageInfo>(
new TransformationIterable<IPackageDeclaration, JaxbPackageInfo>(
@@ -602,7 +602,7 @@ public abstract class AbstractJaxbProject
return EmptyIterable.instance();
}
}
- else if (contentType.isKindOf(JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE)) {
+ else if (contentType.isKindOf(JavaResourceCompilationUnit.CONTENT_TYPE)) {
try {
return new FilteringIterable<JaxbType>(
new TransformationIterable<IType, JaxbType>(
@@ -628,7 +628,7 @@ public abstract class AbstractJaxbProject
return (IFile) cu.getCorrespondingResource();
}
catch (JavaModelException ex) {
- JptJaxbCorePlugin.log(ex);
+ JptJaxbCorePlugin.instance().logError(ex);
return null;
}
}
@@ -713,7 +713,7 @@ public abstract class AbstractJaxbProject
* return JAXB files with Java source "content"
*/
protected Iterable<JaxbFile> getJavaSourceJaxbFiles() {
- return this.getJaxbFiles(JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE);
+ return this.getJaxbFiles(JavaResourceCompilationUnit.CONTENT_TYPE);
}
@@ -762,7 +762,7 @@ public abstract class AbstractJaxbProject
* return JPA files with package-info source "content"
*/
protected Iterable<JaxbFile> getPackageInfoSourceJaxbFiles() {
- return this.getJaxbFiles(JptCommonCorePlugin.JAVA_SOURCE_PACKAGE_INFO_CONTENT_TYPE);
+ return this.getJaxbFiles(JavaResourceCompilationUnit.PACKAGE_INFO_CONTENT_TYPE);
}
@@ -905,7 +905,7 @@ public abstract class AbstractJaxbProject
// **************** jaxb.index resources **********************************
public Iterable<JaxbIndexResource> getJaxbIndexResources() {
- return new TransformationIterable<JaxbFile, JaxbIndexResource>(getJaxbFiles(JptJaxbCorePlugin.JAXB_INDEX_CONTENT_TYPE)) {
+ return new TransformationIterable<JaxbFile, JaxbIndexResource>(getJaxbFiles(JaxbIndexResource.CONTENT_TYPE)) {
@Override
protected JaxbIndexResource transform(JaxbFile o) {
return (JaxbIndexResource) o.getResourceModel();
@@ -926,7 +926,7 @@ public abstract class AbstractJaxbProject
// **************** jaxb.properties resources *****************************
public Iterable<JaxbPropertiesResource> getJaxbPropertiesResources() {
- return new TransformationIterable<JaxbFile, JaxbPropertiesResource>(getJaxbFiles(JptJaxbCorePlugin.JAXB_PROPERTIES_CONTENT_TYPE)) {
+ return new TransformationIterable<JaxbFile, JaxbPropertiesResource>(getJaxbFiles(JaxbPropertiesResource.CONTENT_TYPE)) {
@Override
protected JaxbPropertiesResource transform(JaxbFile o) {
return (JaxbPropertiesResource) o.getResourceModel();
@@ -1173,8 +1173,8 @@ public abstract class AbstractJaxbProject
facetedProject = ProjectFacetsManager.create(getProject());
}
catch (CoreException ce) {
- // fall through
- JptJaxbCorePlugin.log(ce);
+ JptJaxbCorePlugin.instance().logError(ce);
+ return;
}
IProjectFacetVersion facetVersion = facetedProject.getInstalledVersion(JaxbFacet.FACET);
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/JavaElementAdapterFactory.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/JavaElementAdapterFactory.java
index df776cf336..764284edb3 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/JavaElementAdapterFactory.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/JavaElementAdapterFactory.java
@@ -17,7 +17,7 @@ import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription;
* Factory to build Dali adapters for an {@link IJavaElement}:<ul>
* <li>{@link JaxbPlatformDescription}
* </ul>
- * See <code>org.eclipse.jpt.jaxb.core/plugin.xml</code>.
+ * See <code>org.eclipse.jpt.jaxb.core/plugin.xml:org.eclipse.core.runtime.adapters</code>.
*/
public class JavaElementAdapterFactory
implements IAdapterFactory
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/JavaPackageInfoResourceModelProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/JavaPackageInfoResourceModelProvider.java
index 82ca5ea88d..214d3d341b 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/JavaPackageInfoResourceModelProvider.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/JavaPackageInfoResourceModelProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2012 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.
@@ -14,7 +14,6 @@ import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
import org.eclipse.jpt.common.core.internal.resource.java.source.SourcePackageInfoCompilationUnit;
import org.eclipse.jpt.common.core.resource.java.JavaResourceCompilationUnit;
import org.eclipse.jpt.jaxb.core.JaxbProject;
@@ -45,7 +44,7 @@ public class JavaPackageInfoResourceModelProvider
}
public IContentType getContentType() {
- return JptCommonCorePlugin.JAVA_SOURCE_PACKAGE_INFO_CONTENT_TYPE;
+ return JavaResourceCompilationUnit.PACKAGE_INFO_CONTENT_TYPE;
}
public JavaResourceCompilationUnit buildResourceModel(JaxbProject jaxbProject, IFile file) {
@@ -62,7 +61,7 @@ public class JavaPackageInfoResourceModelProvider
//it doesn't have package declaration and can't hold annotations
return null;
} catch (JavaModelException e) {
- JptJaxbCorePlugin.log(e);
+ JptJaxbCorePlugin.instance().logError(e);
// Ignore -- project is in a bad state. This will get recalled if necessary
return null;
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/JavaResourceModelProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/JavaResourceModelProvider.java
index 4066f112c8..2fd3fbc884 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/JavaResourceModelProvider.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/JavaResourceModelProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2012 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.
@@ -12,7 +12,6 @@ package org.eclipse.jpt.jaxb.core.internal;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
import org.eclipse.jpt.common.core.internal.resource.java.source.SourceTypeCompilationUnit;
import org.eclipse.jpt.common.core.resource.java.JavaResourceCompilationUnit;
import org.eclipse.jpt.jaxb.core.JaxbProject;
@@ -42,7 +41,7 @@ public class JavaResourceModelProvider
}
public IContentType getContentType() {
- return JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE;
+ return JavaResourceCompilationUnit.CONTENT_TYPE;
}
public JavaResourceCompilationUnit buildResourceModel(JaxbProject jaxbProject, IFile file) {
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/ResourceAdapterFactory.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/ResourceAdapterFactory.java
index 85857f5824..9987f01e10 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/ResourceAdapterFactory.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/ResourceAdapterFactory.java
@@ -18,7 +18,7 @@ import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription;
* Factory to build Dali adapters for an {@link IResource}:<ul>
* <li>{@link JaxbPlatformDescription}
* </ul>
- * See <code>org.eclipse.jpt.jaxb.core/plugin.xml</code>.
+ * See <code>org.eclipse.jpt.jaxb.core/plugin.xml:org.eclipse.core.runtime.adapters</code>.
*/
public class ResourceAdapterFactory
implements IAdapterFactory
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/JaxbPackageAdapterFactory.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/JaxbPackageAdapterFactory.java
index c918a9e0ad..8369a79d11 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/JaxbPackageAdapterFactory.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/JaxbPackageAdapterFactory.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
+ * Copyright (c) 2012 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.jaxb.core.internal.context;
import org.eclipse.core.runtime.IAdapterFactory;
@@ -41,7 +41,7 @@ public class JaxbPackageAdapterFactory
}
private JaxbPackage getJaxbPackage(IPackageFragment packageFragment) {
- JaxbProject jaxbProject = JptJaxbCorePlugin.getJaxbProject(packageFragment.getJavaProject().getProject());
+ JaxbProject jaxbProject = JptJaxbCorePlugin.instance().getProjectManager().getJaxbProject(packageFragment.getJavaProject().getProject());
if (jaxbProject == null) {
return null;
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaContextNode.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaContextNode.java
index bcf8327607..d92a2bb966 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaContextNode.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaContextNode.java
@@ -1,18 +1,19 @@
/*******************************************************************************
- * Copyright (c) 2011 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
- *******************************************************************************/
+ * Copyright (c) 2011, 2012 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.jaxb.core.internal.context.java;
import java.util.List;
import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
import org.eclipse.jpt.common.core.JptResourceType;
+import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceCompilationUnit;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.common.utility.Filter;
import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
@@ -37,7 +38,7 @@ public abstract class AbstractJavaContextNode
@Override
public JptResourceType getResourceType() {
- return JptCommonCorePlugin.JAVA_SOURCE_RESOURCE_TYPE;
+ return PlatformTools.getResourceType(JavaResourceCompilationUnit.CONTENT_TYPE);
}
// **************** content assist ****************************************
@@ -53,7 +54,7 @@ public abstract class AbstractJavaContextNode
public abstract TextRange getValidationTextRange(CompilationUnit astRoot);
/**
- * All subclass implementations {@link #validate(List, CompilationUnit))}
+ * All subclass implementations {@link #validate(List, IReporter, CompilationUnit)}
* should be preceded by a "super" call to this method
*/
public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetDataModelProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetDataModelProvider.java
index 638e6ea8c5..8161a7b02f 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetDataModelProvider.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetDataModelProvider.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2010, 2011 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
- *******************************************************************************/
+ * Copyright (c) 2010, 2012 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.jaxb.core.internal.facet;
import java.util.ArrayList;
@@ -232,7 +232,7 @@ public abstract class JaxbFacetDataModelProvider
}
protected static IStatus buildStatus(int severity, String message) {
- return new Status(severity, JptJaxbCorePlugin.PLUGIN_ID, message);
+ return JptJaxbCorePlugin.instance().buildStatus(severity, message);
}
@Override
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetVersionChangeDelegate.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetVersionChangeDelegate.java
index 2c7a4bc95f..e99952890a 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetVersionChangeDelegate.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetVersionChangeDelegate.java
@@ -1,3 +1,12 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2012 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.jaxb.core.internal.facet;
import org.eclipse.core.resources.IProject;
@@ -19,7 +28,7 @@ public class JaxbFacetVersionChangeDelegate
SubMonitor sm = SubMonitor.convert(monitor, 2);
super.execute_(project, fv, config, sm.newChild(1));
- JptJaxbCorePlugin.getProjectManager().rebuildJaxbProject(project);
+ JptJaxbCorePlugin.instance().getProjectManager().rebuildJaxbProject(project);
sm.worked(1);
// nothing further to do here *just* yet
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/jaxb21/GenericJaxb_2_1_PlatformDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/jaxb21/GenericJaxb_2_1_PlatformDefinition.java
index 72b0f4ab33..587c59906d 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/jaxb21/GenericJaxb_2_1_PlatformDefinition.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/jaxb21/GenericJaxb_2_1_PlatformDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2012 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.
@@ -13,9 +13,10 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
import org.eclipse.jpt.common.core.JptResourceType;
+import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceCompilationUnit;
import org.eclipse.jpt.common.core.resource.java.NestableAnnotationDefinition;
import org.eclipse.jpt.jaxb.core.GenericJaxbPlatform;
import org.eclipse.jpt.jaxb.core.JaxbFactory;
@@ -141,11 +142,11 @@ public class GenericJaxb_2_1_PlatformDefinition
}
public JptResourceType getMostRecentSupportedResourceType(IContentType contentType) {
- if (contentType.equals(JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE)) {
- return JptCommonCorePlugin.JAVA_SOURCE_RESOURCE_TYPE;
+ if (contentType.equals(JavaResourceCompilationUnit.CONTENT_TYPE)) {
+ return PlatformTools.getResourceType(JavaResourceCompilationUnit.CONTENT_TYPE);
}
- else if (contentType.equals(JptCommonCorePlugin.JAVA_SOURCE_PACKAGE_INFO_CONTENT_TYPE)) {
- return JptCommonCorePlugin.JAVA_SOURCE_PACKAGE_INFO_RESOURCE_TYPE;
+ if (contentType.equals(JavaResourceCompilationUnit.PACKAGE_INFO_CONTENT_TYPE)) {
+ return PlatformTools.getResourceType(JavaResourceCompilationUnit.PACKAGE_INFO_CONTENT_TYPE);
}
throw new IllegalArgumentException(contentType.toString());
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libprov/JaxbJreLibraryProviderInstallOperationConfig.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libprov/JaxbJreLibraryProviderInstallOperationConfig.java
index 87d08f80ca..00e6893209 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libprov/JaxbJreLibraryProviderInstallOperationConfig.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libprov/JaxbJreLibraryProviderInstallOperationConfig.java
@@ -1,17 +1,17 @@
/*******************************************************************************
- * Copyright (c) 2011 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
- *******************************************************************************/
+ * Copyright (c) 2011, 2012 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.jaxb.core.internal.libprov;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
+import org.eclipse.jpt.common.core.internal.libval.LibraryValidatorManager;
import org.eclipse.jpt.common.core.libval.LibraryValidator;
import org.eclipse.jpt.jaxb.core.libprov.JaxbLibraryProviderInstallOperationConfig;
import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription;
@@ -49,7 +49,7 @@ public class JaxbJreLibraryProviderInstallOperationConfig
return status;
}
- for (LibraryValidator libraryValidator : JptCommonCorePlugin.getLibraryValidators(this)) {
+ for (LibraryValidator libraryValidator : LibraryValidatorManager.instance().getLibraryValidators(this)) {
status = libraryValidator.validate(this);
if (! status.isOK()) {
return status;
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libprov/JaxbLibraryProviderInstallOperationConfigAdapterFactory.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libprov/JaxbLibraryProviderInstallOperationConfigAdapterFactory.java
index 0fede72a1b..9308b86b10 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libprov/JaxbLibraryProviderInstallOperationConfigAdapterFactory.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libprov/JaxbLibraryProviderInstallOperationConfigAdapterFactory.java
@@ -17,7 +17,7 @@ import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription;
* Factory to build Dali adapters for an {@link JaxbLibraryProviderInstallOperationConfig}:<ul>
* <li>{@link JaxbPlatformDescription}
* </ul>
- * See <code>org.eclipse.jpt.jaxb.core/plugin.xml</code>.
+ * See <code>org.eclipse.jpt.jaxb.core/plugin.xml:org.eclipse.core.runtime.adapters</code>.
*/
public class JaxbLibraryProviderInstallOperationConfigAdapterFactory
implements IAdapterFactory
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libval/GenericJaxbUserLibraryValidator.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libval/GenericJaxbUserLibraryValidator.java
index c4abe11d02..c6d03ed316 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libval/GenericJaxbUserLibraryValidator.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libval/GenericJaxbUserLibraryValidator.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2010, 2011 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
- *******************************************************************************/
+ * Copyright (c) 2010, 2012 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.jaxb.core.internal.libval;
import java.util.HashSet;
@@ -54,10 +54,7 @@ public class GenericJaxbUserLibraryValidator
// null here implies something prior to jaxb 2.1
if (jreJaxbVersion != null) {
if (jreJaxbVersion.compareTo(jaxbVersion) < 0) {
- String message = NLS.bind(
- JptJaxbCoreMessages.UserLibraryValidator_incompatibleJavaLibrary,
- new String[] {jaxbVersion.getVersionString()});
- return new Status(IStatus.ERROR, JptJaxbCorePlugin.PLUGIN_ID, message);
+ return JptJaxbCorePlugin.instance().buildErrorStatus(JptJaxbCoreMessages.UserLibraryValidator_incompatibleJavaLibrary, jaxbVersion.getVersionString());
}
}
// if jre is enough for jaxb version, we don't look for classes in the library
@@ -82,10 +79,7 @@ public class GenericJaxbUserLibraryValidator
// null here implies something prior to jaxb 2.1
if (javaJaxbVersion != null && javaJaxbVersion.compareTo(jaxbVersion) < 0) {
- String message = NLS.bind(
- JptJaxbCoreMessages.UserLibraryValidator_incompatibleJavaFacet,
- new String[] {javaVersion.getVersionString(), jaxbVersion.getVersionString()});
- return new Status(IStatus.WARNING, JptJaxbCorePlugin.PLUGIN_ID, message);
+ return JptJaxbCorePlugin.instance().buildStatus(IStatus.WARNING, JptJaxbCoreMessages.UserLibraryValidator_incompatibleJavaFacet, javaVersion.getVersionString(), jaxbVersion.getVersionString());
}
return Status.OK_STATUS;
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libval/JaxbJreLibraryValidator.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libval/JaxbJreLibraryValidator.java
index 7701da3606..8bc7380965 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libval/JaxbJreLibraryValidator.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libval/JaxbJreLibraryValidator.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2011 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
- *******************************************************************************/
+ * Copyright (c) 2011, 2012 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.jaxb.core.internal.libval;
import org.eclipse.core.runtime.IStatus;
@@ -30,7 +30,7 @@ public class JaxbJreLibraryValidator
= (JaxbLibraryProviderInstallOperationConfig) config;
if (! jaxbConfig.getJaxbPlatform().getGroup().equals(GenericJaxbPlatform.GROUP)) {
- return new Status(IStatus.ERROR, JptJaxbCorePlugin.PLUGIN_ID, JptJaxbCoreMessages.JreLibraryValidator_invalidPlatform);
+ return JptJaxbCorePlugin.instance().buildErrorStatus(JptJaxbCoreMessages.JreLibraryValidator_invalidPlatform);
}
IProjectFacetVersion jaxbVersion = config.getProjectFacetVersion();
@@ -43,10 +43,7 @@ public class JaxbJreLibraryValidator
// null here implies something prior to jaxb 2.1
if (jreJaxbVersion == null || jreJaxbVersion.compareTo(jaxbVersion) < 0) {
- String message = NLS.bind(
- JptJaxbCoreMessages.JreLibraryValidator_invalidJavaLibrary,
- new String[] {jaxbVersion.getVersionString()});
- return new Status(IStatus.ERROR, JptJaxbCorePlugin.PLUGIN_ID, message);
+ return JptJaxbCorePlugin.instance().buildErrorStatus(JptJaxbCoreMessages.JreLibraryValidator_invalidJavaLibrary, jaxbVersion.getVersionString());
}
// runtime portion of validation - warn if java facet is insufficient to provide jaxb api.
@@ -55,10 +52,7 @@ public class JaxbJreLibraryValidator
// null here implies something prior to jaxb 2.1
if (javaJaxbVersion == null || javaJaxbVersion.compareTo(jaxbVersion) < 0) {
- String message = NLS.bind(
- JptJaxbCoreMessages.JreLibraryValidator_invalidJavaFacet,
- new String[] {javaVersion.getVersionString(), jaxbVersion.getVersionString()});
- return new Status(IStatus.WARNING, JptJaxbCorePlugin.PLUGIN_ID, message);
+ return JptJaxbCorePlugin.instance().buildStatus(IStatus.WARNING, JptJaxbCoreMessages.JreLibraryValidator_invalidJavaFacet, javaVersion.getVersionString(), jaxbVersion.getVersionString());
}
// TODO - check for xjc classes when we support jdk version of xjc
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/platform/JaxbPlatformManagerImpl.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/platform/JaxbPlatformManagerImpl.java
index e619fc47e8..4fd56b0d37 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/platform/JaxbPlatformManagerImpl.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/platform/JaxbPlatformManagerImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2012 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.
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jaxb.core.internal.platform;
-import static org.eclipse.jpt.common.core.internal.utility.XPointTools.*;
+import static org.eclipse.jpt.common.core.internal.utility.XPointTools.findRequiredAttribute;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.resources.IProject;
@@ -18,6 +18,8 @@ import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.jpt.common.core.internal.JptCommonCoreMessages;
+import org.eclipse.jpt.common.core.internal.utility.XPointTools;
import org.eclipse.jpt.common.core.internal.utility.XPointTools.XPointException;
import org.eclipse.jpt.common.utility.internal.KeyedSet;
import org.eclipse.jpt.common.utility.internal.iterables.SuperIterableWrapper;
@@ -34,7 +36,7 @@ public class JaxbPlatformManagerImpl
implements JaxbPlatformManager {
static final String EXTENSION_POINT_ID = "jaxbPlatforms"; //$NON-NLS-1$
- static final String QUALIFIED_EXTENSION_POINT_ID = JptJaxbCorePlugin.PLUGIN_ID_ + EXTENSION_POINT_ID;
+ static final String QUALIFIED_EXTENSION_POINT_ID = JptJaxbCorePlugin.instance().getPluginID() + '.' + EXTENSION_POINT_ID;
static final String PLATFORM_GROUP_ELEMENT = "jaxbPlatformGroup"; //$NON-NLS-1$
static final String PLATFORM_ELEMENT = "jaxbPlatform"; //$NON-NLS-1$
static final String ID_ATTRIBUTE = "id"; //$NON-NLS-1$
@@ -71,7 +73,7 @@ public class JaxbPlatformManagerImpl
final IExtensionRegistry registry = Platform.getExtensionRegistry();
final IExtensionPoint xpoint
- = registry.getExtensionPoint(JptJaxbCorePlugin.PLUGIN_ID, EXTENSION_POINT_ID);
+ = registry.getExtensionPoint(JptJaxbCorePlugin.instance().getPluginID(), EXTENSION_POINT_ID);
if (xpoint == null) {
throw new IllegalStateException();
@@ -111,7 +113,7 @@ public class JaxbPlatformManagerImpl
desc.setId(findRequiredAttribute(element, ID_ATTRIBUTE));
if (this.platformGroupDescriptions.containsKey(desc.getId())) {
- logDuplicateExtension(QUALIFIED_EXTENSION_POINT_ID, ID_ATTRIBUTE, desc.getId());
+ this.logError(JptCommonCoreMessages.REGISTRY_DUPLICATE, QUALIFIED_EXTENSION_POINT_ID, desc.getPluginId(), ID_ATTRIBUTE, desc.getId());
throw new XPointException();
}
@@ -137,7 +139,7 @@ public class JaxbPlatformManagerImpl
desc.setId(findRequiredAttribute(element, ID_ATTRIBUTE));
if (this.platformDescriptions.containsKey(desc.getId())) {
- logDuplicateExtension(QUALIFIED_EXTENSION_POINT_ID, ID_ATTRIBUTE, desc.getId());
+ this.logError(JptCommonCoreMessages.REGISTRY_DUPLICATE, QUALIFIED_EXTENSION_POINT_ID, desc.getPluginId(), ID_ATTRIBUTE, desc.getId());
throw new XPointException();
}
@@ -155,7 +157,7 @@ public class JaxbPlatformManagerImpl
desc.setJaxbFacetVersion(jpaFacetVersion);
}
else {
- logInvalidValue(element, JAXB_FACET_VERSION_ATTRIBUTE, jaxbFacetVersionString);
+ this.logError(XPointTools.buildInvalidValueMessage(element, JAXB_FACET_VERSION_ATTRIBUTE, jaxbFacetVersionString));
throw new XPointException();
}
}
@@ -170,7 +172,7 @@ public class JaxbPlatformManagerImpl
desc.setDefault(false);
}
else {
- logInvalidValue(element, DEFAULT_ATTRIBUTE, defaultString);
+ this.logError(XPointTools.buildInvalidValueMessage(element, DEFAULT_ATTRIBUTE, defaultString));
throw new XPointException();
}
}
@@ -184,7 +186,7 @@ public class JaxbPlatformManagerImpl
group.addPlatform(desc);
}
else {
- logInvalidValue(element, GROUP_ELEMENT, groupId);
+ this.logError(XPointTools.buildInvalidValueMessage(element, GROUP_ELEMENT, groupId));
throw new XPointException();
}
}
@@ -196,7 +198,7 @@ public class JaxbPlatformManagerImpl
group.addPlatform(desc);
if (this.platformGroupDescriptions.containsKey(group.getId())) {
- logInvalidValue(element, GROUP_ELEMENT, groupId);
+ this.logError(XPointTools.buildInvalidValueMessage(element, GROUP_ELEMENT, groupId));
throw new XPointException();
}
@@ -250,4 +252,12 @@ public class JaxbPlatformManagerImpl
}
return platformDesc.buildJaxbPlatformDefinition();
}
+
+ private void logError(String msg, Object... args) {
+ JptJaxbCorePlugin.instance().logError(msg, args);
+ }
+
+ private void logError(String msg) {
+ JptJaxbCorePlugin.instance().logError(msg);
+ }
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/platform/JaxbPlatformTester.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/platform/JaxbPlatformTester.java
index 599dc4e1ac..1711627352 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/platform/JaxbPlatformTester.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/platform/JaxbPlatformTester.java
@@ -17,7 +17,7 @@ import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformGroupDescription;
/**
* Property tester for {@link JaxbPlatformDescription}.
- * See <code>org.eclipse.jpt.jaxb.core/plugin.xml</code>
+ * See <code>org.eclipse.jpt.jaxb.core/plugin.xml:org.eclipse.core.expressions.propertyTesters</code>
*/
public class JaxbPlatformTester
extends PropertyTester
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/prefs/JaxbPreferencesManager.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/prefs/JaxbPreferencesManager.java
index 22c8f80049..bb7397f10a 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/prefs/JaxbPreferencesManager.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/prefs/JaxbPreferencesManager.java
@@ -1,12 +1,12 @@
/*******************************************************************************
-* Copyright (c) 2012 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
-*******************************************************************************/
+ * Copyright (c) 2012 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.jaxb.core.internal.prefs;
import java.util.List;
@@ -98,7 +98,7 @@ public class JaxbPreferencesManager
* Return the Dali preferences for the specified context.
*/
private static IEclipsePreferences getPreferences(IScopeContext context) {
- return context.getNode(JptJaxbCorePlugin.PLUGIN_ID);
+ return context.getNode(JptJaxbCorePlugin.instance().getPluginID());
}
/**
@@ -169,7 +169,7 @@ public class JaxbPreferencesManager
prefs.flush();
}
catch(BackingStoreException ex) {
- JptJaxbCorePlugin.log(ex);
+ JptJaxbCorePlugin.instance().logError(ex);
}
return Status.OK_STATUS;
}
@@ -192,10 +192,10 @@ public class JaxbPreferencesManager
return fproj.getPreferences(JaxbFacet.FACET);
}
catch (BackingStoreException bse) {
- JptJaxbCorePlugin.log(bse);
+ JptJaxbCorePlugin.instance().logError(bse);
}
catch (CoreException ce) {
- JptJaxbCorePlugin.log(ce);
+ JptJaxbCorePlugin.instance().logError(ce);
}
return null;
}
@@ -222,7 +222,7 @@ public class JaxbPreferencesManager
platformPrefs.flush();
}
catch (BackingStoreException bse) {
- JptJaxbCorePlugin.log(bse);
+ JptJaxbCorePlugin.instance().logError(bse);
}
}
@@ -248,7 +248,7 @@ public class JaxbPreferencesManager
}
catch (BackingStoreException bse) {
// this means that the prefs are corrupted, in which case reading anything is unlikely
- JptJaxbCorePlugin.log(bse);
+ JptJaxbCorePlugin.instance().logError(bse);
}
return schemaLocations;
}
@@ -267,7 +267,7 @@ public class JaxbPreferencesManager
classgenPrefs.flush();
}
catch (BackingStoreException bse) {
- JptJaxbCorePlugin.log(bse);
+ JptJaxbCorePlugin.instance().logError(bse);
}
}
@@ -282,8 +282,7 @@ public class JaxbPreferencesManager
schemaPref.put(SCHEMA_LOCATION_PREF_KEY, location);
i ++;
}
- boolean checkAnotherNode = true;
- for ( ; checkAnotherNode; i++ ) {
+ for (boolean checkAnotherNode = true; checkAnotherNode; i++ ) {
String nodeName = SCHEMA_PREF_NODE_PREFIX + String.valueOf(i);
if (schemasPrefs.nodeExists(nodeName)) {
schemasPrefs.node(nodeName).removeNode();
@@ -296,7 +295,7 @@ public class JaxbPreferencesManager
}
catch (BackingStoreException bse) {
// this means that the prefs are corrupted, in which case reading anything is unlikely
- JptJaxbCorePlugin.log(bse);
+ JptJaxbCorePlugin.instance().logError(bse);
}
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/AbstractJaxbFileResourceModel.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/AbstractJaxbFileResourceModel.java
index 8df576788f..26534cec3b 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/AbstractJaxbFileResourceModel.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/AbstractJaxbFileResourceModel.java
@@ -86,7 +86,7 @@ public abstract class AbstractJaxbFileResourceModel<S>
// workspace out of sync - no underlying file - simply don't load
}
catch (Exception ex) {
- JptJaxbCorePlugin.log(ex);
+ JptJaxbCorePlugin.instance().logError(ex);
}
finally {
this.closeStream(stream);
@@ -104,7 +104,7 @@ public abstract class AbstractJaxbFileResourceModel<S>
stream.close();
}
} catch (IOException ex) {
- JptJaxbCorePlugin.log(ex);
+ JptJaxbCorePlugin.instance().logError(ex);
}
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/jaxbindex/JaxbIndexResourceImpl.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/jaxbindex/JaxbIndexResourceImpl.java
index 4e17fb10e4..b2e965ba37 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/jaxbindex/JaxbIndexResourceImpl.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/jaxbindex/JaxbIndexResourceImpl.java
@@ -19,7 +19,6 @@ import org.eclipse.jpt.common.core.JptResourceType;
import org.eclipse.jpt.common.utility.internal.Transformer;
import org.eclipse.jpt.common.utility.internal.iterables.SnapshotCloneIterable;
import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin;
import org.eclipse.jpt.jaxb.core.internal.resource.AbstractJaxbFileResourceModel;
import org.eclipse.jpt.jaxb.core.resource.jaxbindex.JaxbIndexResource;
@@ -86,6 +85,6 @@ public class JaxbIndexResourceImpl
}
public JptResourceType getResourceType() {
- return JptJaxbCorePlugin.JAXB_INDEX_RESOURCE_TYPE;
+ return RESOURCE_TYPE;
}
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/jaxbindex/JaxbIndexResourceModelProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/jaxbindex/JaxbIndexResourceModelProvider.java
index f1600741da..493e042ccf 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/jaxbindex/JaxbIndexResourceModelProvider.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/jaxbindex/JaxbIndexResourceModelProvider.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2011 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
- *******************************************************************************/
+ * Copyright (c) 2011, 2012 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.jaxb.core.internal.resource.jaxbindex;
import java.util.HashMap;
@@ -67,7 +67,7 @@ public class JaxbIndexResourceModelProvider
}
public IContentType getContentType() {
- return JptJaxbCorePlugin.JAXB_INDEX_CONTENT_TYPE;
+ return JaxbIndexResource.CONTENT_TYPE;
}
public JptResourceModel buildResourceModel(JaxbProject jaxbProject, IFile file) {
@@ -110,7 +110,7 @@ public class JaxbIndexResourceModelProvider
}
catch (CoreException ce) {
// shouldn't happen
- JptJaxbCorePlugin.log(ce);
+ JptJaxbCorePlugin.instance().logError(ce);
}
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/jaxbprops/JaxbPropertiesResourceImpl.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/jaxbprops/JaxbPropertiesResourceImpl.java
index be6842c4aa..afe3301836 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/jaxbprops/JaxbPropertiesResourceImpl.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/jaxbprops/JaxbPropertiesResourceImpl.java
@@ -14,7 +14,6 @@ import java.io.InputStream;
import java.util.Properties;
import org.eclipse.core.resources.IFile;
import org.eclipse.jpt.common.core.JptResourceType;
-import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin;
import org.eclipse.jpt.jaxb.core.internal.resource.AbstractJaxbFileResourceModel;
import org.eclipse.jpt.jaxb.core.resource.jaxbprops.JaxbPropertiesResource;
@@ -50,6 +49,6 @@ public class JaxbPropertiesResourceImpl
}
public JptResourceType getResourceType() {
- return JptJaxbCorePlugin.JAXB_PROPERTIES_RESOURCE_TYPE;
+ return RESOURCE_TYPE;
}
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/jaxbprops/JaxbPropertiesResourceModelProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/jaxbprops/JaxbPropertiesResourceModelProvider.java
index d2b2e72c72..ea75a086d5 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/jaxbprops/JaxbPropertiesResourceModelProvider.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/jaxbprops/JaxbPropertiesResourceModelProvider.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2011 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
- *******************************************************************************/
+ * Copyright (c) 2011, 2012 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.jaxb.core.internal.resource.jaxbprops;
import java.util.HashMap;
@@ -68,7 +68,7 @@ public class JaxbPropertiesResourceModelProvider
}
public IContentType getContentType() {
- return JptJaxbCorePlugin.JAXB_PROPERTIES_CONTENT_TYPE;
+ return JaxbPropertiesResource.CONTENT_TYPE;
}
public JptResourceModel buildResourceModel(JaxbProject jaxbProject, IFile file) {
@@ -111,7 +111,7 @@ public class JaxbPropertiesResourceModelProvider
}
catch (CoreException ce) {
// shouldn't happen
- JptJaxbCorePlugin.log(ce);
+ JptJaxbCorePlugin.instance().logError(ce);
}
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/validation/DefaultValidationMessages.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/validation/DefaultValidationMessages.java
index d79d040b3e..2ccba102da 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/validation/DefaultValidationMessages.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/validation/DefaultValidationMessages.java
@@ -58,11 +58,11 @@ public class DefaultValidationMessages {
public static IMessage buildMessage(int defaultSeverity, String messageId, String[] parms, IResource targetObject, TextRange textRange, MessageFactory messageFactory) {
IMessage message = messageFactory.buildMessage(defaultSeverity, messageId, parms, targetObject);
- message.setMarkerId(JptJaxbCorePlugin.VALIDATION_MARKER_ID);
+ message.setMarkerId(JaxbValidator.MARKER_ID);
if (textRange == null) {
textRange = DEFAULT_TEXT_RANGE;
// log the exception but allow the message to still be used
- JptJaxbCorePlugin.log(new NullPointerException("Null text range for message ID: " + messageId)); //$NON-NLS-1$
+ JptJaxbCorePlugin.instance().logError(new NullPointerException("Null text range for message ID: " + messageId)); //$NON-NLS-1$
}
int lineNumber = textRange.getLineNumber();
message.setLineNo(lineNumber);
@@ -103,7 +103,7 @@ public class DefaultValidationMessages {
// severity = prefSeverity;
// }
IMessage message = new Message(JaxbValidationMessages.BUNDLE_NAME, severity, messageId, parms, targetObject);
- message.setMarkerId(JptJaxbCorePlugin.VALIDATION_MARKER_ID);
+ message.setMarkerId(JaxbValidator.MARKER_ID);
return message;
}
@Override
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/validation/JaxbValidator.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/validation/JaxbValidator.java
index 7ae65d3882..1bd5690139 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/validation/JaxbValidator.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/validation/JaxbValidator.java
@@ -34,6 +34,14 @@ public class JaxbValidator
extends AbstractValidator
implements IValidator {
+ public static final String RELATIVE_MARKER_ID = "problemMarker"; //$NON-NLS-1$
+
+ /**
+ * The identifier for the JAXB validation marker
+ * (value <code>"org.eclipse.jpt.jaxb.core.problemMarker"</code>).
+ */
+ public static final String MARKER_ID = JptJaxbCorePlugin.instance().getPluginID() + '.' + RELATIVE_MARKER_ID;
+
public JaxbValidator() {
super();
}
@@ -73,12 +81,12 @@ public class JaxbValidator
try {
this.clearMarkers_(project);
} catch (CoreException ex) {
- JptJaxbCorePlugin.log(ex);
+ JptJaxbCorePlugin.instance().logError(ex);
}
}
private void clearMarkers_(IProject project) throws CoreException {
- IMarker[] markers = project.findMarkers(JptJaxbCorePlugin.VALIDATION_MARKER_ID, true, IResource.DEPTH_INFINITE);
+ IMarker[] markers = project.findMarkers(JaxbValidator.MARKER_ID, true, IResource.DEPTH_INFINITE);
for (IMarker marker : markers) {
marker.delete();
}
@@ -95,7 +103,7 @@ public class JaxbValidator
}
private Iterable<IMessage> buildValidationMessages(IReporter reporter, IProject project) {
- JaxbProject jaxbProject = JptJaxbCorePlugin.getJaxbProject(project);
+ JaxbProject jaxbProject = JptJaxbCorePlugin.instance().getProjectManager().getJaxbProject(project);
if (jaxbProject != null) {
return jaxbProject.getValidationMessages(reporter);
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/jaxbindex/JaxbIndexResource.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/jaxbindex/JaxbIndexResource.java
index 22275336cd..ab727cfaa9 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/jaxbindex/JaxbIndexResource.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/jaxbindex/JaxbIndexResource.java
@@ -1,20 +1,33 @@
/*******************************************************************************
- * Copyright (c) 2011 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
- *******************************************************************************/
+ * Copyright (c) 2011, 2012 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.jaxb.core.resource.jaxbindex;
+import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.jpt.common.core.JptResourceModel;
-
+import org.eclipse.jpt.common.core.JptResourceType;
+import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
+import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin;
public interface JaxbIndexResource
extends JptResourceModel {
+ /**
+ * The content type for <code>jaxb.index</code> files.
+ */
+ IContentType CONTENT_TYPE = JptJaxbCorePlugin.instance().getContentType("jaxbIndex"); //$NON-NLS-1$
+
+ /**
+ * The resource type for <code>jaxb.index</code> files.
+ */
+ JptResourceType RESOURCE_TYPE = PlatformTools.getResourceType(CONTENT_TYPE);
+
String getPackageName();
Iterable<String> getFullyQualifiedClassNames();
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/jaxbprops/JaxbPropertiesResource.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/jaxbprops/JaxbPropertiesResource.java
index 8d0931ae4e..cdda8f39db 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/jaxbprops/JaxbPropertiesResource.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/jaxbprops/JaxbPropertiesResource.java
@@ -1,20 +1,34 @@
/*******************************************************************************
- * Copyright (c) 2011 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
- *******************************************************************************/
+ * Copyright (c) 2011, 2012 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.jaxb.core.resource.jaxbprops;
+import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.jpt.common.core.JptResourceModel;
+import org.eclipse.jpt.common.core.JptResourceType;
+import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
+import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin;
public interface JaxbPropertiesResource
extends JptResourceModel {
+ /**
+ * The content type for <code>jaxb.properties</code> files.
+ */
+ IContentType CONTENT_TYPE = JptJaxbCorePlugin.instance().getContentType("jaxbProperties"); //$NON-NLS-1$
+
+ /**
+ * The resource type for <code>jaxb.properties</code> files.
+ */
+ JptResourceType RESOURCE_TYPE = PlatformTools.getResourceType(CONTENT_TYPE);
+
String getPackageName();
String getProperty(String propertyName);
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/xsd/XsdUtil.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/xsd/XsdUtil.java
index af5191d2a6..3b31939d8d 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/xsd/XsdUtil.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/xsd/XsdUtil.java
@@ -1,14 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2011 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:
- * IBM Corporation - initial API and implementation
- * (copied mainly from org.eclipse.wst.xsd.contentmodel.internal.XSDImpl)
- * Oracle - extensions and modifications
- *******************************************************************************/
+ * Copyright (c) 2011, 2012 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:
+ * IBM Corporation - initial API and implementation
+ * (copied mainly from org.eclipse.wst.xsd.contentmodel.internal.XSDImpl)
+ * Oracle - extensions and modifications
+ ******************************************************************************/
package org.eclipse.jpt.jaxb.core.xsd;
import java.io.IOException;
@@ -74,11 +74,11 @@ public class XsdUtil {
}
}
catch (MalformedURLException me) {
- JptJaxbCorePlugin.log(me);
+ JptJaxbCorePlugin.instance().logError(me);
resolvedUri = null;
}
catch (IOException ie) {
- JptJaxbCorePlugin.log(ie);
+ JptJaxbCorePlugin.instance().logError(ie);
resolvedUri = null;
}
}
@@ -145,7 +145,7 @@ public class XsdUtil {
}
}
catch (Exception e) {
- JptJaxbCorePlugin.log(e);
+ JptJaxbCorePlugin.instance().logError(e);
}
}
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/META-INF/MANIFEST.MF b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/META-INF/MANIFEST.MF
index 6094e17a01..3750a2621b 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/META-INF/MANIFEST.MF
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/META-INF/MANIFEST.MF
@@ -4,6 +4,8 @@ Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.jpt.jaxb.eclipselink.core.schemagen;singleton:=true
Bundle-Version: 1.1.0.qualifier
+Bundle-ActivationPolicy: lazy
+Bundle-ClassPath: .
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Import-Package: javax.xml.bind,
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/.classpath b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/.classpath
index ba29ee4b87..cad82b35cd 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/.classpath
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/.classpath
@@ -5,6 +5,7 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
<accessrules>
+ <accessrule kind="nonaccessible" pattern="org/eclipse/jpt/**/plugin/**"/>
<accessrule kind="nonaccessible" pattern="org/eclipse/jpt/common/utility/model/value/**"/>
<accessrule kind="nonaccessible" pattern="org/eclipse/jpt/common/utility/internal/model/listener/awt/**"/>
<accessrule kind="nonaccessible" pattern="org/eclipse/jpt/common/utility/internal/model/value/**"/>
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/META-INF/MANIFEST.MF b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/META-INF/MANIFEST.MF
index 07c7256bee..2abe8f3efe 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/META-INF/MANIFEST.MF
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/META-INF/MANIFEST.MF
@@ -4,7 +4,7 @@ Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.jpt.jaxb.eclipselink.core;singleton:=true
Bundle-Version: 1.2.0.qualifier
-Bundle-Activator: org.eclipse.jpt.jaxb.eclipselink.core.JptJaxbEclipseLinkCorePlugin
+Bundle-Activator: org.eclipse.jpt.jaxb.eclipselink.core.internal.plugin.JptJaxbEclipseLinkCorePlugin
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .
Bundle-Localization: plugin
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/JptJaxbEclipseLinkCorePlugin.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/JptJaxbEclipseLinkCorePlugin.java
deleted file mode 100644
index e69681806f..0000000000
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/JptJaxbEclipseLinkCorePlugin.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 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.jaxb.eclipselink.core;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.core.runtime.Status;
-import org.osgi.framework.BundleContext;
-
-public class JptJaxbEclipseLinkCorePlugin
- extends Plugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.jpt.jaxb.eclipselink.core"; //$NON-NLS-1$
-
-
- // ********** singleton **********
- private static JptJaxbEclipseLinkCorePlugin INSTANCE;
-
- /**
- * Return the singleton JPT EclipseLink plug-in.
- */
- public static JptJaxbEclipseLinkCorePlugin instance() {
- return INSTANCE;
- }
-
- /**
- * Log the specified status.
- */
- public static void log(IStatus status) {
- INSTANCE.getLog().log(status);
- }
-
- /**
- * Log the specified message.
- */
- public static void log(String msg) {
- log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, msg, null));
- }
-
- /**
- * Log the specified exception or error.
- */
- public static void log(Throwable throwable) {
- log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, throwable.getLocalizedMessage(), throwable));
- }
-
-
- // ********** plug-in implementation **********
-
- public JptJaxbEclipseLinkCorePlugin() {
- super();
- }
-
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- INSTANCE = this;
- }
-
- @Override
- public void stop(BundleContext context) throws Exception {
- INSTANCE = null;
- super.stop(context);
- }
-}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/libval/ELJaxbUserLibraryValidator.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/libval/ELJaxbUserLibraryValidator.java
index 9e6c36dc82..4294916e5c 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/libval/ELJaxbUserLibraryValidator.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/libval/ELJaxbUserLibraryValidator.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2011 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
- *******************************************************************************/
+ * Copyright (c) 2011, 2012 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.jaxb.eclipselink.core.internal.libval;
import java.util.HashSet;
@@ -80,10 +80,8 @@ public class ELJaxbUserLibraryValidator
status = LibValUtil.validate(libraryPaths, classNames);
- if (! status.isOK()) {
- return new Status(IStatus.WARNING, JptJaxbCorePlugin.PLUGIN_ID, JptCommonEclipseLinkCoreMessages.ELJaxbUserLibraryValidator_noXjcClasses);
- }
-
- return Status.OK_STATUS;
+ return status.isOK() ?
+ Status.OK_STATUS :
+ JptJaxbCorePlugin.instance().buildStatus(IStatus.WARNING, JptCommonEclipseLinkCoreMessages.ELJaxbUserLibraryValidator_noXjcClasses);
}
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/plugin/JptJaxbEclipseLinkCorePlugin.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/plugin/JptJaxbEclipseLinkCorePlugin.java
new file mode 100644
index 0000000000..03199d2e0b
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/plugin/JptJaxbEclipseLinkCorePlugin.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012 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.jaxb.eclipselink.core.internal.plugin;
+
+import org.eclipse.jpt.common.core.internal.utility.JptPlugin;
+
+public class JptJaxbEclipseLinkCorePlugin
+ extends JptPlugin
+{
+ // ********** singleton **********
+
+ private static JptJaxbEclipseLinkCorePlugin INSTANCE;
+
+ /**
+ * Return the singleton Dali JAXB EclipseLink core plug-in.
+ */
+ public static JptJaxbEclipseLinkCorePlugin instance() {
+ return INSTANCE;
+ }
+
+
+ // ********** Dali plug-in **********
+
+ public JptJaxbEclipseLinkCorePlugin() {
+ super();
+ }
+
+ @Override
+ protected void setInstance(JptPlugin plugin) {
+ INSTANCE = (JptJaxbEclipseLinkCorePlugin) plugin;
+ }
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/validation/ELJaxbValidationMessageBuilder.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/validation/ELJaxbValidationMessageBuilder.java
index 60a8593632..64644cb824 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/validation/ELJaxbValidationMessageBuilder.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core/src/org/eclipse/jpt/jaxb/eclipselink/core/internal/validation/ELJaxbValidationMessageBuilder.java
@@ -16,10 +16,10 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.jaxb.core.JaxbNode;
-import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin;
import org.eclipse.wst.validation.internal.core.Message;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.jpt.jaxb.core.internal.validation.DefaultValidationMessages;
+import org.eclipse.jpt.jaxb.core.internal.validation.JaxbValidator;
public class ELJaxbValidationMessageBuilder {
@@ -78,7 +78,7 @@ public class ELJaxbValidationMessageBuilder {
// }
IMessage message = new EclipseLinkMessage(ELJaxbValidationMessages.BUNDLE_NAME, severity, messageId, parms, targetObject);
// TODO "EclipseLink JAXB" validation marker?
- message.setMarkerId(JptJaxbCorePlugin.VALIDATION_MARKER_ID);
+ message.setMarkerId(JaxbValidator.MARKER_ID);
return message;
}
@Override
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/.classpath b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/.classpath
index 783ee1e9ed..1aba5a72b2 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/.classpath
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/.classpath
@@ -4,8 +4,10 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
<accessrules>
+ <accessrule kind="nonaccessible" pattern="org/eclipse/jpt/**/plugin/**"/>
<accessrule kind="accessible" pattern="org/eclipse/jpt/jaxb/ui/**"/>
<accessrule kind="accessible" pattern="org/eclipse/jpt/common/ui/**"/>
+ <accessrule kind="accessible" pattern="org/eclipse/jpt/common/core/**"/>
<accessrule kind="accessible" pattern="org/eclipse/jpt/common/utility/**"/>
</accessrules>
</classpathentry>
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/META-INF/MANIFEST.MF b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/META-INF/MANIFEST.MF
index 8e669444a7..dfbf998780 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/META-INF/MANIFEST.MF
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/META-INF/MANIFEST.MF
@@ -4,7 +4,7 @@ Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.jpt.jaxb.eclipselink.ui;singleton:=true
Bundle-Version: 1.3.0.qualifier
-Bundle-Activator: org.eclipse.jpt.jaxb.eclipselink.ui.JptJaxbEclipseLinkUiPlugin
+Bundle-Activator: org.eclipse.jpt.jaxb.eclipselink.ui.internal.plugin.JptJaxbEclipseLinkUiPlugin
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .
Bundle-Localization: plugin
@@ -22,8 +22,8 @@ Require-Bundle: org.eclipse.core.resources;bundle-version="[3.5.2,4.0.0)",
org.eclipse.swt;bundle-version="[3.7.0,4.0.0)",
org.eclipse.ui.ide;bundle-version="[3.8.0,4.0.0)",
org.eclipse.ui.workbench;bundle-version="[3.7.0,4.0.0)"
-Export-Package: org.eclipse.jpt.jaxb.eclipselink.ui,
- org.eclipse.jpt.jaxb.eclipselink.ui.internal;x-internal:=true,
+Export-Package: org.eclipse.jpt.jaxb.eclipselink.ui.internal;x-internal:=true,
+ org.eclipse.jpt.jaxb.eclipselink.ui.internal.commands;x-internal:=true,
org.eclipse.jpt.jaxb.eclipselink.ui.internal.v2_1;x-internal:=true,
org.eclipse.jpt.jaxb.eclipselink.ui.internal.v2_2;x-internal:=true,
org.eclipse.jpt.jaxb.eclipselink.ui.internal.v2_3;x-internal:=true,
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/Activator.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/Activator.java
deleted file mode 100644
index 39e81583dd..0000000000
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/Activator.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package org.eclipse.jpt.jaxb.eclipselink.ui;
-
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-
-public class Activator implements BundleActivator {
-
- private static BundleContext context;
-
- static BundleContext getContext() {
- return context;
- }
-
- /*
- * (non-Javadoc)
- * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext bundleContext) throws Exception {
- Activator.context = bundleContext;
- }
-
- /*
- * (non-Javadoc)
- * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext bundleContext) throws Exception {
- Activator.context = null;
- }
-
-}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/JptJaxbEclipseLinkUiPlugin.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/JptJaxbEclipseLinkUiPlugin.java
deleted file mode 100644
index 23b5d76ee8..0000000000
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/JptJaxbEclipseLinkUiPlugin.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 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.jaxb.eclipselink.ui;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-/**
- * The activator class controls the plug-in life cycle
- *
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- */
-@SuppressWarnings("nls")
-public class JptJaxbEclipseLinkUiPlugin
- extends AbstractUIPlugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.jpt.jaxb.eclipselink.ui";
-
-
- // ********** singleton **********
-
- private static JptJaxbEclipseLinkUiPlugin INSTANCE;
-
- /**
- * Returns the singleton Plugin
- */
- public static JptJaxbEclipseLinkUiPlugin instance() {
- return INSTANCE;
- }
-
-
- // ********** error logging **********
-
- public static void log(IStatus status) {
- INSTANCE.getLog().log(status);
- }
-
- public static void log(String msg) {
- log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, msg, null));
- }
-
- public static void log(Throwable throwable) {
- log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, throwable.getLocalizedMessage(), throwable));
- }
-
-
- // ********** Image API **********
-
- /**
- * This gets a .gif from the icons folder.
- */
- public static ImageDescriptor getImageDescriptor(String key) {
- if (! key.startsWith("icons/")) {
- key = "icons/" + key;
- }
- if (! key.endsWith(".gif")) {
- key = key + ".gif";
- }
- return imageDescriptorFromPlugin(PLUGIN_ID, key);
- }
-
- /**
- * This returns an image for a .gif from the icons folder
- */
- //TODO we are using the ImageRegistry here and storing all our icons for the life of the plugin,
- //which means until the workspace is closed. This is better than before where we constantly
- //created new images. Bug 306437 is about cleaning this up and using Local Resource Managers
- //on our views so that closing the JPA perspective would mean our icons are disposed.
- public static Image getImage(String key) {
- ImageRegistry imageRegistry = instance().getImageRegistry();
- Image image = imageRegistry.get(key);
- if (image == null) {
- imageRegistry.put(key, getImageDescriptor(key));
- image = imageRegistry.get(key);
- }
- return image;
- }
-
-
- // ********** constructors **********
-
- public JptJaxbEclipseLinkUiPlugin() {
- super();
- if (INSTANCE != null) {
- throw new IllegalStateException();
- }
- INSTANCE = this;
- }
-}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/ELJaxbMappingImageHelper.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/ELJaxbMappingImageHelper.java
index a740ddcbb4..337814d4d7 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/ELJaxbMappingImageHelper.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/ELJaxbMappingImageHelper.java
@@ -1,16 +1,16 @@
/*******************************************************************************
- * Copyright (c) 2011 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
- *******************************************************************************/
+ * Copyright (c) 2011, 2012 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.jaxb.eclipselink.ui.internal;
import org.eclipse.jpt.jaxb.eclipselink.core.ELJaxbMappingKeys;
-import org.eclipse.jpt.jaxb.eclipselink.ui.JptJaxbEclipseLinkUiPlugin;
+import org.eclipse.jpt.jaxb.eclipselink.ui.internal.plugin.JptJaxbEclipseLinkUiPlugin;
import org.eclipse.jpt.jaxb.ui.internal.JaxbMappingImageHelper;
import org.eclipse.swt.graphics.Image;
@@ -21,7 +21,7 @@ public class ELJaxbMappingImageHelper {
String iconKey = iconKeyForAttributeMapping(mappingKey);
return (iconKey == null) ?
JaxbMappingImageHelper.imageForAttributeMapping(mappingKey)
- : JptJaxbEclipseLinkUiPlugin.getImage(iconKey);
+ : JptJaxbEclipseLinkUiPlugin.instance().getImage(iconKey);
}
public static String iconKeyForAttributeMapping(String mappingKey) {
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/commands/AddEclipseLinkJaxbPropertyCommandHandler.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/commands/AddEclipseLinkJaxbPropertyCommandHandler.java
index 21bd600dfb..440ae8faca 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/commands/AddEclipseLinkJaxbPropertyCommandHandler.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/commands/AddEclipseLinkJaxbPropertyCommandHandler.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
+ * Copyright (c) 2012 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.jaxb.eclipselink.ui.internal.commands;
import java.io.ByteArrayInputStream;
@@ -34,8 +34,7 @@ import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin;
import org.eclipse.jpt.jaxb.core.context.JaxbPackage;
import org.eclipse.jpt.jaxb.core.resource.jaxbprops.JaxbPropertiesResource;
-import org.eclipse.jpt.jaxb.eclipselink.ui.JptJaxbEclipseLinkUiPlugin;
-import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin;
+import org.eclipse.jpt.jaxb.eclipselink.ui.internal.plugin.JptJaxbEclipseLinkUiPlugin;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.handlers.HandlerUtil;
@@ -80,7 +79,7 @@ public class AddEclipseLinkJaxbPropertyCommandHandler
folder = getFolder(jaxbPackage);
}
catch (JavaModelException jme) {
- JptJaxbEclipseLinkUiPlugin.log(jme);
+ JptJaxbEclipseLinkUiPlugin.instance().logError(jme);
return;
}
Job job = new Job("Creating jaxb.properties") {
@@ -92,8 +91,8 @@ public class AddEclipseLinkJaxbPropertyCommandHandler
file.create(stream, true, null);
}
catch (CoreException ce) {
- JptJaxbEclipseLinkUiPlugin.log(ce);
- return new Status(Status.ERROR, JptJaxbEclipseLinkUiPlugin.PLUGIN_ID, "Could not create jaxb.properties.");
+ JptJaxbEclipseLinkUiPlugin.instance().logError(ce);
+ return JptJaxbEclipseLinkUiPlugin.instance().buildErrorStatus(ce, "Could not create jaxb.properties.");
}
AddEclipseLinkJaxbPropertyCommandHandler.this.revealAndOpenFile(file, activeWindow);
return Status.OK_STATUS;
@@ -110,7 +109,7 @@ public class AddEclipseLinkJaxbPropertyCommandHandler
folder = getFolder(jaxbPackage);
}
catch (JavaModelException jme) {
- JptJaxbEclipseLinkUiPlugin.log(jme);
+ JptJaxbEclipseLinkUiPlugin.instance().logError(jme);
return;
}
Job job = new Job("Adding property to jaxb.properties.") {
@@ -119,7 +118,7 @@ public class AddEclipseLinkJaxbPropertyCommandHandler
IFile file = folder.getFile("jaxb.properties");
Properties properties = loadProperties(file);
if (properties == null) {
- return new Status(Status.ERROR, JptJaxbEclipseLinkUiPlugin.PLUGIN_ID, "Could not load jaxb.properties.");
+ return JptJaxbEclipseLinkUiPlugin.instance().buildErrorStatus("Could not load jaxb.properties.");
}
adjustProperties(properties);
InputStream stream = createInputStream(properties);
@@ -127,8 +126,8 @@ public class AddEclipseLinkJaxbPropertyCommandHandler
file.setContents(stream, true, true, null);
}
catch (CoreException ce) {
- JptJaxbEclipseLinkUiPlugin.log(ce);
- return new Status(Status.ERROR, JptJaxbEclipseLinkUiPlugin.PLUGIN_ID, "Could not write to jaxb.properties.");
+ JptJaxbEclipseLinkUiPlugin.instance().logError(ce);
+ return JptJaxbEclipseLinkUiPlugin.instance().buildErrorStatus(ce, "Could not load jaxb.properties.");
}
AddEclipseLinkJaxbPropertyCommandHandler.this.revealAndOpenFile(file, activeWindow);
return Status.OK_STATUS;
@@ -159,7 +158,7 @@ public class AddEclipseLinkJaxbPropertyCommandHandler
properties.load(file.getContents());
}
catch (Exception ex) {
- JptJaxbEclipseLinkUiPlugin.log(ex);
+ JptJaxbEclipseLinkUiPlugin.instance().logError(ex);
return null;
}
finally {
@@ -180,7 +179,7 @@ public class AddEclipseLinkJaxbPropertyCommandHandler
properties.store(outStream, null);
}
catch (Exception e) {
- JptJaxbCorePlugin.log(e);
+ JptJaxbCorePlugin.instance().logError(e);
return new ByteArrayInputStream(new byte[0]);
}
finally {
@@ -196,7 +195,7 @@ public class AddEclipseLinkJaxbPropertyCommandHandler
stream.close();
}
} catch (IOException ex) {
- JptJaxbEclipseLinkUiPlugin.log(ex);
+ JptJaxbEclipseLinkUiPlugin.instance().logError(ex);
}
}
@@ -210,8 +209,8 @@ public class AddEclipseLinkJaxbPropertyCommandHandler
IDE.openEditor(activeWindow.getActivePage(), file, true);
}
catch (PartInitException pie) {
- JptJaxbUiPlugin.log(pie);
- return new Status(Status.ERROR, JptJaxbEclipseLinkUiPlugin.PLUGIN_ID, "Could not open jaxb.properties in editor.");
+ JptJaxbEclipseLinkUiPlugin.instance().logError(pie);
+ return JptJaxbEclipseLinkUiPlugin.instance().buildErrorStatus(pie, "Could not open jaxb.properties in editor.");
}
return Status.OK_STATUS;
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/plugin/JptJaxbEclipseLinkUiPlugin.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/plugin/JptJaxbEclipseLinkUiPlugin.java
new file mode 100644
index 0000000000..fca7cfc4e6
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.ui/src/org/eclipse/jpt/jaxb/eclipselink/ui/internal/plugin/JptJaxbEclipseLinkUiPlugin.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012 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.jaxb.eclipselink.ui.internal.plugin;
+
+import org.eclipse.jpt.common.core.internal.utility.JptPlugin;
+import org.eclipse.jpt.common.ui.internal.JptUIPlugin;
+
+/**
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public class JptJaxbEclipseLinkUiPlugin
+ extends JptUIPlugin
+{
+ // ********** singleton **********
+
+ private static JptJaxbEclipseLinkUiPlugin INSTANCE;
+
+ /**
+ * Return the singleton Dali JAXB EclipseLink UI plug-in.
+ */
+ public static JptJaxbEclipseLinkUiPlugin instance() {
+ return INSTANCE;
+ }
+
+
+ // ********** Dali plug-in **********
+
+ public JptJaxbEclipseLinkUiPlugin() {
+ super();
+ }
+
+ @Override
+ protected void setInstance(JptPlugin plugin) {
+ INSTANCE = (JptJaxbEclipseLinkUiPlugin) plugin;
+ }
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/META-INF/MANIFEST.MF b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/META-INF/MANIFEST.MF
index e8031a1416..d1d5a75e2f 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/META-INF/MANIFEST.MF
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/META-INF/MANIFEST.MF
@@ -4,7 +4,7 @@ Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.jpt.jaxb.ui;singleton:=true
Bundle-Version: 1.3.0.qualifier
-Bundle-Activator: org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin
+Bundle-Activator: org.eclipse.jpt.jaxb.ui.internal.plugin.JptJaxbUiPlugin
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .
Bundle-Localization: plugin
@@ -31,8 +31,8 @@ Require-Bundle: org.eclipse.debug.core;bundle-version="[3.4.0,4.0.0)",
org.eclipse.wst.xml.core;bundle-version="[1.1.500,2.0.0)",
org.eclipse.wst.xsd.core;bundle-version="[1.1.600,2.0.0)",
org.eclipse.xsd;bundle-version="[2.6.0,3.0.0)"
-Export-Package: org.eclipse.jpt.jaxb.ui,
- org.eclipse.jpt.jaxb.ui.internal;x-internal:=true,
+Import-Package: com.ibm.icu.text;version="4.0.1"
+Export-Package: org.eclipse.jpt.jaxb.ui.internal;x-internal:=true,
org.eclipse.jpt.jaxb.ui.internal.actions;x-internal:=true,
org.eclipse.jpt.jaxb.ui.internal.commands;x-internal:=true,
org.eclipse.jpt.jaxb.ui.internal.filters;x-internal:=true,
@@ -50,4 +50,3 @@ Export-Package: org.eclipse.jpt.jaxb.ui,
org.eclipse.jpt.jaxb.ui.internal.wizards.schemagen;x-internal:=true,
org.eclipse.jpt.jaxb.ui.navigator,
org.eclipse.jpt.jaxb.ui.platform
-Import-Package: com.ibm.icu.text;version="4.0.1"
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/wizban/new_jaxb_prj_wiz.png b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/wizban/new_jaxb_prj_wiz.png
new file mode 100644
index 0000000000..95eb79dbb0
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/wizban/new_jaxb_prj_wiz.png
Binary files differ
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/JptJaxbUiPlugin.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/JptJaxbUiPlugin.java
deleted file mode 100644
index 824a4d7507..0000000000
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/JptJaxbUiPlugin.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2010 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.jaxb.ui;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.jpt.jaxb.ui.internal.platform.JaxbPlatformUiManagerImpl;
-import org.eclipse.jpt.jaxb.ui.platform.JaxbPlatformUiManager;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.eclipse.wst.xml.core.internal.XMLCorePlugin;
-import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalog;
-
-/**
- * The activator class controls the plug-in life cycle
- *
- *
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- */
-@SuppressWarnings("nls")
-public class JptJaxbUiPlugin extends AbstractUIPlugin
-{
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.jpt.jaxb.ui";
- public static final String PLUGIN_ID_ = PLUGIN_ID + '.';
-
- public static final String USER_CATALOG_ID = XMLCorePlugin.USER_CATALOG_ID; //$NON-NLS-1$
- public static final String DEFAULT_CATALOG_ID = XMLCorePlugin.DEFAULT_CATALOG_ID; //$NON-NLS-1$
- public static final String SYSTEM_CATALOG_ID = XMLCorePlugin.SYSTEM_CATALOG_ID; //$NON-NLS-1$
-
- // ********** singleton **********
- private static JptJaxbUiPlugin INSTANCE;
-
- /**
- * Returns the singleton Plugin
- */
- public static JptJaxbUiPlugin instance() {
- return INSTANCE;
- }
-
- public static void log(IStatus status) {
- INSTANCE.getLog().log(status);
- }
-
- public static void log(String msg) {
- log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, msg, null));
- }
-
- public static void log(Throwable throwable) {
- log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, throwable.getLocalizedMessage(), throwable));
- }
-
- // ********** Image API **********
- /**
- * This gets a .gif from the icons folder.
- */
- public static ImageDescriptor getImageDescriptor(String key) {
- if (! key.startsWith("icons/")) {
- key = "icons/" + key;
- }
- if (! key.endsWith(".gif")) {
- key = key + ".gif";
- }
- return imageDescriptorFromPlugin(PLUGIN_ID, key);
- }
-
- /**
- * This returns an image for a .gif from the icons folder
- */
- //TODO we are using the ImageRegistry here and storing all our icons for the life of the plugin,
- //which means until the workspace is closed. This is better than before where we constantly
- //created new images. Bug 306437 is about cleaning this up and using Local Resource Managers
- //on our views so that closing the JPA perspective would mean our icons are disposed.
- public static Image getImage(String key) {
- ImageRegistry imageRegistry = instance().getImageRegistry();
- Image image = imageRegistry.get(key);
- if (image == null) {
- imageRegistry.put(key, getImageDescriptor(key));
- image = imageRegistry.get(key);
- }
- return image;
- }
-
-
- public static JaxbPlatformUiManager getJaxbPlatformUiManager() {
- return JaxbPlatformUiManagerImpl.instance();
- }
-
-
- // ********** XMLCorePlugin API **********
-
- public ICatalog getDefaultXMLCatalog() {
- return XMLCorePlugin.getDefault().getDefaultXMLCatalog();
- }
-
- // ********** constructors **********
- public JptJaxbUiPlugin() {
- super();
- if (INSTANCE != null) {
- throw new IllegalStateException();
- }
- INSTANCE = this;
- }
-}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/ClassesGeneratorUi.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/ClassesGeneratorUi.java
index 154e971329..98062cd738 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/ClassesGeneratorUi.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/ClassesGeneratorUi.java
@@ -1,17 +1,16 @@
/*******************************************************************************
-* Copyright (c) 2010, 2012 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
-*******************************************************************************/
+ * Copyright (c) 2010, 2012 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.jaxb.ui.internal;
import java.util.List;
import java.util.Vector;
-
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.WorkspaceJob;
import org.eclipse.emf.common.util.URI;
@@ -28,8 +27,8 @@ import org.eclipse.jpt.jaxb.core.SchemaLibrary;
import org.eclipse.jpt.jaxb.core.internal.gen.ClassesGeneratorExtensionOptions;
import org.eclipse.jpt.jaxb.core.internal.gen.ClassesGeneratorOptions;
import org.eclipse.jpt.jaxb.core.xsd.XsdUtil;
-import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin;
import org.eclipse.jpt.jaxb.ui.internal.gen.GenerateJaxbClassesJob;
+import org.eclipse.jpt.jaxb.ui.internal.plugin.JptJaxbUiPlugin;
import org.eclipse.jpt.jaxb.ui.internal.wizards.classesgen.ClassesGeneratorWizard;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
@@ -120,7 +119,7 @@ public class ClassesGeneratorUi {
job.schedule();
}
catch(RuntimeException re) {
- JptJaxbUiPlugin.log(re);
+ JptJaxbUiPlugin.instance().logError(re);
String msg = re.getMessage();
String message = (msg == null) ? re.toString() : msg;
@@ -172,7 +171,7 @@ public class ClassesGeneratorUi {
/* may be null */
private JaxbProject getJaxbProject() {
- return JptJaxbCorePlugin.getJaxbProject(this.javaProject.getProject());
+ return JptJaxbCorePlugin.instance().getProjectManager().getJaxbProject(this.javaProject.getProject());
}
private boolean isOverwritingClasses(ClassesGeneratorOptions generatorOptions) {
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JaxbJavaCompletionProposalComputer.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JaxbJavaCompletionProposalComputer.java
index 0815779e2c..004e2e89f2 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JaxbJavaCompletionProposalComputer.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JaxbJavaCompletionProposalComputer.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2011, 2012 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
- *******************************************************************************/
+ * Copyright (c) 2011, 2012 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.jaxb.ui.internal;
import java.util.ArrayList;
@@ -24,16 +24,16 @@ import org.eclipse.jdt.ui.text.java.IJavaCompletionProposalComputer;
import org.eclipse.jdt.ui.text.java.JavaContentAssistInvocationContext;
import org.eclipse.jface.text.contentassist.CompletionProposal;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceCompilationUnit;
import org.eclipse.jpt.common.utility.Filter;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.jaxb.core.JaxbProject;
import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin;
import org.eclipse.jpt.jaxb.core.context.java.JavaContextNode;
-import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin;
+import org.eclipse.jpt.jaxb.ui.internal.plugin.JptJaxbUiPlugin;
public class JaxbJavaCompletionProposalComputer
@@ -101,11 +101,11 @@ public class JaxbJavaCompletionProposalComputer
IFile file = (cu != null) ? getCorrespondingResource(cu) : null;
IContentType contentType = (file != null) ? PlatformTools.getContentType(file) : null;
- if (contentType == null || ! contentType.isKindOf(JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE)) {
+ if (contentType == null || ! contentType.isKindOf(JavaResourceCompilationUnit.CONTENT_TYPE)) {
return Collections.emptyList();
}
- JaxbProject jaxbProject = JptJaxbCorePlugin.getJaxbProject(file.getProject());
+ JaxbProject jaxbProject = JptJaxbCorePlugin.instance().getProjectManager().getJaxbProject(file.getProject());
if (jaxbProject == null) {
return Collections.emptyList();
}
@@ -155,7 +155,7 @@ public class JaxbJavaCompletionProposalComputer
try {
return (IFile) cu.getCorrespondingResource();
} catch (JavaModelException ex) {
- JptJaxbUiPlugin.log(ex);
+ JptJaxbUiPlugin.instance().logError(ex);
return null;
}
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JaxbMappingImageHelper.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JaxbMappingImageHelper.java
index 4c0ddd7a7b..b6836f5061 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JaxbMappingImageHelper.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JaxbMappingImageHelper.java
@@ -1,17 +1,16 @@
/*******************************************************************************
- * Copyright (c) 2011 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
- *******************************************************************************/
+ * Copyright (c) 2011, 2012 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.jaxb.ui.internal;
import org.eclipse.jpt.jaxb.core.MappingKeys;
-import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin;
+import org.eclipse.jpt.jaxb.ui.internal.plugin.JptJaxbUiPlugin;
import org.eclipse.swt.graphics.Image;
public class JaxbMappingImageHelper
@@ -38,7 +37,7 @@ public class JaxbMappingImageHelper
// }
public static Image imageForAttributeMapping(String mappingKey) {
- return JptJaxbUiPlugin.getImage(iconKeyForAttributeMapping(mappingKey));
+ return JptJaxbUiPlugin.instance().getImage(iconKeyForAttributeMapping(mappingKey));
}
public static String iconKeyForAttributeMapping(String mappingKey) {
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/commands/CreatePackageInfoCommandHandler.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/commands/CreatePackageInfoCommandHandler.java
index ec18089158..71aebe10c2 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/commands/CreatePackageInfoCommandHandler.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/commands/CreatePackageInfoCommandHandler.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
+ * Copyright (c) 2012 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.jaxb.ui.internal.commands;
import java.util.Iterator;
@@ -23,7 +23,7 @@ import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.jaxb.core.context.JaxbPackage;
-import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin;
+import org.eclipse.jpt.jaxb.ui.internal.plugin.JptJaxbUiPlugin;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.handlers.HandlerUtil;
@@ -51,7 +51,7 @@ public class CreatePackageInfoCommandHandler
IDE.openEditor(activeWindow.getActivePage(), file, true);
}
catch (PartInitException pie) {
- JptJaxbUiPlugin.log(pie);
+ JptJaxbUiPlugin.instance().logError(pie);
}
}
@@ -68,7 +68,7 @@ public class CreatePackageInfoCommandHandler
this.createdFiles.add((IFile) cu.getCorrespondingResource());
}
catch (JavaModelException jme) {
- JptJaxbUiPlugin.log(jme);
+ JptJaxbUiPlugin.instance().logError(jme);
}
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/gen/GenerateJaxbClassesJob.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/gen/GenerateJaxbClassesJob.java
index 11cc53f86e..65ef9f7f1b 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/gen/GenerateJaxbClassesJob.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/gen/GenerateJaxbClassesJob.java
@@ -1,12 +1,12 @@
/*******************************************************************************
-* Copyright (c) 2012 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
-*******************************************************************************/
+ * Copyright (c) 2010, 2012 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.jaxb.ui.internal.gen;
import org.eclipse.jdt.core.IJavaProject;
@@ -16,8 +16,8 @@ import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.jaxb.core.internal.gen.ClassesGenerator;
import org.eclipse.jpt.jaxb.core.internal.gen.ClassesGeneratorExtensionOptions;
import org.eclipse.jpt.jaxb.core.internal.gen.ClassesGeneratorOptions;
-import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin;
import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiMessages;
+import org.eclipse.jpt.jaxb.ui.internal.plugin.JptJaxbUiPlugin;
/**
* GenerateJaxbClassesJob
@@ -91,6 +91,6 @@ public class GenerateJaxbClassesJob extends AbstractJptGenerateJob {
@Override
protected void jptPluginLogException(Exception exception) {
- JptJaxbUiPlugin.log(exception);
+ JptJaxbUiPlugin.instance().logError(exception);
}
} \ No newline at end of file
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/GenericJaxb_2_1_NavigatorItemLabelProviderFactory.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/GenericJaxb_2_1_NavigatorItemLabelProviderFactory.java
index 58bc367db3..33cb0dea08 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/GenericJaxb_2_1_NavigatorItemLabelProviderFactory.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/GenericJaxb_2_1_NavigatorItemLabelProviderFactory.java
@@ -18,9 +18,9 @@ import org.eclipse.jpt.jaxb.core.context.JaxbEnum;
import org.eclipse.jpt.jaxb.core.context.JaxbEnumConstant;
import org.eclipse.jpt.jaxb.core.context.JaxbPackage;
import org.eclipse.jpt.jaxb.core.context.JaxbPersistentAttribute;
-import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin;
import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiIcons;
import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiMessages;
+import org.eclipse.jpt.jaxb.ui.internal.plugin.JptJaxbUiPlugin;
public class GenericJaxb_2_1_NavigatorItemLabelProviderFactory
@@ -67,7 +67,7 @@ public class GenericJaxb_2_1_NavigatorItemLabelProviderFactory
protected ItemExtendedLabelProvider buildJaxbContextRootProvider(JaxbContextRoot root, @SuppressWarnings("unused") ItemExtendedLabelProvider.Manager manager) {
return new StaticItemExtendedLabelProvider(
- JptJaxbUiPlugin.getImage(JptJaxbUiIcons.JAXB_CONTENT),
+ JptJaxbUiPlugin.instance().getImage(JptJaxbUiIcons.JAXB_CONTENT),
JptJaxbUiMessages.JaxbContent_label,
this.buildJaxbContextRootDescription(root)
);
@@ -83,14 +83,14 @@ public class GenericJaxb_2_1_NavigatorItemLabelProviderFactory
protected ItemExtendedLabelProvider buildJaxbEnumConstantProvider(JaxbEnumConstant enumConstant, @SuppressWarnings("unused") ItemExtendedLabelProvider.Manager manager) {
return new StaticItemExtendedLabelProvider(
- JptJaxbUiPlugin.getImage(JptJaxbUiIcons.ENUM_CONSTANT),
+ JptJaxbUiPlugin.instance().getImage(JptJaxbUiIcons.ENUM_CONSTANT),
enumConstant.getName()
);
}
protected ItemExtendedLabelProvider buildJaxbPackageProvider(JaxbPackage pkg, @SuppressWarnings("unused") ItemExtendedLabelProvider.Manager manager) {
return new StaticItemExtendedLabelProvider(
- JptJaxbUiPlugin.getImage(JptJaxbUiIcons.PACKAGE),
+ JptJaxbUiPlugin.instance().getImage(JptJaxbUiIcons.PACKAGE),
pkg.getName(),
this.buildJaxbPackageDescription(pkg)
);
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbClassItemLabelProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbClassItemLabelProvider.java
index 1b5db6e35c..6215510d1d 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbClassItemLabelProvider.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbClassItemLabelProvider.java
@@ -20,8 +20,8 @@ import org.eclipse.jpt.jaxb.core.context.JaxbClass;
import org.eclipse.jpt.jaxb.core.context.JaxbClassMapping;
import org.eclipse.jpt.jaxb.core.context.JaxbType;
import org.eclipse.jpt.jaxb.core.context.JaxbTypeMapping;
-import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin;
import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiIcons;
+import org.eclipse.jpt.jaxb.ui.internal.plugin.JptJaxbUiPlugin;
import org.eclipse.swt.graphics.Image;
@@ -100,13 +100,13 @@ public class JaxbClassItemLabelProvider
protected Image buildValue_() {
if (this.mappingModel.getValue() != null) {
if (this.isXmlTransientModel.getValue() == Boolean.TRUE) {
- return JptJaxbUiPlugin.getImage(JptJaxbUiIcons.JAXB_TRANSIENT_CLASS);
+ return JptJaxbUiPlugin.instance().getImage(JptJaxbUiIcons.JAXB_TRANSIENT_CLASS);
}
}
else if (this.isXmlRegistryModel.getValue() == Boolean.TRUE) {
- return JptJaxbUiPlugin.getImage(JptJaxbUiIcons.JAXB_REGISTRY);
+ return JptJaxbUiPlugin.instance().getImage(JptJaxbUiIcons.JAXB_REGISTRY);
}
- return JptJaxbUiPlugin.getImage(JptJaxbUiIcons.JAXB_CLASS);
+ return JptJaxbUiPlugin.instance().getImage(JptJaxbUiIcons.JAXB_CLASS);
}
@Override
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbEnumItemLabelProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbEnumItemLabelProvider.java
index 40a36bffb2..bdef1b1d44 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbEnumItemLabelProvider.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbEnumItemLabelProvider.java
@@ -19,8 +19,8 @@ import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
import org.eclipse.jpt.jaxb.core.context.JaxbEnum;
import org.eclipse.jpt.jaxb.core.context.JaxbEnumMapping;
import org.eclipse.jpt.jaxb.core.context.JaxbType;
-import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin;
import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiIcons;
+import org.eclipse.jpt.jaxb.ui.internal.plugin.JptJaxbUiPlugin;
import org.eclipse.swt.graphics.Image;
@@ -87,10 +87,10 @@ public class JaxbEnumItemLabelProvider
protected Image buildValue_() {
if (this.mappingModel.getValue() != null) {
if (this.isXmlTransientModel.getValue() == Boolean.TRUE) {
- return JptJaxbUiPlugin.getImage(JptJaxbUiIcons.JAXB_TRANSIENT_ENUM);
+ return JptJaxbUiPlugin.instance().getImage(JptJaxbUiIcons.JAXB_TRANSIENT_ENUM);
}
}
- return JptJaxbUiPlugin.getImage(JptJaxbUiIcons.JAXB_ENUM);
+ return JptJaxbUiPlugin.instance().getImage(JptJaxbUiIcons.JAXB_ENUM);
}
@Override
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorContentProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorContentProvider.java
index 134eb9fd1a..9e0129a935 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorContentProvider.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorContentProvider.java
@@ -29,7 +29,7 @@ import org.eclipse.jpt.jaxb.core.JaxbProject;
import org.eclipse.jpt.jaxb.core.JaxbProjectManager;
import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin;
import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription;
-import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin;
+import org.eclipse.jpt.jaxb.ui.internal.plugin.JptJaxbUiPlugin;
import org.eclipse.jpt.jaxb.ui.platform.JaxbPlatformUi;
/**
@@ -53,7 +53,7 @@ public class JaxbNavigatorContentProvider
public JaxbNavigatorContentProvider() {
super();
this.jaxbProjectListener = this.buildJaxbProjectListener();
- JptJaxbCorePlugin.getProjectManager().addCollectionChangeListener(JaxbProjectManager.JAXB_PROJECTS_COLLECTION, this.jaxbProjectListener);
+ JptJaxbCorePlugin.instance().getProjectManager().addCollectionChangeListener(JaxbProjectManager.JAXB_PROJECTS_COLLECTION, this.jaxbProjectListener);
}
protected CollectionChangeListener buildJaxbProjectListener() {
@@ -82,7 +82,7 @@ public class JaxbNavigatorContentProvider
IProject project = (IProject) ((IAdaptable) element).getAdapter(IProject.class);
if (project != null) {
- JaxbProject jaxbProject = JptJaxbCorePlugin.getJaxbProject(project);
+ JaxbProject jaxbProject = JptJaxbCorePlugin.instance().getProjectManager().getJaxbProject(project);
if (jaxbProject != null) {
JaxbPlatformDescription desc = jaxbProject.getPlatform().getDescription();
JaxbPlatformUi platformUi =
@@ -101,7 +101,7 @@ public class JaxbNavigatorContentProvider
IProject project = (IProject) ((IAdaptable) parentElement).getAdapter(IProject.class);
if (project != null) {
- JaxbProject jaxbProject = JptJaxbCorePlugin.getJaxbProject(project);
+ JaxbProject jaxbProject = JptJaxbCorePlugin.instance().getProjectManager().getJaxbProject(project);
if (jaxbProject != null) {
JaxbPlatformDescription desc = jaxbProject.getPlatform().getDescription();
JaxbPlatformUi platformUi =
@@ -119,7 +119,7 @@ public class JaxbNavigatorContentProvider
@Override
public void dispose() {
super.dispose();
- JptJaxbCorePlugin.getProjectManager().removeCollectionChangeListener(JaxbProjectManager.JAXB_PROJECTS_COLLECTION, this.jaxbProjectListener);
+ JptJaxbCorePlugin.instance().getProjectManager().removeCollectionChangeListener(JaxbProjectManager.JAXB_PROJECTS_COLLECTION, this.jaxbProjectListener);
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorItemLabelProviderFactory.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorItemLabelProviderFactory.java
index fe25b2d926..4763a63deb 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorItemLabelProviderFactory.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorItemLabelProviderFactory.java
@@ -16,7 +16,7 @@ import org.eclipse.jpt.common.ui.jface.ItemExtendedLabelProvider;
import org.eclipse.jpt.common.ui.jface.ItemExtendedLabelProviderFactory;
import org.eclipse.jpt.jaxb.core.context.JaxbContextNode;
import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription;
-import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin;
+import org.eclipse.jpt.jaxb.ui.internal.plugin.JptJaxbUiPlugin;
import org.eclipse.jpt.jaxb.ui.platform.JaxbPlatformUi;
public class JaxbNavigatorItemLabelProviderFactory
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorTreeItemContentProviderFactory.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorTreeItemContentProviderFactory.java
index 5c6f3979bd..95bd99cb75 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorTreeItemContentProviderFactory.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorTreeItemContentProviderFactory.java
@@ -15,7 +15,7 @@ import org.eclipse.jpt.common.ui.jface.ItemTreeContentProvider;
import org.eclipse.jpt.common.ui.jface.ItemTreeContentProviderFactory;
import org.eclipse.jpt.jaxb.core.context.JaxbContextNode;
import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription;
-import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin;
+import org.eclipse.jpt.jaxb.ui.internal.plugin.JptJaxbUiPlugin;
import org.eclipse.jpt.jaxb.ui.platform.JaxbPlatformUi;
public class JaxbNavigatorTreeItemContentProviderFactory
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/platform/JaxbPlatformUiManagerImpl.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/platform/JaxbPlatformUiManagerImpl.java
index 9a82bc98d8..affda0a90f 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/platform/JaxbPlatformUiManagerImpl.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/platform/JaxbPlatformUiManagerImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2012 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.
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jaxb.ui.internal.platform;
-import static org.eclipse.jpt.common.core.internal.utility.XPointTools.*;
+import static org.eclipse.jpt.common.core.internal.utility.XPointTools.findRequiredAttribute;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.runtime.IConfigurationElement;
@@ -17,11 +17,13 @@ import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.jpt.common.core.internal.JptCommonCoreMessages;
+import org.eclipse.jpt.common.core.internal.utility.XPointTools;
import org.eclipse.jpt.common.core.internal.utility.XPointTools.XPointException;
import org.eclipse.jpt.common.utility.internal.KeyedSet;
import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin;
import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription;
-import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin;
+import org.eclipse.jpt.jaxb.ui.internal.plugin.JptJaxbUiPlugin;
import org.eclipse.jpt.jaxb.ui.platform.JaxbPlatformUi;
import org.eclipse.jpt.jaxb.ui.platform.JaxbPlatformUiManager;
@@ -29,7 +31,7 @@ public class JaxbPlatformUiManagerImpl
implements JaxbPlatformUiManager {
static final String EXTENSION_POINT_ID = "jaxbPlatformUis"; //$NON-NLS-1$
- static final String QUALIFIED_EXTENSION_POINT_ID = JptJaxbUiPlugin.PLUGIN_ID_ + EXTENSION_POINT_ID; //$NON-NLS-1$
+ static final String QUALIFIED_EXTENSION_POINT_ID = JptJaxbUiPlugin.instance().getPluginID() + '.' + EXTENSION_POINT_ID; //$NON-NLS-1$
static final String PLATFORM_UI_ELEMENT = "jaxbPlatformUi"; //$NON-NLS-1$
static final String ID_ATTRIBUTE = "id"; //$NON-NLS-1$
static final String PLATFORM_ATTRIBUTE = "jaxbPlatform"; //$NON-NLS-1$
@@ -62,7 +64,7 @@ public class JaxbPlatformUiManagerImpl
final IExtensionRegistry registry = Platform.getExtensionRegistry();
final IExtensionPoint xpoint
- = registry.getExtensionPoint(JptJaxbUiPlugin.PLUGIN_ID, EXTENSION_POINT_ID);
+ = registry.getExtensionPoint(JptJaxbUiPlugin.instance().getPluginID(), EXTENSION_POINT_ID);
if (xpoint == null) {
throw new IllegalStateException();
@@ -94,7 +96,7 @@ public class JaxbPlatformUiManagerImpl
platformUiConfig.setId(findRequiredAttribute(element, ID_ATTRIBUTE));
if (this.platformUiConfigs.containsKey(platformUiConfig.getId())) {
- logDuplicateExtension(QUALIFIED_EXTENSION_POINT_ID, ID_ATTRIBUTE, platformUiConfig.getId());
+ this.logError(JptCommonCoreMessages.REGISTRY_DUPLICATE, QUALIFIED_EXTENSION_POINT_ID, platformUiConfig.getPluginId(), ID_ATTRIBUTE, platformUiConfig.getId());
throw new XPointException();
}
@@ -104,11 +106,11 @@ public class JaxbPlatformUiManagerImpl
JptJaxbCorePlugin.getJaxbPlatformManager().getJaxbPlatform(jaxbPlatformId);
if (jaxbPlatform == null) {
- logInvalidValue(element, PLATFORM_ATTRIBUTE, jaxbPlatformId);
+ this.logError(XPointTools.buildInvalidValueMessage(element, PLATFORM_ATTRIBUTE, jaxbPlatformId));
}
if (this.platformToUiConfigs.containsKey(jaxbPlatform)) {
- logDuplicateExtension(QUALIFIED_EXTENSION_POINT_ID, PLATFORM_ATTRIBUTE, jaxbPlatformId);
+ this.logError(JptCommonCoreMessages.REGISTRY_DUPLICATE, QUALIFIED_EXTENSION_POINT_ID, platformUiConfig.getPluginId(), PLATFORM_ATTRIBUTE, jaxbPlatformId);
throw new XPointException();
}
@@ -130,4 +132,12 @@ public class JaxbPlatformUiManagerImpl
JaxbPlatformUiConfig config = this.platformToUiConfigs.getItem(platformDesc);
return (config == null) ? null : config.getPlatformUi();
}
+
+ private void logError(String msg, Object... args) {
+ JptJaxbUiPlugin.instance().logError(msg, args);
+ }
+
+ private void logError(String msg) {
+ JptJaxbUiPlugin.instance().logError(msg);
+ }
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/plugin/JptJaxbUiPlugin.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/plugin/JptJaxbUiPlugin.java
new file mode 100644
index 0000000000..d6b0b25c56
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/plugin/JptJaxbUiPlugin.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2012 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.jaxb.ui.internal.plugin;
+
+import org.eclipse.jpt.common.core.internal.utility.JptPlugin;
+import org.eclipse.jpt.common.ui.internal.JptUIPlugin;
+import org.eclipse.jpt.jaxb.ui.internal.platform.JaxbPlatformUiManagerImpl;
+import org.eclipse.jpt.jaxb.ui.platform.JaxbPlatformUiManager;
+
+/**
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public class JptJaxbUiPlugin
+ extends JptUIPlugin
+{
+ // ********** singleton **********
+
+ private static JptJaxbUiPlugin INSTANCE;
+
+ /**
+ * Return the singleton Dali JAXB UI plug-in.
+ */
+ public static JptJaxbUiPlugin instance() {
+ return INSTANCE;
+ }
+
+
+ // ********** Dali plug-in **********
+
+ public JptJaxbUiPlugin() {
+ super();
+ }
+
+ @Override
+ protected void setInstance(JptPlugin plugin) {
+ INSTANCE = (JptJaxbUiPlugin) plugin;
+ }
+
+
+ // ********** misc **********
+
+ public static JaxbPlatformUiManager getJaxbPlatformUiManager() {
+ return JaxbPlatformUiManagerImpl.instance();
+ }
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbProjectModel.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbProjectModel.java
index a7c219623c..e698f75067 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbProjectModel.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbProjectModel.java
@@ -61,20 +61,20 @@ class JaxbProjectModel
@Override
protected void engageSubject_() {
- JptJaxbCorePlugin.getProjectManager().addCollectionChangeListener(
+ JptJaxbCorePlugin.instance().getProjectManager().addCollectionChangeListener(
JaxbProjectManager.JAXB_PROJECTS_COLLECTION,
this.projectManagerListener);
}
@Override
protected void disengageSubject_() {
- JptJaxbCorePlugin.getProjectManager().removeCollectionChangeListener(
+ JptJaxbCorePlugin.instance().getProjectManager().removeCollectionChangeListener(
JaxbProjectManager.JAXB_PROJECTS_COLLECTION,
this.projectManagerListener);
}
@Override
protected JaxbProject buildValue_() {
- return JptJaxbCorePlugin.getJaxbProject(this.subject);
+ return JptJaxbCorePlugin.instance().getProjectManager().getJaxbProject(this.subject);
}
} \ No newline at end of file
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbProjectPropertiesPage.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbProjectPropertiesPage.java
index dfd89c363b..921536e1de 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbProjectPropertiesPage.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbProjectPropertiesPage.java
@@ -21,7 +21,7 @@ import org.eclipse.jpt.common.ui.internal.utility.swt.SWTTools;
import org.eclipse.jpt.common.utility.internal.StringConverter;
import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
import org.eclipse.jpt.common.utility.internal.model.value.AspectPropertyValueModelAdapter;
-import org.eclipse.jpt.common.utility.internal.model.value.BufferedWritablePropertyValueModel;
+import org.eclipse.jpt.common.utility.internal.model.value.BufferedModifiablePropertyValueModel;
import org.eclipse.jpt.common.utility.internal.model.value.CompositeCollectionValueModel;
import org.eclipse.jpt.common.utility.internal.model.value.PropertyCollectionValueModelAdapter;
import org.eclipse.jpt.common.utility.internal.model.value.SetCollectionValueModel;
@@ -62,7 +62,7 @@ public class JaxbProjectPropertiesPage
private PropertyValueModel<JaxbProject> jaxbProjectModel;
- private BufferedWritablePropertyValueModel<JaxbPlatformDescription> platformModel;
+ private BufferedModifiablePropertyValueModel<JaxbPlatformDescription> platformModel;
private PropertyChangeListener platformListener;
/* private */ static final Comparator<String> STRING_COMPARATOR = new ICUStringCollator();
@@ -85,8 +85,8 @@ public class JaxbProjectPropertiesPage
// ***** platform ID model
- private BufferedWritablePropertyValueModel<JaxbPlatformDescription> buildPlatformModel() {
- return new BufferedWritablePropertyValueModel<JaxbPlatformDescription>(
+ private BufferedModifiablePropertyValueModel<JaxbPlatformDescription> buildPlatformModel() {
+ return new BufferedModifiablePropertyValueModel<JaxbPlatformDescription>(
new PlatformModel(this.jaxbProjectModel), this.trigger);
}
@@ -252,12 +252,12 @@ public class JaxbProjectPropertiesPage
@Override
protected void rebuildProject() {
// if the JAXB platform is changed, we need to completely rebuild the JAXB project
- JptJaxbCorePlugin.getProjectManager().rebuildJaxbProject(getProject());
+ JptJaxbCorePlugin.instance().getProjectManager().rebuildJaxbProject(getProject());
}
@Override
- protected BufferedWritablePropertyValueModel<?>[] buildBufferedModels() {
- return new BufferedWritablePropertyValueModel[] {
+ protected BufferedModifiablePropertyValueModel<?>[] buildBufferedModels() {
+ return new BufferedModifiablePropertyValueModel[] {
this.platformModel
};
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbSchemasPropertiesPage.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbSchemasPropertiesPage.java
index 7830ebd110..d860d1dd7b 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbSchemasPropertiesPage.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbSchemasPropertiesPage.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2010, 2012 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
- *******************************************************************************/
+ * Copyright (c) 2010, 2012 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.jaxb.ui.internal.properties;
import java.lang.reflect.InvocationTargetException;
@@ -51,7 +51,7 @@ import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable;
import org.eclipse.jpt.common.utility.internal.model.AbstractModel;
import org.eclipse.jpt.common.utility.internal.model.value.AspectAdapter;
-import org.eclipse.jpt.common.utility.internal.model.value.BufferedWritablePropertyValueModel;
+import org.eclipse.jpt.common.utility.internal.model.value.BufferedModifiablePropertyValueModel;
import org.eclipse.jpt.common.utility.internal.model.value.CollectionPropertyValueModelAdapter;
import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapter;
import org.eclipse.jpt.common.utility.internal.model.value.SimpleCollectionValueModel;
@@ -101,7 +101,7 @@ public class JaxbSchemasPropertiesPage
private final PropertyValueModel<JaxbProject> jaxbProjectModel;
- protected final BufferedWritablePropertyValueModel.Trigger trigger;
+ protected final BufferedModifiablePropertyValueModel.Trigger trigger;
private final SchemasModel schemasModel;
@@ -112,7 +112,7 @@ public class JaxbSchemasPropertiesPage
super();
this.projectModel = new SimplePropertyValueModel<IProject>();
this.jaxbProjectModel = new JaxbProjectModel(this.projectModel);
- this.trigger = new BufferedWritablePropertyValueModel.Trigger();
+ this.trigger = new BufferedModifiablePropertyValueModel.Trigger();
this.schemasModel = new SchemasModel(this.jaxbProjectModel, this.trigger);
this.schemasSelectionModel = new SimpleCollectionValueModel<Schema>();
setDescription(JptJaxbUiMessages.SchemasPage_description);
@@ -393,7 +393,7 @@ public class JaxbSchemasPropertiesPage
void performOk_(IProgressMonitor monitor) throws CoreException {
if (this.schemasModel.hasChanges()) {
this.trigger.accept();
- JptJaxbCorePlugin.getProjectManager().rebuildJaxbProject(getProject());
+ JptJaxbCorePlugin.instance().getProjectManager().rebuildJaxbProject(getProject());
getProject().build(IncrementalProjectBuilder.FULL_BUILD, monitor);
}
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorExtensionOptionsWizardPage.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorExtensionOptionsWizardPage.java
index a584b54d4a..1dc30c213d 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorExtensionOptionsWizardPage.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorExtensionOptionsWizardPage.java
@@ -1,12 +1,12 @@
/*******************************************************************************
-* Copyright (c) 2010, 2012 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
-*******************************************************************************/
+ * Copyright (c) 2010, 2012 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.jaxb.ui.internal.wizards.classesgen;
import org.eclipse.core.resources.IProject;
@@ -14,8 +14,8 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.jaxb.core.JaxbFacet;
-import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin;
import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiMessages;
+import org.eclipse.jpt.jaxb.ui.internal.plugin.JptJaxbUiPlugin;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
@@ -106,7 +106,7 @@ public class ClassesGeneratorExtensionOptionsWizardPage extends WizardPage
facetedProject = ProjectFacetsManager.create(this.getProject());
}
catch(CoreException e) {
- JptJaxbUiPlugin.log(e);
+ JptJaxbUiPlugin.instance().logError(e);
return null;
}
return (facetedProject == null) ? null : facetedProject.getProjectFacetVersion(JaxbFacet.FACET);
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorWizard.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorWizard.java
index a0412a1671..4a96eaddac 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorWizard.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorWizard.java
@@ -1,17 +1,16 @@
/*******************************************************************************
-* Copyright (c) 2010, 2012 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
-*******************************************************************************/
+ * Copyright (c) 2010, 2012 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.jaxb.ui.internal.wizards.classesgen;
import java.util.List;
import java.util.Vector;
-
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
@@ -34,10 +33,10 @@ import org.eclipse.jpt.jaxb.core.SchemaLibrary;
import org.eclipse.jpt.jaxb.core.internal.gen.ClassesGeneratorExtensionOptions;
import org.eclipse.jpt.jaxb.core.internal.gen.ClassesGeneratorOptions;
import org.eclipse.jpt.jaxb.core.xsd.XsdUtil;
-import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin;
import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiIcons;
import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiMessages;
import org.eclipse.jpt.jaxb.ui.internal.gen.GenerateJaxbClassesJob;
+import org.eclipse.jpt.jaxb.ui.internal.plugin.JptJaxbUiPlugin;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;
@@ -96,7 +95,7 @@ public class ClassesGeneratorWizard
this.selection = selection;
this.setWindowTitle(JptJaxbUiMessages.ClassesGeneratorWizard_title);
- this.setDefaultPageImageDescriptor(JptJaxbUiPlugin.getImageDescriptor(JptJaxbUiIcons.CLASSES_GEN_WIZ_BANNER));
+ this.setDefaultPageImageDescriptor(JptJaxbUiPlugin.instance().buildImageDescriptor(JptJaxbUiIcons.CLASSES_GEN_WIZ_BANNER));
this.setNeedsProgressMonitor(true);
}
@@ -179,7 +178,7 @@ public class ClassesGeneratorWizard
/* may be null */
private JaxbProject getJaxbProject() {
- return JptJaxbCorePlugin.getJaxbProject(getJavaProject().getProject());
+ return JptJaxbCorePlugin.instance().getProjectManager().getJaxbProject(getJavaProject().getProject());
}
/* return the physical location of the schema */
@@ -339,7 +338,7 @@ public class ClassesGeneratorWizard
folder.create(true, true, null);
}
catch (CoreException e) {
- JptJaxbUiPlugin.log(e);
+ JptJaxbUiPlugin.instance().logError(e);
this.logError(NLS.bind(
JptJaxbUiMessages.ClassesGeneratorWizard_couldNotCreate,
@@ -363,7 +362,7 @@ public class ClassesGeneratorWizard
generateJaxbClassesJob.schedule();
}
catch(RuntimeException re) {
- JptJaxbUiPlugin.log(re);
+ JptJaxbUiPlugin.instance().logError(re);
String msg = re.getMessage();
String message = (msg == null) ? re.toString() : msg;
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorWizardPage.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorWizardPage.java
index 12773e3828..3c478333d2 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorWizardPage.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorWizardPage.java
@@ -1,17 +1,16 @@
/*******************************************************************************
-* Copyright (c) 2010, 2012 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
-*******************************************************************************/
+ * Copyright (c) 2010, 2012 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.jaxb.ui.internal.wizards.classesgen;
import java.util.ArrayList;
import java.util.Collection;
-
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
@@ -56,8 +55,8 @@ import org.eclipse.jpt.jaxb.core.internal.gen.ClassesGenerator;
import org.eclipse.jpt.jaxb.core.internal.prefs.JaxbPreferencesManager;
import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription;
import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformGroupDescription;
-import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin;
import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiMessages;
+import org.eclipse.jpt.jaxb.ui.internal.plugin.JptJaxbUiPlugin;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
@@ -243,7 +242,7 @@ public class ClassesGeneratorWizardPage extends NewTypeWizardPage {
return true;
}
catch (JavaModelException e) {
- JptJaxbUiPlugin.log(e); // just log, no UI in validation
+ JptJaxbUiPlugin.instance().logError(e); // just log, no UI in validation
}
return false;
}
@@ -258,7 +257,7 @@ public class ClassesGeneratorWizardPage extends NewTypeWizardPage {
return (((IPackageFragmentRoot)element).getKind() == IPackageFragmentRoot.K_SOURCE);
}
catch (JavaModelException e) {
- JptJaxbUiPlugin.log(e.getStatus()); // just log, no UI in validation
+ JptJaxbUiPlugin.instance().logError(e); // just log, no UI in validation
return false;
}
}
@@ -452,7 +451,7 @@ public class ClassesGeneratorWizardPage extends NewTypeWizardPage {
}
private boolean projectPlatformIsJaxb() {
- return JptJaxbCorePlugin.getJaxbProject(this.getJavaProject().getProject()) != null;
+ return JptJaxbCorePlugin.instance().getProjectManager().getJaxbProject(this.getJavaProject().getProject()) != null;
}
private boolean projectJaxbPlatformIsEclipseLink() {
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/SelectFileOrXMLCatalogIdPanel.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/SelectFileOrXMLCatalogIdPanel.java
index da4cdc8c87..c2e8fd787b 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/SelectFileOrXMLCatalogIdPanel.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/SelectFileOrXMLCatalogIdPanel.java
@@ -17,8 +17,8 @@ import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin;
import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiMessages;
+import org.eclipse.jpt.jaxb.ui.internal.plugin.JptJaxbUiPlugin;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
@@ -28,6 +28,7 @@ import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.part.PageBook;
+import org.eclipse.wst.xml.core.internal.XMLCorePlugin;
import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalog;
import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalogEntry;
@@ -76,7 +77,7 @@ public class SelectFileOrXMLCatalogIdPanel extends Composite implements Selectio
this.setSingleFileViewDefaultSelection(selection);
// Catalog
- ICatalog xmlCatalog = JptJaxbUiPlugin.instance().getDefaultXMLCatalog();
+ ICatalog xmlCatalog = XMLCorePlugin.getDefault().getDefaultXMLCatalog();
selectXMLCatalogIdPanel = new SelectXMLCatalogIdPanel(pageBook, xmlCatalog);
selectXMLCatalogIdPanel.getTableViewer().addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/SelectXMLCatalogIdPanel.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/SelectXMLCatalogIdPanel.java
index 111684b49b..4e6f9da052 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/SelectXMLCatalogIdPanel.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/SelectXMLCatalogIdPanel.java
@@ -16,13 +16,14 @@ import java.util.List;
import java.util.Vector;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin;
import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiMessages;
+import org.eclipse.jpt.jaxb.ui.internal.plugin.JptJaxbUiPlugin;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
+import org.eclipse.wst.xml.core.internal.XMLCorePlugin;
import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalog;
import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalogEntry;
import org.eclipse.wst.xml.core.internal.catalog.provisional.INextCatalog;
@@ -94,12 +95,12 @@ public class SelectXMLCatalogIdPanel extends Composite {
INextCatalog catalog = nextCatalogs[i];
ICatalog referencedCatalog = catalog.getReferencedCatalog();
if (referencedCatalog != null) {
- if (JptJaxbUiPlugin.SYSTEM_CATALOG_ID.equals(referencedCatalog.getId())) {
+ if (XMLCorePlugin.SYSTEM_CATALOG_ID.equals(referencedCatalog.getId())) {
ICatalog systemCatalog = referencedCatalog;
addXMLCatalogEntries(result, systemCatalog.getCatalogEntries());
}
- else if (JptJaxbUiPlugin.USER_CATALOG_ID.equals(referencedCatalog.getId())) {
+ else if (XMLCorePlugin.USER_CATALOG_ID.equals(referencedCatalog.getId())) {
ICatalog userCatalog = referencedCatalog;
addXMLCatalogEntries(result, userCatalog.getCatalogEntries());
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/XMLCatalogTableViewer.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/XMLCatalogTableViewer.java
index 4a24f1c36b..5ba8b02336 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/XMLCatalogTableViewer.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/XMLCatalogTableViewer.java
@@ -25,7 +25,7 @@ import org.eclipse.jface.viewers.TableLayout;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin;
+import org.eclipse.jpt.jaxb.ui.internal.plugin.JptJaxbUiPlugin;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
@@ -40,10 +40,10 @@ public class XMLCatalogTableViewer extends TableViewer {
protected static String ERROR_STATE_KEY = "errorstatekey"; //$NON-NLS-1$
- protected static Image dtdFileImage = JptJaxbUiPlugin.getImage("icons/full/obj16/dtdfile.gif"); //$NON-NLS-1$
- protected static Image unknownFileImage = JptJaxbUiPlugin.getImage("icons/full/obj16/text.gif"); //$NON-NLS-1$
- protected static Image xsdFileImage = JptJaxbUiPlugin.getImage("icons/full/obj16/XSDFile.gif"); //$NON-NLS-1$
- protected static Image errorImage = JptJaxbUiPlugin.getImage("icons/full/ovr16/error_ovr.gif"); //$NON-NLS-1$
+ protected static Image dtdFileImage = JptJaxbUiPlugin.instance().getImage("full/obj16/dtdfile"); //$NON-NLS-1$
+ protected static Image unknownFileImage = JptJaxbUiPlugin.instance().getImage("full/obj16/text"); //$NON-NLS-1$
+ protected static Image xsdFileImage = JptJaxbUiPlugin.instance().getImage("full/obj16/XSDFile"); //$NON-NLS-1$
+ protected static Image errorImage = JptJaxbUiPlugin.instance().getImage("full/ovr16/error_ovr"); //$NON-NLS-1$
// ********** constructor **********
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/JaxbFacetPage.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/JaxbFacetPage.java
index d2897cd77d..013696b8ad 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/JaxbFacetPage.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/JaxbFacetPage.java
@@ -1,21 +1,21 @@
/*******************************************************************************
- * Copyright (c) 2010, 2011 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
- *******************************************************************************/
+ * Copyright (c) 2010, 2012 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.jaxb.ui.internal.wizards.facet;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jpt.jaxb.core.internal.facet.JaxbFacetDataModelProperties;
-import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin;
import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiIcons;
import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiMessages;
+import org.eclipse.jpt.jaxb.ui.internal.plugin.JptJaxbUiPlugin;
import org.eclipse.jst.common.project.facet.core.libprov.LibraryInstallDelegate;
import org.eclipse.jst.common.project.facet.ui.libprov.LibraryProviderFrameworkUi;
import org.eclipse.swt.SWT;
@@ -39,7 +39,7 @@ public abstract class JaxbFacetPage
super(pageName);
setTitle(JptJaxbUiMessages.JaxbFacetWizardPage_title);
setDescription(JptJaxbUiMessages.JaxbFacetWizardPage_desc);
- setImageDescriptor(JptJaxbUiPlugin.getImageDescriptor(JptJaxbUiIcons.JAXB_WIZ_BANNER));
+ setImageDescriptor(JptJaxbUiPlugin.instance().buildImageDescriptor(JptJaxbUiIcons.JAXB_WIZ_BANNER));
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/proj/JaxbProjectWizard.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/proj/JaxbProjectWizard.java
index 696d4cee32..49dce38650 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/proj/JaxbProjectWizard.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/proj/JaxbProjectWizard.java
@@ -1,19 +1,19 @@
/*******************************************************************************
- * Copyright (c) 2010 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
- *******************************************************************************/
+ * Copyright (c) 2010, 2012 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.jaxb.ui.internal.wizards.proj;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin;
import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiIcons;
import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiMessages;
+import org.eclipse.jpt.jaxb.ui.internal.plugin.JptJaxbUiPlugin;
import org.eclipse.jpt.jaxb.ui.internal.wizards.proj.model.JaxbProjectCreationDataModelProvider;
import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
@@ -38,7 +38,7 @@ public class JaxbProjectWizard
@Override
protected ImageDescriptor getDefaultPageImageDescriptor() {
- return JptJaxbUiPlugin.getImageDescriptor(JptJaxbUiIcons.JAXB_WIZ_BANNER);
+ return JptJaxbUiPlugin.instance().buildImageDescriptor(JptJaxbUiIcons.JAXB_WIZ_BANNER);
}
@Override
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/SchemaGeneratorWizard.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/SchemaGeneratorWizard.java
index ff8a540923..f08b5653df 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/SchemaGeneratorWizard.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/SchemaGeneratorWizard.java
@@ -1,18 +1,17 @@
/*******************************************************************************
-* Copyright (c) 2010, 2012 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
-*******************************************************************************/
+ * Copyright (c) 2010, 2012 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.jaxb.ui.internal.wizards.schemagen;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
-
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
@@ -36,9 +35,9 @@ import org.eclipse.jpt.common.utility.internal.FileTools;
import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.jaxb.core.internal.gen.SchemaGenerator;
import org.eclipse.jpt.jaxb.core.internal.operations.SchemaFileCreationDataModelProvider;
-import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin;
import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiIcons;
import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiMessages;
+import org.eclipse.jpt.jaxb.ui.internal.plugin.JptJaxbUiPlugin;
import org.eclipse.osgi.util.NLS;
import org.eclipse.ui.INewWizard;
import org.eclipse.ui.IWorkbench;
@@ -67,7 +66,7 @@ public class SchemaGeneratorWizard extends Wizard implements INewWizard
public SchemaGeneratorWizard() {
super();
setWindowTitle(JptJaxbUiMessages.SchemaGeneratorWizard_title);
- setDefaultPageImageDescriptor(JptJaxbUiPlugin.getImageDescriptor(JptJaxbUiIcons.SCHEMA_GEN_WIZ_BANNER));
+ setDefaultPageImageDescriptor(JptJaxbUiPlugin.instance().buildImageDescriptor(JptJaxbUiIcons.SCHEMA_GEN_WIZ_BANNER));
}
public void init(IWorkbench workbench, IStructuredSelection selection) {
@@ -285,7 +284,7 @@ public class SchemaGeneratorWizard extends Wizard implements INewWizard
@Override
protected void jptPluginLogException(Exception exception) {
- JptJaxbUiPlugin.log(exception);
+ JptJaxbUiPlugin.instance().logError(exception);
}
// ********** internal methods **********
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/platform/JaxbPlatformUiManager.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/platform/JaxbPlatformUiManager.java
index 1f04ed438d..7b92890d9c 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/platform/JaxbPlatformUiManager.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/platform/JaxbPlatformUiManager.java
@@ -1,16 +1,15 @@
/*******************************************************************************
- * Copyright (c) 2010 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
- *******************************************************************************/
+ * Copyright (c) 2010, 2012 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.jaxb.ui.platform;
import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription;
-import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin;
/**
* Repository for {@link JaxbPlatformUi}s
@@ -23,7 +22,6 @@ import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin;
*
* @version 3.0
* @since 3.0
- * @see JptJaxbUiPlugin#getJaxbPlatformUiManager()
*/
public interface JaxbPlatformUiManager {
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/.settings/org.eclipse.jdt.core.prefs b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/.settings/org.eclipse.jdt.core.prefs
index 1284b5c67d..416f4fb696 100644
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/.settings/org.eclipse.jdt.core.prefs
+++ b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/.settings/org.eclipse.jdt.core.prefs
@@ -1,4 +1,3 @@
-#Tue Mar 08 12:07:36 EST 2011
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/META-INF/MANIFEST.MF b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/META-INF/MANIFEST.MF
index c1ecd0d512..1ed892e766 100644
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/META-INF/MANIFEST.MF
+++ b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/META-INF/MANIFEST.MF
@@ -4,11 +4,12 @@ Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.jpt.jaxb.core.tests;singleton:=true
Bundle-Version: 1.2.0.qualifier
+Bundle-Activator: org.eclipse.jpt.jaxb.core.tests.internal.plugin.JptJaxbCoreTestsPlugin
+Bundle-ActivationPolicy: lazy
+Bundle-ClassPath: .
Bundle-Localization: plugin
Dali-Comment: jdk 1.6 has the javax.xml.bind annotations
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Bundle-Activator: org.eclipse.jpt.jaxb.core.tests.JptJaxbCoreTestsPlugin
-Bundle-ActivationPolicy: lazy
Require-Bundle: org.eclipse.core.resources;bundle-version="[3.6.100,4.0.0)",
org.eclipse.core.runtime;bundle-version="[3.6.100,4.0.0)",
org.eclipse.jdt.core;bundle-version="[3.7.0,4.0.0)",
@@ -22,8 +23,7 @@ Require-Bundle: org.eclipse.core.resources;bundle-version="[3.6.100,4.0.0)",
org.eclipse.wst.common.project.facet.core;bundle-version="[1.4.200,2.0.0)",
org.eclipse.xsd;bundle-version="[2.6.0,3.0.0)",
org.junit;bundle-version="[4.0.0,5.0.0)"
-Export-Package: org.eclipse.jpt.jaxb.core.tests;x-internal:=true,
- org.eclipse.jpt.jaxb.core.tests.internal;x-internal:=true,
+Export-Package: org.eclipse.jpt.jaxb.core.tests.internal;x-internal:=true,
org.eclipse.jpt.jaxb.core.tests.internal.context;x-internal:=true,
org.eclipse.jpt.jaxb.core.tests.internal.context.java;x-internal:=true,
org.eclipse.jpt.jaxb.core.tests.internal.projects;x-internal:=true,
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/JaxbCoreMiscTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/JaxbCoreMiscTests.java
new file mode 100644
index 0000000000..e9ef094e95
--- /dev/null
+++ b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/JaxbCoreMiscTests.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.jaxb.core.tests.internal;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.eclipse.jpt.common.core.tests.BundleActivatorTest;
+import org.eclipse.jpt.jaxb.core.JaxbProject;
+
+public class JaxbCoreMiscTests {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(JaxbCoreMiscTests.class.getName());
+
+ suite.addTestSuite(SchemaLibraryTests.class);
+ suite.addTest(new BundleActivatorTest(JaxbProject.class));
+
+ return suite;
+ }
+
+ private JaxbCoreMiscTests() {
+ super();
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/JaxbCoreTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/JaxbCoreTests.java
index 632df40d68..2e9e64e05a 100644
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/JaxbCoreTests.java
+++ b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/JaxbCoreTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2012 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.
@@ -19,10 +19,13 @@ import org.eclipse.jpt.jaxb.core.tests.internal.resource.JaxbCoreResourceModelTe
public class JaxbCoreTests {
public static Test suite() {
+ // ***** keep test.xml in sync with this list *****
+ // test.xml is split up because this test suite was taking too
+ // long and triggering a time-out during the WTP build
TestSuite suite = new TestSuite(JaxbCoreTests.class.getPackage().getName());
- suite.addTestSuite(SchemaLibraryTests.class);
suite.addTest(JaxbCoreResourceModelTests.suite());
suite.addTest(JaxbCoreContextModelTests.suite());
+ suite.addTest(JaxbCoreMiscTests.suite());
return suite;
}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/JptJaxbCoreTestsPlugin.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/plugin/JptJaxbCoreTestsPlugin.java
index 6fb339c26d..93d6e109aa 100644
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/JptJaxbCoreTestsPlugin.java
+++ b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/plugin/JptJaxbCoreTestsPlugin.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2012 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,21 +7,25 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.jaxb.core.tests;
+package org.eclipse.jpt.jaxb.core.tests.internal.plugin;
-import org.eclipse.core.runtime.Plugin;
+import org.eclipse.jpt.common.core.internal.utility.JptPlugin;
import org.eclipse.jpt.common.utility.internal.ReflectionTools;
import org.eclipse.jpt.jaxb.core.JaxbProjectManager;
import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin;
import org.eclipse.jpt.jaxb.core.internal.prefs.JaxbPreferencesManager;
-import org.osgi.framework.BundleContext;
/**
- * configure the core to handle events synchronously when we are
- * running tests
+ * Configure the core for testing:<ul>
+ * <li>handle events synchronously
+ * <li>do not flush preferences
+ * </ul>
*/
@SuppressWarnings("nls")
-public class JptJaxbCoreTestsPlugin extends Plugin {
+public class JptJaxbCoreTestsPlugin
+ extends JptPlugin
+{
+ // ********** singleton **********
private static JptJaxbCoreTestsPlugin INSTANCE;
@@ -30,29 +34,22 @@ public class JptJaxbCoreTestsPlugin extends Plugin {
}
- // ********** plug-in implementation **********
+ // ********** Dali plug-in **********
public JptJaxbCoreTestsPlugin() {
super();
- if (INSTANCE != null) {
- throw new IllegalStateException();
- }
- // this convention is *wack*... ~bjv
- INSTANCE = this;
}
-
@Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- JaxbProjectManager jaxbProjectManager = JptJaxbCorePlugin.getProjectManager();
+ protected void start_() throws Exception {
+ super.start_();
+ JaxbProjectManager jaxbProjectManager = JptJaxbCorePlugin.instance().getProjectManager();
ReflectionTools.executeMethod(jaxbProjectManager, "handleEventsSynchronously");
ReflectionTools.executeStaticMethod(JaxbPreferencesManager.class, "doNotFlushPreferences");
}
@Override
- public void stop(BundleContext context) throws Exception {
- super.stop(context);
+ protected void setInstance(JptPlugin plugin) {
+ INSTANCE = (JptJaxbCoreTestsPlugin) plugin;
}
-
}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/projects/TestJaxbProject.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/projects/TestJaxbProject.java
index bba329c672..b86ae54fa2 100644
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/projects/TestJaxbProject.java
+++ b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/projects/TestJaxbProject.java
@@ -46,7 +46,7 @@ public class TestJaxbProject
return getSystemProperty(JAXB_JAR_NAME_SYSTEM_PROPERTY);
}
- public static String eclipselinkJarName() {
+ public static String eclipseLinkJarName() {
return getSystemProperty(ECLIPSELINK_JAR_NAME_SYSTEM_PROPERTY);
}
@@ -79,11 +79,13 @@ public class TestJaxbProject
String jaxbFacetVersion =
((IProjectFacetVersion) config.getProperty(IFacetDataModelProperties.FACET_VERSION)).getVersionString();
this.installFacet(JaxbFacet.ID, jaxbFacetVersion, config);
- this.addJar(jaxbJarName());
- if (eclipselinkJarName() != null) {
- this.addJar(eclipselinkJarName());
+ String jaxbJarName = jaxbJarName();
+ this.addJar(jaxbJarName);
+ String eclipseLinkJarName = eclipseLinkJarName();
+ if ((eclipseLinkJarName != null) && ! eclipseLinkJarName.equals(jaxbJarName)) {
+ this.addJar(eclipseLinkJarName);
}
- this.jaxbProject = JptJaxbCorePlugin.getJaxbProject(this.getProject());
+ this.jaxbProject = JptJaxbCorePlugin.instance().getProjectManager().getJaxbProject(this.getProject());
this.jaxbProject.setContextModelSynchronizer(this.buildSynchronousContextModelSynchronizer());
this.jaxbProject.setUpdateSynchronizer(this.buildSynchronousUpdateSynchronizer());
}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/JaxbCoreResourceModelTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/JaxbCoreResourceModelTests.java
index 86faa8d47d..e8581ab9e9 100644
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/JaxbCoreResourceModelTests.java
+++ b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/JaxbCoreResourceModelTests.java
@@ -1,24 +1,20 @@
/*******************************************************************************
- * Copyright (c) 2010 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
- *******************************************************************************/
+ * Copyright (c) 2010, 2012 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.jaxb.core.tests.internal.resource;
import junit.framework.Test;
-import junit.framework.TestCase;
import junit.framework.TestSuite;
-
import org.eclipse.jpt.jaxb.core.tests.internal.JaxbCoreTests;
import org.eclipse.jpt.jaxb.core.tests.internal.resource.java.JaxbJavaResourceModelTests;
-
-public class JaxbCoreResourceModelTests extends TestCase
+public class JaxbCoreResourceModelTests
{
public static Test suite() {
TestSuite suite = new TestSuite(JaxbCoreResourceModelTests.class.getName());
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/test.xml b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/test.xml
index b86c694340..50940d5f8c 100644
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/test.xml
+++ b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/test.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?> <!--
- Copyright (c) 2010, 2011 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 -->
+ Copyright (c) 2010, 2012 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 -->
<project name="testsuite" default="run" basedir=".">
<!-- The property ${eclipse-home} should be passed into this script -->
@@ -20,9 +20,8 @@
</delete>
</target>
- <!-- This target defines the tests that need to be run. -->
- <target name="suite1"> <property file="${testRoot}/testServer.properties"/> <property name="jpt-folder" value="${eclipse-home}/jpt_folder"/> <delete dir="${jpt-folder}" quiet="true"/> <ant target="core-test" antfile="${library-file}" dir="${eclipse-home}"> <property name="data-dir" value="${jpt-folder}"/> <property name="plugin-name" value="${plugin-name}"/> <property name="classname" value="org.eclipse.jpt.jaxb.core.tests.internal.resource.JaxbCoreResourceModelTests"/> <property name="plugin-path" value="${eclipse-home}/plugins/${plugin-name}"/> <property name="extraVMargs" value="-Dorg.eclipse.jpt.jaxb.jar=${testDir}/${jpt-javax-xml-bind-jar}"/> </ant> </target>
- <target name="suite2"> <property file="${testRoot}/testServer.properties"/> <property name="jpt-folder" value="${eclipse-home}/jpt_folder"/> <delete dir="${jpt-folder}" quiet="true"/> <ant target="core-test" antfile="${library-file}" dir="${eclipse-home}"> <property name="data-dir" value="${jpt-folder}"/> <property name="plugin-name" value="${plugin-name}"/> <property name="classname" value="org.eclipse.jpt.jaxb.core.tests.internal.context.JaxbCoreContextModelTests"/> <property name="plugin-path" value="${eclipse-home}/plugins/${plugin-name}"/> <property name="extraVMargs" value="-Dorg.eclipse.jpt.jaxb.jar=${testDir}/${jpt-javax-xml-bind-jar}"/> </ant> </target> <!-- This target holds code to cleanup the testing environment after -->
+ <!-- Test suite is split up to prevent time-outs during the WTP build. --> <!-- Keep these suites in sync with those listed in JaxbCoreTests. --> <target name="suite1"> <property file="${testRoot}/testServer.properties"/> <property name="jpt-folder" value="${eclipse-home}/jpt_folder"/> <delete dir="${jpt-folder}" quiet="true"/> <ant target="core-test" antfile="${library-file}" dir="${eclipse-home}"> <property name="data-dir" value="${jpt-folder}"/> <property name="plugin-name" value="${plugin-name}"/> <property name="classname" value="org.eclipse.jpt.jaxb.core.tests.internal.resource.JaxbCoreResourceModelTests"/> <property name="plugin-path" value="${eclipse-home}/plugins/${plugin-name}"/> <property name="extraVMargs" value="-Dorg.eclipse.jpt.jaxb.jar=${testDir}/${jpt-javax-xml-bind-jar}"/> </ant> </target>
+ <target name="suite2"> <property file="${testRoot}/testServer.properties"/> <property name="jpt-folder" value="${eclipse-home}/jpt_folder"/> <delete dir="${jpt-folder}" quiet="true"/> <ant target="core-test" antfile="${library-file}" dir="${eclipse-home}"> <property name="data-dir" value="${jpt-folder}"/> <property name="plugin-name" value="${plugin-name}"/> <property name="classname" value="org.eclipse.jpt.jaxb.core.tests.internal.context.JaxbCoreContextModelTests"/> <property name="plugin-path" value="${eclipse-home}/plugins/${plugin-name}"/> <property name="extraVMargs" value="-Dorg.eclipse.jpt.jaxb.jar=${testDir}/${jpt-javax-xml-bind-jar}"/> </ant> </target> <target name="suite3"> <property file="${testRoot}/testServer.properties"/> <property name="jpt-folder" value="${eclipse-home}/jpt_folder"/> <delete dir="${jpt-folder}" quiet="true"/> <ant target="core-test" antfile="${library-file}" dir="${eclipse-home}"> <property name="data-dir" value="${jpt-folder}"/> <property name="plugin-name" value="${plugin-name}"/> <property name="classname" value="org.eclipse.jpt.jaxb.core.tests.internal.JaxbCoreMiscTests"/> <property name="plugin-path" value="${eclipse-home}/plugins/${plugin-name}"/> <property name="extraVMargs" value="-Dorg.eclipse.jpt.jaxb.jar=${testDir}/${jpt-javax-xml-bind-jar}"/> </ant> </target> <!-- This target holds code to cleanup the testing environment after -->
<!-- after all of the tests have been run. You can use this target to -->
<!-- delete temporary files that have been created. -->
<target name="cleanup">
@@ -30,6 +29,6 @@
<!-- This target runs the test suite. Any actions that need to happen -->
<!-- after all the tests have been run should go here. -->
- <target name="run" depends="init, suite1, suite2, cleanup">
+ <target name="run" depends="init, suite1, suite2, suite3, cleanup">
</target>
</project> \ No newline at end of file
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/.settings/org.eclipse.jdt.core.prefs b/jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/.settings/org.eclipse.jdt.core.prefs
index ee129ed60e..416f4fb696 100644
--- a/jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/.settings/org.eclipse.jdt.core.prefs
+++ b/jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/.settings/org.eclipse.jdt.core.prefs
@@ -1,4 +1,3 @@
-#Thu May 05 17:25:11 EDT 2011
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/META-INF/MANIFEST.MF b/jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/META-INF/MANIFEST.MF
index cf2be3c589..066e928ce0 100644
--- a/jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/META-INF/MANIFEST.MF
+++ b/jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/META-INF/MANIFEST.MF
@@ -4,11 +4,12 @@ Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.jpt.jaxb.eclipselink.core.tests;singleton:=true
Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.eclipse.jpt.jaxb.eclipselink.core.tests.internal.plugin.JptJaxbEclipseLinkCoreTestsPlugin
+Bundle-ActivationPolicy: lazy
+Bundle-ClassPath: .
Bundle-Localization: plugin
Dali-Comment: jdk 1.6 has the javax.xml.bind annotations
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Bundle-Activator: org.eclipse.jpt.jaxb.eclipselink.core.tests.JptJaxbEclipseLinkCoreTestsPlugin
-Bundle-ActivationPolicy: lazy
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.7.0,4.0.0)",
org.eclipse.jdt.core;bundle-version="[3.7.0,4.0.0)",
org.eclipse.jpt.common.core;bundle-version="[1.0.0,2.0.0)",
@@ -19,8 +20,7 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.7.0,4.0.0)",
org.eclipse.jpt.jaxb.eclipselink.core;bundle-version="[1.0.0,2.0.0)",
org.eclipse.wst.common.project.facet.core;bundle-version="[1.4.200,2.0.0)",
org.junit;bundle-version="[4.0.0,5.0.0)"
-Export-Package: org.eclipse.jpt.jaxb.eclipselink.core.tests,
- org.eclipse.jpt.jaxb.eclipselink.core.tests.internal;x-internal:=true,
+Export-Package: org.eclipse.jpt.jaxb.eclipselink.core.tests.internal;x-internal:=true,
org.eclipse.jpt.jaxb.eclipselink.core.tests.internal.context;x-internal:=true,
org.eclipse.jpt.jaxb.eclipselink.core.tests.internal.context.java;x-internal:=true,
org.eclipse.jpt.jaxb.eclipselink.core.tests.internal.resource;x-internal:=true,
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/src/org/eclipse/jpt/jaxb/eclipselink/core/tests/JptJaxbEclipseLinkCoreTestsPlugin.java b/jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/src/org/eclipse/jpt/jaxb/eclipselink/core/tests/JptJaxbEclipseLinkCoreTestsPlugin.java
deleted file mode 100644
index b4b6735882..0000000000
--- a/jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/src/org/eclipse/jpt/jaxb/eclipselink/core/tests/JptJaxbEclipseLinkCoreTestsPlugin.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 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.jaxb.eclipselink.core.tests;
-
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.jpt.common.utility.internal.ReflectionTools;
-import org.eclipse.jpt.jaxb.core.JaxbProjectManager;
-import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin;
-import org.eclipse.jpt.jaxb.core.internal.prefs.JaxbPreferencesManager;
-import org.osgi.framework.BundleContext;
-
-/**
- * configure the core to handle events synchronously when we are
- * running tests
- */
-@SuppressWarnings("nls")
-public class JptJaxbEclipseLinkCoreTestsPlugin
- extends Plugin {
-
- private static JptJaxbEclipseLinkCoreTestsPlugin INSTANCE;
-
-
- public static JptJaxbEclipseLinkCoreTestsPlugin instance() {
- return INSTANCE;
- }
-
-
- // ********** plug-in implementation **********
-
- public JptJaxbEclipseLinkCoreTestsPlugin() {
- super();
- if (INSTANCE != null) {
- throw new IllegalStateException();
- }
- // this convention is *wack*... ~bjv
- INSTANCE = this;
- }
-
-
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- JaxbProjectManager jaxbProjectManager = JptJaxbCorePlugin.getProjectManager();
- ReflectionTools.executeMethod(jaxbProjectManager, "handleEventsSynchronously");
- ReflectionTools.executeStaticMethod(JaxbPreferencesManager.class, "doNotFlushPreferences");
- }
-
- @Override
- public void stop(BundleContext context) throws Exception {
- super.stop(context);
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.ui.tests/src/org/eclipse/jpt/jpa/ui/tests/JptUiTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/src/org/eclipse/jpt/jaxb/eclipselink/core/tests/internal/ELJaxbCoreMiscTests.java
index d52779117a..e8544eecbc 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.ui.tests/src/org/eclipse/jpt/jpa/ui/tests/JptUiTests.java
+++ b/jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/src/org/eclipse/jpt/jaxb/eclipselink/core/tests/internal/ELJaxbCoreMiscTests.java
@@ -1,32 +1,32 @@
/*******************************************************************************
- * Copyright (c) 2006, 2008 Oracle. All rights reserved.
+ * Copyright (c) 2012 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.jpa.ui.tests;
+package org.eclipse.jpt.jaxb.eclipselink.core.tests.internal;
import junit.framework.Test;
import junit.framework.TestSuite;
-import org.eclipse.jpt.jpa.ui.tests.internal.platform.JptUiPlatformTests;
+import org.eclipse.jpt.common.core.tests.BundleActivatorTest;
+import org.eclipse.jpt.jaxb.eclipselink.core.ELJaxbPlatform;
-/**
- * Runs all JPT UI Tests
- */
-public class JptUiTests {
+public class ELJaxbCoreMiscTests {
public static Test suite() {
- TestSuite suite = new TestSuite(JptUiTests.class.getPackage().getName());
- suite.addTest(JptUiPlatformTests.suite());
+ TestSuite suite = new TestSuite(ELJaxbCoreMiscTests.class.getName());
+
+ suite.addTest(new BundleActivatorTest(ELJaxbPlatform.class));
+
return suite;
}
-
- private JptUiTests() {
+
+
+ private ELJaxbCoreMiscTests() {
super();
throw new UnsupportedOperationException();
}
-
}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/src/org/eclipse/jpt/jaxb/eclipselink/core/tests/internal/ELJaxbCoreTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/src/org/eclipse/jpt/jaxb/eclipselink/core/tests/internal/ELJaxbCoreTests.java
index 233d80ca4e..53a4d45c83 100644
--- a/jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/src/org/eclipse/jpt/jaxb/eclipselink/core/tests/internal/ELJaxbCoreTests.java
+++ b/jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/src/org/eclipse/jpt/jaxb/eclipselink/core/tests/internal/ELJaxbCoreTests.java
@@ -1,30 +1,32 @@
/*******************************************************************************
- * Copyright (c) 2011 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
- *******************************************************************************/
+ * Copyright (c) 2011, 2012 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.jaxb.eclipselink.core.tests.internal;
import java.io.File;
-
import junit.framework.Test;
import junit.framework.TestSuite;
-
import org.eclipse.jpt.jaxb.core.tests.internal.projects.TestJaxbProject;
import org.eclipse.jpt.jaxb.eclipselink.core.tests.internal.context.ELJaxbCoreContextModelTests;
import org.eclipse.jpt.jaxb.eclipselink.core.tests.internal.resource.ELJaxbCoreResourceModelTests;
-
+@SuppressWarnings("nls")
public class ELJaxbCoreTests {
public static Test suite() {
+ // ***** keep test.xml in sync with this list *****
+ // test.xml is split up because this test suite was taking too
+ // long and triggering a time-out during the WTP build
TestSuite suite = new TestSuite(ELJaxbCoreTests.class.getPackage().getName());
suite.addTest(ELJaxbCoreResourceModelTests.suite());
suite.addTest(ELJaxbCoreContextModelTests.suite());
+ suite.addTest(ELJaxbCoreMiscTests.suite());
return suite;
}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/src/org/eclipse/jpt/jaxb/eclipselink/core/tests/internal/context/ELJaxbCoreContextModelTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/src/org/eclipse/jpt/jaxb/eclipselink/core/tests/internal/context/ELJaxbCoreContextModelTests.java
index 1eacaf9eb8..2381acc9be 100644
--- a/jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/src/org/eclipse/jpt/jaxb/eclipselink/core/tests/internal/context/ELJaxbCoreContextModelTests.java
+++ b/jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/src/org/eclipse/jpt/jaxb/eclipselink/core/tests/internal/context/ELJaxbCoreContextModelTests.java
@@ -1,23 +1,22 @@
/*******************************************************************************
- * Copyright (c) 2011 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
- *******************************************************************************/
+ * Copyright (c) 2011, 2012 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.jaxb.eclipselink.core.tests.internal.context;
import junit.framework.Test;
-import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.eclipse.jpt.jaxb.eclipselink.core.tests.internal.ELJaxbCoreTests;
import org.eclipse.jpt.jaxb.eclipselink.core.tests.internal.context.java.ELJaxbCoreJavaContextModelTests;
-public class ELJaxbCoreContextModelTests extends TestCase
-{
+public class ELJaxbCoreContextModelTests {
+
public static Test suite() {
TestSuite suite = new TestSuite(ELJaxbCoreContextModelTests.class.getName());
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/src/org/eclipse/jpt/jaxb/eclipselink/core/tests/internal/plugin/JptJaxbEclipseLinkCoreTestsPlugin.java b/jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/src/org/eclipse/jpt/jaxb/eclipselink/core/tests/internal/plugin/JptJaxbEclipseLinkCoreTestsPlugin.java
new file mode 100644
index 0000000000..1b7e0e22e0
--- /dev/null
+++ b/jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/src/org/eclipse/jpt/jaxb/eclipselink/core/tests/internal/plugin/JptJaxbEclipseLinkCoreTestsPlugin.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012 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.jaxb.eclipselink.core.tests.internal.plugin;
+
+import org.eclipse.jpt.common.core.internal.utility.JptPlugin;
+
+public class JptJaxbEclipseLinkCoreTestsPlugin
+ extends JptPlugin
+{
+ // ********** singleton **********
+
+ private static JptJaxbEclipseLinkCoreTestsPlugin INSTANCE;
+
+ public static JptJaxbEclipseLinkCoreTestsPlugin instance() {
+ return INSTANCE;
+ }
+
+
+ // ********** Dali plug-in **********
+
+ public JptJaxbEclipseLinkCoreTestsPlugin() {
+ super();
+ }
+
+ @Override
+ protected void setInstance(JptPlugin plugin) {
+ INSTANCE = (JptJaxbEclipseLinkCoreTestsPlugin) plugin;
+ }
+}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/src/org/eclipse/jpt/jaxb/eclipselink/core/tests/internal/resource/ELJaxbCoreResourceModelTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/src/org/eclipse/jpt/jaxb/eclipselink/core/tests/internal/resource/ELJaxbCoreResourceModelTests.java
index 12a00c2ed6..58bd740164 100644
--- a/jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/src/org/eclipse/jpt/jaxb/eclipselink/core/tests/internal/resource/ELJaxbCoreResourceModelTests.java
+++ b/jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/src/org/eclipse/jpt/jaxb/eclipselink/core/tests/internal/resource/ELJaxbCoreResourceModelTests.java
@@ -1,24 +1,20 @@
/*******************************************************************************
- * Copyright (c) 2011 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
- *******************************************************************************/
+ * Copyright (c) 2011, 2012 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.jaxb.eclipselink.core.tests.internal.resource;
import junit.framework.Test;
-import junit.framework.TestCase;
import junit.framework.TestSuite;
-
import org.eclipse.jpt.jaxb.eclipselink.core.tests.internal.ELJaxbCoreTests;
import org.eclipse.jpt.jaxb.eclipselink.core.tests.internal.resource.java.ELJaxbJavaResourceModelTests;
-
-public class ELJaxbCoreResourceModelTests
- extends TestCase {
+public class ELJaxbCoreResourceModelTests {
public static Test suite() {
TestSuite suite = new TestSuite(ELJaxbCoreResourceModelTests.class.getName());
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/src/org/eclipse/jpt/jaxb/eclipselink/core/tests/internal/resource/java/ELJaxbJavaResourceModelTestCase.java b/jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/src/org/eclipse/jpt/jaxb/eclipselink/core/tests/internal/resource/java/ELJaxbJavaResourceModelTestCase.java
index 479010c881..41543c9722 100644
--- a/jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/src/org/eclipse/jpt/jaxb/eclipselink/core/tests/internal/resource/java/ELJaxbJavaResourceModelTestCase.java
+++ b/jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/src/org/eclipse/jpt/jaxb/eclipselink/core/tests/internal/resource/java/ELJaxbJavaResourceModelTestCase.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2011 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
- *******************************************************************************/
+ * Copyright (c) 2011, 2012 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.jaxb.eclipselink.core.tests.internal.resource.java;
import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
@@ -27,7 +27,7 @@ public class ELJaxbJavaResourceModelTestCase
@Override
protected void setUp() throws Exception {
super.setUp();
- this.javaProject.addJar(TestJaxbProject.eclipselinkJarName());
+ this.javaProject.addJar(TestJaxbProject.eclipseLinkJarName());
}
@Override
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/test.xml b/jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/test.xml
index 09430226e2..be2a1f380d 100644
--- a/jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/test.xml
+++ b/jaxb/tests/org.eclipse.jpt.jaxb.eclipselink.core.tests/test.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!--
- Copyright (c) 2011 Oracle. All rights reserved.
+ Copyright (c) 2011, 2012 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.
@@ -29,7 +29,8 @@
</delete>
</target>
- <!-- This target defines the tests that need to be run. -->
+ <!-- Test suite is split up to prevent time-outs during the WTP build. -->
+ <!-- Keep these suites in sync with those listed in ELJaxbCoreTests. -->
<target name="suite1">
<property file="${testRoot}/testServer.properties"/>
<property name="jpt-folder" value="${eclipse-home}/jpt_folder"/>
@@ -56,6 +57,19 @@
<property name="extraVMargs" value="-Dorg.eclipse.jpt.jaxb.jar=${testDir}/${jpt-javax-xml-bind-jar} -Dorg.eclipse.jpt.eclipselink.jar=${testDir}/${jpt-eclipselink-jar}"/>
</ant>
</target>
+ <target name="suite3">
+ <property file="${testRoot}/testServer.properties"/>
+ <property name="jpt-folder" value="${eclipse-home}/jpt_folder"/>
+ <delete dir="${jpt-folder}" quiet="true"/>
+
+ <ant target="core-test" antfile="${library-file}" dir="${eclipse-home}">
+ <property name="data-dir" value="${jpt-folder}"/>
+ <property name="plugin-name" value="${plugin-name}"/>
+ <property name="classname" value="org.eclipse.jpt.jaxb.eclipselink.core.tests.internal.ELJaxbCoreMiscTests"/>
+ <property name="plugin-path" value="${eclipse-home}/plugins/${plugin-name}"/>
+ <property name="extraVMargs" value="-Dorg.eclipse.jpt.jaxb.jar=${testDir}/${jpt-javax-xml-bind-jar} -Dorg.eclipse.jpt.eclipselink.jar=${testDir}/${jpt-eclipselink-jar}"/>
+ </ant>
+ </target>
<!-- This target holds code to cleanup the testing environment after -->
<!-- after all of the tests have been run. You can use this target to -->
@@ -65,6 +79,6 @@
<!-- This target runs the test suite. Any actions that need to happen -->
<!-- after all the tests have been run should go here. -->
- <target name="run" depends="init, suite1, suite2, cleanup">
+ <target name="run" depends="init, suite1, suite2, suite3, cleanup">
</target>
</project> \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/.options b/jpa/plugins/org.eclipse.jpt.jpa.core/.options
index 6d896134d8..5ed757c95e 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/.options
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/.options
@@ -1,8 +1,7 @@
-# Debugging options for the org.eclipse.jpt.jpa.core plugin.
+# debugging options for the plug-in org.eclipse.jpt.jpa.core
-# Turn on debugging for the org.eclipse.jpt.jpa.core plugin.
+# turn on debugging for the plug-in org.eclipse.jpt.jpa.core
org.eclipse.jpt.jpa.core/debug=true
-# Turn on debugging for the JPA project manager.
+# turn on debugging for the JPA project manager
org.eclipse.jpt.jpa.core/debug/JpaProjectManager=false
-org.eclipse.jpt.jpa.core/debug/JpaProjectManager.stack_trace=false
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/META-INF/MANIFEST.MF b/jpa/plugins/org.eclipse.jpt.jpa.core/META-INF/MANIFEST.MF
index 09b3bb385c..272be62729 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/META-INF/MANIFEST.MF
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/META-INF/MANIFEST.MF
@@ -4,8 +4,8 @@ Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.jpt.jpa.core;singleton:=true
Bundle-Version: 3.2.0.qualifier
-Bundle-Activator: org.eclipse.jpt.jpa.core.JptJpaCorePlugin
-Bundle-ActivationPolicy: lazy;exclude:="org.eclipse.jpt.core.internal.resource.contenttypes"
+Bundle-Activator: org.eclipse.jpt.jpa.core.internal.plugin.JptJpaCorePlugin
+Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
@@ -35,6 +35,7 @@ Require-Bundle: org.eclipse.core.commands;bundle-version="[3.4.0,4.0.0)",
org.eclipse.wst.validation;bundle-version="[1.2.0,2.0.0)",
org.eclipse.wst.xml.core;bundle-version="[1.1.300,2.0.0)",
org.eclipse.ltk.core.refactoring;bundle-version="[3.5.100,4.0.0)"
+Import-Package: com.ibm.icu.text;version="4.0.1"
Export-Package: org.eclipse.jpt.jpa.core,
org.eclipse.jpt.jpa.core.context,
org.eclipse.jpt.jpa.core.context.java,
@@ -67,14 +68,13 @@ Export-Package: org.eclipse.jpt.jpa.core,
org.eclipse.jpt.jpa.core.internal.libval;x-internal:=true,
org.eclipse.jpt.jpa.core.internal.operations;x-internal:=true,
org.eclipse.jpt.jpa.core.internal.platform;x-internal:=true,
- org.eclipse.jpt.jpa.core.internal.prefs;x-internal:=true,
org.eclipse.jpt.jpa.core.internal.refactoring;x-internal:=true,
- org.eclipse.jpt.jpa.core.internal.resource.contenttypes;x-internal:=true,
org.eclipse.jpt.jpa.core.internal.resource.java;x-internal:=true,
org.eclipse.jpt.jpa.core.internal.resource.java.binary;x-internal:=true,
org.eclipse.jpt.jpa.core.internal.resource.java.source;x-internal:=true,
org.eclipse.jpt.jpa.core.internal.resource.orm;x-internal:=true,
org.eclipse.jpt.jpa.core.internal.resource.persistence;x-internal:=true,
+ org.eclipse.jpt.jpa.core.internal.resource.xml;x-internal:=true,
org.eclipse.jpt.jpa.core.internal.validation;x-internal:=true,
org.eclipse.jpt.jpa.core.jpa2,
org.eclipse.jpt.jpa.core.jpa2.context,
@@ -88,7 +88,6 @@ Export-Package: org.eclipse.jpt.jpa.core,
org.eclipse.jpt.jpa.core.jpql.spi,
org.eclipse.jpt.jpa.core.libprov,
org.eclipse.jpt.jpa.core.platform,
- org.eclipse.jpt.jpa.core.prefs,
org.eclipse.jpt.jpa.core.resource,
org.eclipse.jpt.jpa.core.resource.java,
org.eclipse.jpt.jpa.core.resource.orm,
@@ -96,4 +95,3 @@ Export-Package: org.eclipse.jpt.jpa.core,
org.eclipse.jpt.jpa.core.resource.persistence,
org.eclipse.jpt.jpa.core.resource.persistence.v2_0,
org.eclipse.jpt.jpa.core.resource.xml
-Import-Package: com.ibm.icu.text;version="4.0.1"
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/build.properties b/jpa/plugins/org.eclipse.jpt.jpa.core/build.properties
index ee6c5bfc49..47920a9909 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/build.properties
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/build.properties
@@ -1,5 +1,5 @@
################################################################################
-# Copyright (c) 2006, 2011 Oracle. All rights reserved.
+# Copyright (c) 2006, 2012 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.
@@ -17,4 +17,5 @@ bin.includes = .,\
plugin.properties
jars.compile.order = .
src.includes = model/,\
- schema/
+ schema/,\
+ dev-docs/
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/plugin.properties b/jpa/plugins/org.eclipse.jpt.jpa.core/plugin.properties
index 12b57a82dc..0c35f5f140 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/plugin.properties
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/plugin.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2006, 2010 Oracle. All rights reserved.
+# Copyright (c) 2006, 2012 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.
@@ -27,13 +27,10 @@ JPA_PLATFORM=JPA Platforms
JPA_RESOURCE_MODEL_PROVIDERS=JPA Resource Model Providers
JPA_FILE_CONTENT=JPA File Content
-BASE_JPA_CONTENT = Base content for JPA XML files
-PERSISTENCE_XML_CONTENT = JPA persistence.xml files
-MAPPING_FILE_CONTENT = Base content for JPA XML mapping files
-ORM_XML_CONTENT = JPA orm.xml mapping files
-JAR_CONTENT = JAR Content
-JAVA_PACKAGE_INFO_CONTENT = package-info.java
-FACET_CONFIG_XML_CONTENT=Project facet configuration XML file
+JPA_XML_CONTENT = JPA XML file
+PERSISTENCE_XML_CONTENT = JPA persistence.xml file
+MAPPING_FILE_CONTENT = JPA mapping file
+ORM_XML_CONTENT = JPA orm.xml mapping file
GENERIC_PLATFORM_GROUP_LABEL=Generic
GENERIC_1_0_PLATFORM_LABEL=Generic 1.0
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/plugin.xml b/jpa/plugins/org.eclipse.jpt.jpa.core/plugin.xml
index a7ae462847..7c592c960d 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/plugin.xml
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/plugin.xml
@@ -25,10 +25,14 @@
<extension
point="org.eclipse.core.runtime.adapters">
- <!-- IWorkspace -> JpaProjectManager -->
+ <!-- IWorkspace
+ -> JpaWorkspace
+ -> JpaProjectManager
+ -->
<factory
adaptableType="org.eclipse.core.resources.IWorkspace"
class="org.eclipse.jpt.jpa.core.internal.WorkspaceAdapterFactory">
+ <adapter type="org.eclipse.jpt.jpa.core.JpaWorkspace"/>
<adapter type="org.eclipse.jpt.jpa.core.JpaProjectManager"/>
</factory>
@@ -85,19 +89,19 @@
<extension
point="org.eclipse.core.contenttype.contentTypes">
- <!-- "abstract" content type to be extended by all JPA XML file content types -->
+ <!-- JPA XML file ("abstract") -->
<content-type
- id="org.eclipse.jpt.jpa.core.content.baseJpaContent"
- name="%BASE_JPA_CONTENT"
+ id="org.eclipse.jpt.jpa.core.content.jpaXmlContent"
+ name="%JPA_XML_CONTENT"
base-type="org.eclipse.core.runtime.xml"
- describer="org.eclipse.jpt.jpa.core.internal.resource.contenttypes.IndeterminateContentDescriber">
+ describer="org.eclipse.jpt.common.core.internal.content.IndeterminateContentDescriber">
</content-type>
- <!-- persistence.xml content type -->
+ <!-- persistence.xml -->
<content-type
id="org.eclipse.jpt.jpa.core.content.persistence"
name="%PERSISTENCE_XML_CONTENT"
- base-type="org.eclipse.jpt.jpa.core.content.baseJpaContent"
+ base-type="org.eclipse.jpt.jpa.core.content.jpaXmlContent"
file-names="persistence.xml">
<describer
class="org.eclipse.core.runtime.content.XMLRootElementContentDescriber2">
@@ -107,14 +111,18 @@
</describer>
</content-type>
- <!-- "abstract" mapping file content type -->
+ <!-- mapping file ("abstract") -->
+ <!--
+ NB: because multiple inheritance of content types is unsupported,
+ we support only *XML* mapping files (not that we've encountered otherwise...)
+ -->
<content-type
id="org.eclipse.jpt.jpa.core.content.mappingFile"
name="%MAPPING_FILE_CONTENT"
- base-type="org.eclipse.jpt.jpa.core.content.baseJpaContent">
+ base-type="org.eclipse.jpt.jpa.core.content.jpaXmlContent">
</content-type>
- <!-- orm.xml content type -->
+ <!-- orm.xml -->
<content-type
id="org.eclipse.jpt.jpa.core.content.orm"
name="%ORM_XML_CONTENT"
@@ -127,20 +135,34 @@
</describer>
</content-type>
- <!-- org.eclipse.wst.common.project.facet.core.xml content type -->
- <content-type
- id="org.eclipse.wst.common.project.facet.core"
- name="%FACET_CONFIG_XML_CONTENT"
- file-names="org.eclipse.wst.common.project.facet.core.xml"
- base-type="org.eclipse.core.runtime.xml">
- <describer
- class="org.eclipse.core.runtime.content.XMLRootElementContentDescriber2">
- <parameter
- name="element"
- value="faceted-project"/>
- </describer>
- </content-type>
-
+ </extension>
+
+
+ <!-- ***** resource types ***** -->
+
+ <extension
+ point="org.eclipse.jpt.common.core.resourceTypes">
+
+ <resource-type
+ id="org.eclipse.jpt.jpa.core.resource.persistence_1_0"
+ content-type="org.eclipse.jpt.jpa.core.content.persistence"
+ version="1.0"/>
+
+ <resource-type
+ id="org.eclipse.jpt.jpa.core.resource.persistence_2_0"
+ content-type="org.eclipse.jpt.jpa.core.content.persistence"
+ version="2.0"/>
+
+ <resource-type
+ id="org.eclipse.jpt.jpa.core.resource.orm_1_0"
+ content-type="org.eclipse.jpt.jpa.core.content.orm"
+ version="1.0"/>
+
+ <resource-type
+ id="org.eclipse.jpt.jpa.core.resource.orm_2_0"
+ content-type="org.eclipse.jpt.jpa.core.content.orm"
+ version="2.0"/>
+
</extension>
@@ -150,40 +172,33 @@
point="org.eclipse.core.expressions.propertyTesters">
<propertyTester
- id="org.eclipse.jpt.jpa.core.propertyTester.persistentAttribute"
+ id="org.eclipse.jpt.jpa.core.propertyTester.PersistentAttribute"
type="org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute"
namespace="org.eclipse.jpt.jpa.core"
properties="isMapped, isNotMapped, isVirtual, isNotVirtual"
class="org.eclipse.jpt.jpa.core.internal.context.PersistentAttributePropertyTester"/>
<propertyTester
- id="org.eclipse.jpt.jpa.core.propertyTester.jpaPlatformDescription"
+ id="org.eclipse.jpt.jpa.core.propertyTester.JpaPlatformDescription"
type="org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription"
namespace="org.eclipse.jpt.jpa.core"
properties="jpaPlatform, jpaPlatformGroup"
- class="org.eclipse.jpt.jpa.core.internal.platform.JpaPlatformTester"/>
+ class="org.eclipse.jpt.jpa.core.internal.platform.JpaPlatformDescriptionPropertyTester"/>
<propertyTester
- id="org.eclipse.jpt.jpa.core.propertyTester.xmlFile"
+ id="org.eclipse.jpt.jpa.core.propertyTester.XmlFile"
type="org.eclipse.jpt.jpa.core.context.XmlFile"
namespace="org.eclipse.jpt.jpa.core"
properties="isLatestSupportedVersion, isNotLatestSupportedVersion"
class="org.eclipse.jpt.jpa.core.internal.context.XmlFilePropertyTester"/>
<propertyTester
- id="org.eclipse.jpt.jpa.ui.propertyTester.jptResourceModel"
+ id="org.eclipse.jpt.jpa.core.propertyTester.JptResourceModel"
type="org.eclipse.jpt.common.core.JptResourceModel"
namespace="org.eclipse.jpt.jpa.core"
properties="isLatestSupportedVersion, isNotLatestSupportedVersion"
class="org.eclipse.jpt.jpa.core.internal.JptResourceModelPropertyTester"/>
- <propertyTester
- id="org.eclipse.jpt.jpa.ui.propertyTester.jpaContextNode"
- type="org.eclipse.jpt.jpa.core.context.JpaContextNode"
- namespace="org.eclipse.jpt.jpa.core"
- properties="isCompatibleVersion"
- class="org.eclipse.jpt.jpa.core.internal.JpaContextNodePropertyTester"/>
-
</extension>
@@ -191,10 +206,9 @@
<extension
point="org.eclipse.core.runtime.preferences">
-
- <initializer
- class="org.eclipse.jpt.jpa.core.internal.prefs.JpaPreferenceInitializer"/>
-
+
+ <initializer class="org.eclipse.jpt.jpa.core.internal.JpaPreferenceInitializer"/>
+
</extension>
@@ -510,17 +524,10 @@
<delegate class="org.eclipse.jpt.jpa.core.internal.facet.JpaFacetInstallDelegate"/>
</action>
- <!--
- The uninstall action is only used to enable facet uninstallation
- through the facet UI. The delegate currently has no functionality.
- -->
<action facet="jpt.jpa" type="uninstall" id="jpt.jpa.uninstall">
<delegate class="org.eclipse.jpt.jpa.core.internal.facet.JpaFacetUninstallDelegate"/>
</action>
- <!--
- The version change
- -->
<action facet="jpt.jpa" type="version-change" id="jpt.jpa.version-change">
<config-factory class="org.eclipse.jpt.jpa.core.internal.facet.JpaFacetVersionChangeDataModelProvider"/>
<delegate class="org.eclipse.jpt.jpa.core.internal.facet.JpaFacetVersionChangeDelegate"/>
@@ -569,8 +576,8 @@
<rules>
<contentType id="org.eclipse.jdt.core.javaSource" exactMatch="false"/>
<contentType id="org.eclipse.jpt.common.core.content.jar"/>
- <contentType id="org.eclipse.jpt.jpa.core.content.baseJpaContent" exactMatch="false"/>
- <contentType id="org.eclipse.wst.common.project.facet.core" exactMatch="true"/>
+ <contentType id="org.eclipse.jpt.jpa.core.content.jpaXmlContent" exactMatch="false"/>
+ <contentType id="org.eclipse.jpt.common.core.content.projectFacet" exactMatch="true"/>
</rules>
</include>
</validator>
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/property_files/jpa_core.properties b/jpa/plugins/org.eclipse.jpt.jpa.core/property_files/jpa_core.properties
index f2c4128669..49cc968b8e 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/property_files/jpa_core.properties
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/property_files/jpa_core.properties
@@ -40,9 +40,10 @@ VALIDATE_CONNECTION_DOESNT_CONTAIN_SCHEMA=Schema ''{0}'' does not exist on the c
CONTEXT_MODEL_SYNC_JOB_NAME=Synchronize JPA project: ''{0}''
UPDATE_JOB_NAME=Update JPA project: ''{0}''
METAMODEL_SYNC_JOB_NAME=Synchronize JPA project metamodel: ''{0}''
-PREFERENCES_FLUSH_JOB_NAME=Flush Preferences: {0}
OSGI_BUNDLES_LIBRARY_VALIDATOR__BUNDLE_NOT_FOUND=The bundle ''{0}'' could not be found.
OSGI_BUNDLES_LIBRARY_VALIDATOR__IMPROPER_BUNDLE_VERSION=The version of bundle ''{0}'' does not meet platform requirements.
+INVALID_FACET=Invalid Facet: {0}
+
JAVA_METADATA_CONVERSION_IN_PROGRESS=Java metadata conversion in progress...
JAVA_METADATA_CONVERSION_CONVERT_GENERATOR=Converting Java generator ''{0}''
JAVA_METADATA_CONVERSION_CONVERT_QUERY=Converting Java query ''{0}''
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaDataSource.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaDataSource.java
index 6610a45819..b72c73b6d2 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaDataSource.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaDataSource.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 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.
@@ -15,7 +15,7 @@ import org.eclipse.jpt.jpa.db.Table;
/**
* Interface to the connection profile.
- *
+ * <p>
* Provisional API: This interface is part of an interim API that is still
* under development and expected to change significantly before reaching
* stability. It is available at this early stage to solicit feedback from
@@ -26,8 +26,8 @@ import org.eclipse.jpt.jpa.db.Table;
* @since 2.0
*/
public interface JpaDataSource
- extends JpaNode {
-
+ extends JpaNode
+{
/**
* Return the data source's connection profile name.
* The connection profile is looked up based on this setting.
@@ -83,5 +83,4 @@ public interface JpaDataSource
* Dispose the data source.
*/
void dispose();
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaFacet.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaFacet.java
deleted file mode 100644
index 609cb4c1a5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaFacet.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 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.jpa.core;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework;
-import org.eclipse.wst.common.project.facet.core.IProjectFacet;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-
-/**
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- *
- * @version 3.0
- * @since 3.0
- */
-public final class JpaFacet {
-
- public static final String ID = "jpt.jpa"; //$NON-NLS-1$
-
- public static final IProjectFacet FACET = ProjectFacetsManager.getProjectFacet(ID);
-
- public static final IProjectFacetVersion VERSION_1_0 = FACET.getVersion("1.0"); //$NON-NLS-1$
-
- public static final IProjectFacetVersion VERSION_2_0 = FACET.getVersion("2.0"); //$NON-NLS-1$
-
-
- public static boolean isInstalled(final IProject project) {
- try {
- return FacetedProjectFramework.hasProjectFacet(project, ID);
- }
- catch (CoreException e) {
- JptJpaCorePlugin.log(e);
- return false;
- }
- }
-
-
- /**
- * Not for instantiation
- */
- private JpaFacet() {}
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaFactory.java
index 13b69b6a8b..d933b204aa 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaFactory.java
@@ -174,7 +174,7 @@ public interface JpaFactory
PersistenceXml buildPersistenceXml(JpaRootContextNode parent, JpaXmlResource resource);
- MappingFile buildMappingFile(MappingFileRef parent, JpaXmlResource resource);
+ MappingFile buildMappingFile(MappingFileRef parent, Object resourceMappingFile);
// ********** Java Context Model **********
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaFile.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaFile.java
index e077166050..993a02037b 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaFile.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaFile.java
@@ -11,6 +11,7 @@ package org.eclipse.jpt.jpa.core;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.jpt.common.core.ContentTypeReference;
import org.eclipse.jpt.common.core.JptResourceModel;
/**
@@ -28,7 +29,7 @@ import org.eclipse.jpt.common.core.JptResourceModel;
* fashion that will return a JPA file once it and its JPA project have been
* constructed.
* <p>
- * See <code>org.eclipse.jpt.jpa.core/plugin.xml</code>.
+ * See <code>org.eclipse.jpt.jpa.core/plugin.xml:org.eclipse.core.runtime.adapters</code>.
* <p>
* Provisional API: This interface is part of an interim API that is still
* under development and expected to change significantly before reaching
@@ -43,7 +44,7 @@ import org.eclipse.jpt.common.core.JptResourceModel;
* @see org.eclipse.jpt.jpa.core.internal.FileAdapterFactory
*/
public interface JpaFile
- extends JpaNode
+ extends JpaNode, ContentTypeReference
{
/**
* Return the JPA file's Eclipse file.
@@ -51,11 +52,6 @@ public interface JpaFile
IFile getFile();
/**
- * Return the JPA file's content type.
- */
- IContentType getContentType();
-
- /**
* Return the resource model corresponding to the JPA file; typically a JPA
* compilation unit, a JPA XML resource, or a JPA package fragment root (JAR).
*/
@@ -118,11 +114,11 @@ public interface JpaFile
* Standard adapter for retrieving a {@link JpaFile JPA file}:
* <pre>
* IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject("Foo Project");
- * IFile file = project.getFile("plugin.xml");
+ * IFile file = project.getFile("Foo.java");
* JpaFile.Reference jpaFileRef = (JpaFile.Reference) file.getAdapter(JpaFile.Reference.class);
* JpaFile jpaFile = jpaFileRef.getValue();
* </pre>
- * See <code>org.eclipse.jpt.jpa.core/plugin.xml</code>.
+ * See <code>org.eclipse.jpt.jpa.core/plugin.xml:org.eclipse.core.runtime.adapters</code>.
* @see org.eclipse.jpt.jpa.core.internal.FileAdapterFactory
*/
interface Reference {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaNode.java
index 7a7085a2e5..e5d82985ad 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaNode.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaNode.java
@@ -60,4 +60,9 @@ public interface JpaNode
* Return the node's resource, typically for validation messages.
*/
IResource getResource();
+
+ /**
+ * Return the model's JPA platform.
+ */
+ JpaPlatform getJpaPlatform();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatform.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatform.java
index 25f2f20261..ab1609705a 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatform.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatform.java
@@ -9,7 +9,6 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core;
-import java.util.Comparator;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.content.IContentType;
@@ -19,10 +18,10 @@ import org.eclipse.jpt.common.core.utility.jdt.AnnotationEditFormatter;
import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition;
import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition;
+import org.eclipse.jpt.jpa.core.jpa2.JpaProject2_0;
import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
import org.eclipse.jpt.jpa.db.ConnectionProfileFactory;
import org.eclipse.persistence.jpa.jpql.parser.JPQLGrammar;
-import org.eclipse.wst.common.project.facet.core.DefaultVersionComparator;
/**
* This interface is to be implemented by a JPA vendor to provide extensions to
@@ -54,17 +53,18 @@ public interface JpaPlatform
// ********** meta stuff **********
/**
- * Get the ID for this platform
+ * Return the JPA platform's ID.
*/
String getId();
/**
- * Return the description for this platform
+ * Return the JPA platform's description (i.e. the description defined by
+ * the JPA platform's plug-in extension).
*/
JpaPlatformDescription getDescription();
/**
- * Get the version object for this platform.
+ * Return the JPA platform's version.
*/
Version getJpaVersion();
@@ -72,9 +72,11 @@ public interface JpaPlatform
// ********** factory **********
/**
- * Return a factory responsible for creating core (e.g. JpaProject), resource
- * (e.g. PersistenceResource), and context (e.g. PersistenceUnit) model
- * objects
+ * Return the factory responsible for constructing various
+ * JPA model objects:<ul>
+ * <li>core (e.g. {@link JpaProject})
+ * <li>Java context (e.g. {@link org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit})
+ * </ul>
*/
JpaFactory getJpaFactory();
@@ -83,7 +85,7 @@ public interface JpaPlatform
/**
* Return a JPA file corresponding to the specified Eclipse file.
- * Return null if the file's content is unsupported.
+ * Return <code>null</code> if the file's content is unsupported.
*/
JpaFile buildJpaFile(JpaProject jpaProject, IFile file);
@@ -92,7 +94,8 @@ public interface JpaPlatform
/**
* Return an annotation provider responsible for determining what Java
- * annotations are supported and constructing java resource model objects.
+ * annotations are supported and constructing the corresponding Java
+ * resource model objects.
*/
AnnotationProvider getAnnotationProvider();
@@ -130,16 +133,16 @@ public interface JpaPlatform
// ********** resource types and definitions **********
/**
- * Return whether the platform supports the specified resource type.
+ * Return whether the JPA platform supports the specified resource type.
* This method is consistent with {@link #getResourceDefinition(JptResourceType)}.
*/
boolean supportsResourceType(JptResourceType resourceType);
/**
- * Return the platform's resource definition for the specified resource type.
- * The returned definition describes the platform's corresponding context model.
+ * Return the JPA platform's resource definition for the specified resource type.
+ * The returned definition describes the JPA platform's corresponding context model.
* Throw an {@link IllegalArgumentException} if the resource type is not
- * supported by the platform.
+ * supported by the JPA platform.
* This method is consistent with {@link #supportsResourceType(JptResourceType)}.
*/
ResourceDefinition getResourceDefinition(JptResourceType resourceType);
@@ -147,7 +150,7 @@ public interface JpaPlatform
/**
* Return the most recent supported resource type for the specified content
* type. Throw an {@link IllegalArgumentException} if the content type is not
- * supported by the platform.
+ * supported by the JPA platform.
*/
JptResourceType getMostRecentSupportedResourceType(IContentType contentType);
@@ -171,7 +174,8 @@ public interface JpaPlatform
// ********** platform variation **********
/**
- * Return a platform variation that is used to determine differences platforms and/or JPA specification versions
+ * Return a JPA platform variation that is used to determine differences
+ * among JPA platforms and/or JPA specification versions.
*/
JpaPlatformVariation getJpaVariation();
@@ -186,9 +190,6 @@ public interface JpaPlatform
interface Version {
-
- Comparator<String> VERSION_COMPARATOR = new DefaultVersionComparator();
-
/**
* Return the platform's version.
*/
@@ -196,16 +197,16 @@ public interface JpaPlatform
/**
* Return the highest JPA specification version supported by the platform.
- * @see JpaFacet#VERSION_1_0
- * @see JpaFacet#VERSION_2_0
+ * @see JpaProject#FACET_VERSION_STRING
+ * @see JpaProject2_0#FACET_VERSION_STRING
*/
String getJpaVersion();
/**
* Return whether the platform is compatible with the specified JPA
* specification version.
- * @see JpaFacet#VERSION_1_0
- * @see JpaFacet#VERSION_2_0
+ * @see JpaProject#FACET_VERSION_STRING
+ * @see JpaProject2_0#FACET_VERSION_STRING
*/
boolean isCompatibleWithJpaVersion(String jpaVersion);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatformProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatformProvider.java
index a511eda3b7..07d91b19a8 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatformProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatformProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2012 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.
@@ -9,7 +9,6 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core;
-import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.jpt.common.core.JptResourceType;
import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition;
import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
@@ -25,9 +24,9 @@ import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition;
* This JpaPlatformProvider implementation most likely only returns providers
* that are extensions of other platforms. Then in the GenericJpaPlatform implementation
* you pass in 1 or more JpaPlatformProviders.
- *
+ * <p>
* See the org.eclipse.jpt.jpa.core.jpaPlatforms extension point
- *
+ * <p>
* Provisional API: This interface is part of an interim API that is still
* under development and expected to change significantly before reaching
* stability. It is available at this early stage to solicit feedback from
@@ -37,35 +36,35 @@ import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition;
* @version 2.3
* @since 2.2
*/
-public interface JpaPlatformProvider
-{
+public interface JpaPlatformProvider {
/**
- * Return the most recent resource type for the given content type supported by this platform
+ * Return the most recent resource type for the specified content type
+ * supported by the JPA platform
*/
- JptResourceType getMostRecentSupportedResourceType(IContentType contentType);
+ Iterable<JptResourceType> getMostRecentSupportedResourceTypes();
/**
- * Return the resource model providers that apply to this platform.
+ * Return the JPA platform's resource model providers.
*/
Iterable<JpaResourceModelProvider> getResourceModelProviders();
/**
- * Return the resource definitions supported by this platform.
+ * Return the JPA platform's resource definitions.
*/
Iterable<ResourceDefinition> getResourceDefinitions();
/**
- * Return the platform's Java type mapping definitions.
+ * Return the JPA platform's Java type mapping definitions.
*/
Iterable<JavaTypeMappingDefinition> getJavaTypeMappingDefinitions();
/**
- * Return the platform's default Java attribute mapping definitions.
+ * Return the JPA platform's default Java attribute mapping definitions.
*/
Iterable<DefaultJavaAttributeMappingDefinition> getDefaultJavaAttributeMappingDefinitions();
/**
- * Return the platform's specified Java attribute mapping definitions.
+ * Return the JPA platform's specified Java attribute mapping definitions.
*/
Iterable<JavaAttributeMappingDefinition> getSpecifiedJavaAttributeMappingDefinitions();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatformVariation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatformVariation.java
index a537fee196..a957cb3459 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatformVariation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatformVariation.java
@@ -13,27 +13,28 @@ import org.eclipse.jpt.common.core.JptResourceType;
import org.eclipse.jpt.jpa.core.context.AccessType;
/**
- * A JpaPlatform contains a JpaPlatformVariation. This is used for various jpa spec
- * items that are either optional or only supported by certain version of the spec.
- * Each platform implementation must determine if it supports these things.
- *
+ * A JPA platform has a JPA platform variation. The variation is used for
+ * various JPA spec items that are either optional or undefined.
+ * Each JPA platform implementation must determine whether it
+ * supports each of these features.
+ * <p>
* Provisional API: This interface is part of an interim API that is still
* under development and expected to change significantly before reaching
* stability. It is available at this early stage to solicit feedback from
* pioneering adopters on the understanding that any code that uses this API
* will almost certainly be broken (repeatedly) as the API evolves.
*
+ * @see JpaPlatform#getJpaVariation()
* @version 2.3
* @since 2.3
*/
-public interface JpaPlatformVariation
-{
+public interface JpaPlatformVariation {
/**
* Return whether table-per-concrete-class is a supported
* inheritance strategy in the JPA platform.
- * Supported.MAYBE means that it is in the JPA spec, but not portable
- * or might not be supported by a particular provider.
- * @return
+ * {@link Supported#MAYBE} means that it is defined in the JPA spec,
+ * but not portable or might not be supported by a particular
+ * JPA runtime implementation.
*/
Supported getTablePerConcreteClassInheritanceIsSupported();
@@ -45,22 +46,36 @@ public interface JpaPlatformVariation
AccessType[] getSupportedAccessTypes(JptResourceType resourceType);
- AccessType[] GENERIC_SUPPORTED_ACCESS_TYPES = new AccessType[] {AccessType.FIELD, AccessType.PROPERTY};
+ AccessType[] GENERIC_SUPPORTED_ACCESS_TYPES = new AccessType[] {
+ AccessType.FIELD,
+ AccessType.PROPERTY
+ };
+ /**
+ * Various indications of whether a particular feature is supported by a
+ * JPA runtime implementation.
+ */
public enum Supported {
/**
- * fully supported by the platform
+ * Fully supported by the JPA platform.
*/
YES,
/**
- * not supported by the platform
+ * Not supported by the JPA platform.
*/
NO,
/**
- * in the JPA spec, might not supported be supported by a particular provider
+ * Defined in the JPA spec, but might not be supported by
+ * a particular JPA runtime implementation. This setting should be
+ * returned only by the "generic" implementation, as it is tied to
+ * a specific runtime implementation and can only offer feedback as
+ * to whether a feature may be problematic at runtime, depending on
+ * the particular implementation. Implmentation-specific JPA platforms
+ * should be able to answer definitively whether the implementation
+ * supports a particular feature.
*/
- MAYBE,
+ MAYBE
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPreferences.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPreferences.java
new file mode 100644
index 0000000000..cc75cb65ac
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPreferences.java
@@ -0,0 +1,314 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.jpa.core;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jpt.common.utility.internal.Tools;
+import org.eclipse.jpt.jpa.core.internal.JpaPreferenceInitializer;
+import org.eclipse.jpt.jpa.core.internal.plugin.JptJpaCorePlugin;
+
+/**
+ * Public access to the Dali JPA preferences.
+ * <p>
+ * Preferences are a cross between public, model-related state and private,
+ * plug-in-related state; thus this public facade to state that is
+ * (traditionally) scoped by the source code's plug-in location.
+ * Another complication is that preferences must be available even when a
+ * model is not (yet) present (e.g. for a "creation" wizard).
+ * <p>
+ * Provisional API: This class is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.2
+ * @since 3.2
+ */
+public final class JpaPreferences {
+
+ // ********** project JPA platform ID **********
+
+ public static String getJpaPlatformID(IProject project) {
+ return getPlugin().getPreference(project, JPA_PLATFORM);
+ }
+
+ public static void setJpaPlatformID(IProject project, String id) {
+ getPlugin().setPreference(project, JPA_PLATFORM, id);
+ }
+
+ private static final String ORIGINAL_PLUGIN_ID = getPlugin().getOriginalPluginID();
+ private static final String ORIGINAL_PLUGIN_ID_ = ORIGINAL_PLUGIN_ID + '.';
+ // not sure why this is qualified... (to be consistent JDT?)
+ private static final String JPA_PLATFORM = ORIGINAL_PLUGIN_ID_ + "platform"; //$NON-NLS-1$
+
+
+ // ********** project discover annotated classes **********
+
+ public static boolean getDiscoverAnnotatedClasses(IProject project) {
+ return getPlugin().getBooleanPreference(project, DISCOVER_ANNOTATED_CLASSES);
+ }
+
+ public static void setDiscoverAnnotatedClasses(IProject project, boolean value) {
+ getPlugin().setBooleanPreference(project, DISCOVER_ANNOTATED_CLASSES, value);
+ }
+
+ private static final String PLUGIN_ID = getPlugin().getPluginID();
+ private static final String PLUGIN_ID_ = PLUGIN_ID + '.';
+ // we mistakenly changed this qualifier...
+ private static final String DISCOVER_ANNOTATED_CLASSES = PLUGIN_ID_ + "discoverAnnotatedClasses"; //$NON-NLS-1$
+
+
+ // ********** project metamodel source folder name **********
+
+ public static String getMetamodelSourceFolderName(IProject project) {
+ return getPlugin().getPreference(project, METAMODEL_SOURCE_FOLDER);
+ }
+
+ public static void setMetamodelSourceFolderName(IProject project, String name) {
+ getPlugin().setPreference(project, METAMODEL_SOURCE_FOLDER, name);
+ }
+
+ // we mistakenly used the new qualifier...
+ private static final String METAMODEL_SOURCE_FOLDER = PLUGIN_ID_ + "metamodelSourceFolderName"; //$NON-NLS-1$
+
+
+ // ********** project entity gen default package name **********
+
+ public static String getEntityGenDefaultPackageName(IProject project) {
+ return getPlugin().getPreference(project, ENTITY_GEN_DEFAULT_PACKAGE);
+ }
+
+ public static void setEntityGenDefaultPackageName(IProject project, String name) {
+ getPlugin().setPreference(project, ENTITY_GEN_DEFAULT_PACKAGE, name);
+ }
+
+ public static String getEntityGenDefaultPackageName() {
+ return getPlugin().getPreference(ENTITY_GEN_DEFAULT_PACKAGE);
+ }
+
+ public static void setEntityGenDefaultPackageName(String name) {
+ getPlugin().setPreference(ENTITY_GEN_DEFAULT_PACKAGE, name);
+ }
+
+ private static final String ENTITY_GEN = "entitygen"; //$NON-NLS-1$
+ private static final String ENTITY_GEN_ = ENTITY_GEN + '.';
+ private static final String ENTITY_GEN_DEFAULT_PACKAGE = ENTITY_GEN_ + "DEFAULT_PACKAGE"; //$NON-NLS-1$
+ private static final String ENTITY_GEN_DEFAULT_PACKAGE_DEFAULT = "model"; //$NON-NLS-1$
+
+
+ // ********** workspace/project user override default catalog **********
+
+ /**
+ * This preference is set in the workspace's metadata, not in the project's
+ * metadata.
+ */
+ public static String getUserOverrideDefaultCatalog(IProject project) {
+ return getPlugin().getPersistentProperty(project, USER_OVERRIDE_DEFAULT_CATALOG);
+ }
+
+ /**
+ * This preference is set in the workspace's metadata, not in the project's
+ * metadata.
+ */
+ public static void setUserOverrideDefaultCatalog(IProject project, String catalog) {
+ getPlugin().setPersistentProperty(project, USER_OVERRIDE_DEFAULT_CATALOG, catalog);
+ }
+
+ private static final String USER_OVERRIDE_DEFAULT_CATALOG = "userOverrideDefaultCatalogName"; //$NON-NLS-1$
+
+
+ // ********** workspace/project user override default schema **********
+
+ /**
+ * This preference is set in the workspace's metadata, not in the project's
+ * metadata.
+ */
+ public static String getUserOverrideDefaultSchema(IProject project) {
+ return getPlugin().getPersistentProperty(project, USER_OVERRIDE_DEFAULT_SCHEMA);
+ }
+
+ /**
+ * This preference is set in the workspace's metadata, not in the project's
+ * metadata.
+ */
+ public static void setUserOverrideDefaultSchema(IProject project, String schema) {
+ getPlugin().setPersistentProperty(project, USER_OVERRIDE_DEFAULT_SCHEMA, schema);
+ }
+
+ private static final String USER_OVERRIDE_DEFAULT_SCHEMA = "userOverrideDefaultSchemaName"; //$NON-NLS-1$
+
+
+ // ********** workspace/project connection profile **********
+
+ /**
+ * This preference is set in the workspace's metadata, not in the project's
+ * metadata.
+ */
+ public static String getConnectionProfileName(IProject project) {
+ return getPlugin().getPersistentProperty(project, CONNECTION_PROFILE_NAME);
+ }
+
+ /**
+ * This preference is set in the workspace's metadata, not in the project's
+ * metadata.
+ */
+ public static void setConnectionProfileName(IProject project, String name) {
+ getPlugin().setPersistentProperty(project, CONNECTION_PROFILE_NAME, name);
+ }
+
+ private static final String CONNECTION_PROFILE_NAME = "dataSource.connectionProfileName"; //$NON-NLS-1$
+
+
+ // ********** JPQL identifiers lowercase **********
+
+ public static boolean getJpqlIdentifierLowercase() {
+ return getJpqlIdentifierLowercase(getPlugin().getPreference(JPQL_IDENTIFIER_CASE));
+ }
+
+ public static boolean getJpqlIdentifierLowercaseDefault() {
+ return getJpqlIdentifierLowercase(JPQL_IDENTIFIER_CASE_DEFAULT);
+ }
+
+ private static boolean getJpqlIdentifierLowercase(String value) {
+ return Tools.valuesAreEqual(value, JPQL_IDENTIFIER_CASE_VALUE_LOWERCASE);
+ }
+
+ public static void setJpqlIdentifierLowercase(boolean value) {
+ getPlugin().setPreference(JPQL_IDENTIFIER_CASE, value ? JPQL_IDENTIFIER_CASE_VALUE_LOWERCASE : JPQL_IDENTIFIER_CASE_VALUE_UPPERCASE);
+ }
+
+ private static final String JPQL_IDENTIFIER = "jpqlIdentifier"; //$NON-NLS-1$
+ private static final String JPQL_IDENTIFIER_ = JPQL_IDENTIFIER + '.';
+ private static final String JPQL_IDENTIFIER_CASE = JPQL_IDENTIFIER_ + "CASE"; //$NON-NLS-1$
+ private static final String JPQL_IDENTIFIER_CASE_VALUE_LOWERCASE = "lowercase"; //$NON-NLS-1$
+ private static final String JPQL_IDENTIFIER_CASE_VALUE_UPPERCASE = "uppercase"; //$NON-NLS-1$
+ private static final String JPQL_IDENTIFIER_CASE_DEFAULT = JPQL_IDENTIFIER_CASE_VALUE_LOWERCASE;
+
+
+ // ********** JPQL match first character case **********
+
+ public static boolean getJpqlIdentifierMatchFirstCharacterCase() {
+ return getPlugin().getBooleanPreference(JPQL_IDENTIFIER_MATCH_FIRST_CHARACTER_CASE);
+ }
+
+ public static boolean getJpqlIdentifierMatchFirstCharacterCaseDefault() {
+ return JPQL_IDENTIFIER_MATCH_FIRST_CHARACTER_CASE_DEFAULT;
+ }
+
+ public static void setJpqlIdentifierMatchFirstCharacterCase(boolean value) {
+ getPlugin().setBooleanPreference(JPQL_IDENTIFIER_MATCH_FIRST_CHARACTER_CASE, value);
+ }
+
+ private static final String JPQL_IDENTIFIER_MATCH_FIRST_CHARACTER_CASE = JPQL_IDENTIFIER_ + "MATCH_FIRST_CHARACTER_CASE"; //$NON-NLS-1$
+ private static final boolean JPQL_IDENTIFIER_MATCH_FIRST_CHARACTER_CASE_DEFAULT = true;
+
+
+ // ********** project validation messages **********
+
+ public static boolean getWorkspaceValidationPreferencesOverridden(IProject project) {
+ return getPlugin().getBooleanPreference(project, WORKSPACE_PREFERENCES_OVERRIDDEN);
+ }
+
+ public static void setWorkspaceValidationPreferencesOverridden(IProject project, boolean value) {
+ getPlugin().setBooleanPreference(project, WORKSPACE_PREFERENCES_OVERRIDDEN, value);
+ }
+
+ // unfortunate legacy typo :-(
+ private static final String WORKSPACE_PREFERENCES_OVERRIDDEN = "workspace_preferences_overriden"; //$NON-NLS-1$
+
+ /**
+ * Project-level problem preference.
+ * @see #PROBLEM_ERROR
+ * @see #PROBLEM_WARNING
+ * @see #PROBLEM_IGNORE
+ * @see #PROBLEM_INFO
+ */
+ public static String getProblemSeverity(IProject project, String messageID) {
+ return getPlugin().getPreference(project, PROBLEM_ + messageID);
+ }
+
+ /**
+ * Project-level problem preference.
+ * @see #PROBLEM_ERROR
+ * @see #PROBLEM_WARNING
+ * @see #PROBLEM_IGNORE
+ * @see #PROBLEM_INFO
+ */
+ public static void setProblemSeverity(IProject project, String messageID, String value) {
+ getPlugin().setPreference(project, PROBLEM_ + messageID, value);
+ }
+
+ /**
+ * Workspace-level problem preference.
+ * @see #PROBLEM_ERROR
+ * @see #PROBLEM_WARNING
+ * @see #PROBLEM_IGNORE
+ * @see #PROBLEM_INFO
+ */
+ public static String getProblemSeverity(String messageID) {
+ return getPlugin().getPreference(PROBLEM_ + messageID);
+ }
+
+ /**
+ * Workspace-level problem preference.
+ * @see #PROBLEM_ERROR
+ * @see #PROBLEM_WARNING
+ * @see #PROBLEM_IGNORE
+ * @see #PROBLEM_INFO
+ */
+ public static void setProblemSeverity(String messageID, String value) {
+ getPlugin().setPreference(PROBLEM_ + messageID, value);
+ }
+
+ private static final String PROBLEM = "problem"; //$NON-NLS-1$
+ private static final String PROBLEM_ = PROBLEM + '.';
+
+ // TODO move to validation objects once we have them
+ public static final String PROBLEM_ERROR = "error"; //$NON-NLS-1$
+ public static final String PROBLEM_WARNING = "warning"; //$NON-NLS-1$
+ public static final String PROBLEM_INFO = "info"; //$NON-NLS-1$
+ public static final String PROBLEM_IGNORE = "ignore"; //$NON-NLS-1$
+
+
+ // ********** misc **********
+
+ /**
+ * Internal: Called <em>only</em> by the
+ * {@link JpaPreferenceInitializer#initializeDefaultPreferences()
+ * JPA preferences initializer}.
+ */
+ public static void initializeDefaultPreferences() {
+ getPlugin().setDefaultPreference(ENTITY_GEN_DEFAULT_PACKAGE, ENTITY_GEN_DEFAULT_PACKAGE_DEFAULT);
+ getPlugin().setDefaultPreference(JPQL_IDENTIFIER_CASE, JPQL_IDENTIFIER_CASE_DEFAULT);
+ getPlugin().setBooleanDefaultPreference(JPQL_IDENTIFIER_MATCH_FIRST_CHARACTER_CASE, JPQL_IDENTIFIER_MATCH_FIRST_CHARACTER_CASE_DEFAULT);
+ }
+
+ /**
+ * Remove both the project's settings and the workspace settings
+ * related to the project.
+ */
+ public static void removePreferences(IProject project) {
+ getPlugin().removePreferences(project);
+ getPlugin().removePersistentProperties(project);
+ }
+
+ public static void removePreferences() {
+ getPlugin().removePreferences();
+ }
+
+ private static JptJpaCorePlugin getPlugin() {
+ return JptJpaCorePlugin.instance();
+ }
+
+ private JpaPreferences() {
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaProject.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaProject.java
index 6b2297c8dc..b6f5133d9b 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaProject.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaProject.java
@@ -24,11 +24,16 @@ import org.eclipse.jpt.common.core.utility.command.JobCommand;
import org.eclipse.jpt.common.utility.ExceptionHandler;
import org.eclipse.jpt.common.utility.command.ExtendedCommandExecutor;
import org.eclipse.jpt.jpa.core.context.JpaRootContextNode;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
+import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistence;
import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
import org.eclipse.jpt.jpa.db.Catalog;
import org.eclipse.jpt.jpa.db.ConnectionProfile;
import org.eclipse.jpt.jpa.db.Schema;
import org.eclipse.jpt.jpa.db.SchemaContainer;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -52,7 +57,7 @@ import org.eclipse.wst.validation.internal.provisional.core.IReporter;
* Reference JPA project reference} to retrieve a JPA project in a blocking
* fashion that will return a JPA project once it has been constructed.
* <p>
- * See <code>org.eclipse.jpt.jpa.core/plugin.xml</code>.
+ * See <code>org.eclipse.jpt.jpa.core/plugin.xml:org.eclipse.core.runtime.adapters</code>.
* <p>
* Provisional API: This interface is part of an interim API that is still
* under development and expected to change significantly before reaching
@@ -69,6 +74,32 @@ import org.eclipse.wst.validation.internal.provisional.core.IReporter;
public interface JpaProject
extends JpaNode
{
+ // ********** JPA facet **********
+
+ /**
+ * The JPA project facet ID.
+ * <p>
+ * Value: {@value}
+ */
+ String FACET_ID = "jpt.jpa"; //$NON-NLS-1$
+
+ /**
+ * The JPA project facet.
+ */
+ IProjectFacet FACET = ProjectFacetsManager.getProjectFacet(FACET_ID);
+
+ /**
+ * The JPA project facet version string.
+ * <p>
+ * Value: {@value}
+ */
+ String FACET_VERSION_STRING = "1.0"; //$NON-NLS-1$
+
+ /**
+ * The JPA project facet version.
+ */
+ IProjectFacetVersion FACET_VERSION = FACET.getVersion(FACET_VERSION_STRING);
+
// ********** general **********
@@ -171,17 +202,17 @@ public interface JpaProject
* <code>META-INF/persistence.xml</code> if that file has the persistence content type
* (<code>"org.eclipse.jpt.jpa.core.content.persistence"</code>).
*
- * @see JptJpaCorePlugin#DEFAULT_PERSISTENCE_XML_RUNTIME_PATH
- * @see JptJpaCorePlugin#PERSISTENCE_XML_CONTENT_TYPE
+ * @see XmlPersistence#DEFAULT_RUNTIME_PATH
+ * @see XmlPersistence#CONTENT_TYPE
*/
JpaXmlResource getPersistenceXmlResource();
/**
* Return the XML resource model corresponding to the file with the specified
* runtime path if that file has the mapping file content type
- * (<code>"org.eclipse.jpt.jpa.core.content.mappingFile"</code>)
+ * (<code>org.eclipse.jpt.jpa.core.content.mappingFile</code>)
*
- * @see JptJpaCorePlugin#MAPPING_FILE_CONTENT_TYPE
+ * @see org.eclipse.jpt.jpa.core.resource.ResourceMappingFile.Root#CONTENT_TYPE
*/
JpaXmlResource getMappingFileXmlResource(IPath runtimePath);
@@ -189,7 +220,7 @@ public interface JpaProject
* Return the XML resource model corresponding to the file
* <code>META-INF/orm.xml</code> if that file has the mapping file content type.
*
- * @see JptJpaCorePlugin#DEFAULT_ORM_XML_RUNTIME_PATH
+ * @see XmlEntityMappings#DEFAULT_RUNTIME_PATH
*/
JpaXmlResource getDefaultOrmXmlResource();
@@ -467,6 +498,7 @@ public interface JpaProject
// ********** logging **********
+ // TODO remove (use plug-in API)
/**
* Log the specified message.
*/
@@ -482,6 +514,7 @@ public interface JpaProject
*/
void log(String msg, Throwable throwable);
+ // TODO remove (use plug-in API)
/**
* Return an exception handler that can be used by the JPA model.
*/
@@ -551,7 +584,7 @@ public interface JpaProject
* JpaProject.Reference jpaProjectRef = (JpaProject.Reference) project.getAdapter(JpaProject.Reference.class);
* JpaProject jpaProject = jpaProjectRef.getValue();
* </pre>
- * See <code>org.eclipse.jpt.jpa.core/plugin.xml</code>.
+ * See <code>org.eclipse.jpt.jpa.core/plugin.xml:org.eclipse.core.runtime.adapters</code>.
* @see org.eclipse.jpt.jpa.core.internal.ProjectAdapterFactory
*/
interface Reference {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaProjectManager.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaProjectManager.java
index dc2adedbe5..bd5290c75b 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaProjectManager.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaProjectManager.java
@@ -9,24 +9,19 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core;
-import org.eclipse.core.resources.IWorkspace;
import org.eclipse.jpt.common.utility.BooleanReference;
import org.eclipse.jpt.common.utility.command.Command;
import org.eclipse.jpt.common.utility.command.ExtendedCommandExecutor;
import org.eclipse.jpt.common.utility.model.Model;
/**
- * The JPA project manager holds all the JPA projects in the Eclipse workspace
+ * The JPA project manager holds all the JPA projects in an Eclipse workspace
* and provides support for executing long-running commands that modify the
* context model.
* <p>
- * To retrieve the JPA project manager corresponding to an Eclipse workspace:
- * <pre>
- * IWorkspace workspace = ResourcesPlugin.getWorkspace();
- * JpaProjectManager jpaProjectManager = (JpaProjectManager) workspace.getAdapter(JpaProjectManager.class);
- * </pre>
+ * Retrieve a JPA project manager from a {#link JpaWorkspace JPA workspace}.
* <p>
- * See <code>org.eclipse.jpt.jpa.core/plugin.xml</code>.
+ * Not intended to be implemented by clients.
* <p>
* Provisional API: This interface is part of an interim API that is still
* under development and expected to change significantly before reaching
@@ -41,9 +36,9 @@ public interface JpaProjectManager
extends Model
{
/**
- * Return the JPA project manager's workspace.
+ * Return the JPA project manager's JPA workspace.
*/
- IWorkspace getWorkspace();
+ JpaWorkspace getJpaWorkspace();
// ********** JPA projects **********
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaResourceModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaResourceModelProvider.java
index 0b434b8c6d..d4cd572657 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaResourceModelProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaResourceModelProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2012 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.
@@ -10,12 +10,12 @@
package org.eclipse.jpt.jpa.core;
import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.jpt.common.core.ContentTypeReference;
import org.eclipse.jpt.common.core.JptResourceModel;
/**
* Map a content type to a JPA resource model.
- *
+ * <p>
* Provisional API: This interface is part of an interim API that is still
* under development and expected to change significantly before reaching
* stability. It is available at this early stage to solicit feedback from
@@ -25,14 +25,10 @@ import org.eclipse.jpt.common.core.JptResourceModel;
* @version 2.2
* @since 2.2
*/
-public interface JpaResourceModelProvider
+public interface JpaResourceModelProvider
+ extends ContentTypeReference
{
/**
- * Return the file content type the provider is for.
- */
- IContentType getContentType();
-
- /**
* Build a JPA resource model for the specified JPA project and file.
* Use the specified factory for creation so extenders can simply override
* the appropriate creation method instead of building a provider for the
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaStructureNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaStructureNode.java
index 8a62dc7b3c..c40cb8c4fd 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaStructureNode.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaStructureNode.java
@@ -9,12 +9,10 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core;
-import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jpt.common.core.JptResourceType;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.model.Model;
-
+import org.eclipse.jpt.jpa.core.context.JpaContextNode;
/**
* Interface implemented by any object to appear in the JPA Structure view
@@ -31,7 +29,7 @@ import org.eclipse.jpt.common.utility.model.Model;
* @since 2.0
*/
public interface JpaStructureNode
- extends Model, IAdaptable
+ extends JpaContextNode
{
/**
* Return the structure node at the specified offset in the structure node's
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaWorkspace.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaWorkspace.java
new file mode 100644
index 0000000000..f73d35b7aa
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaWorkspace.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.jpa.core;
+
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.jpt.jpa.core.platform.JpaPlatformManager;
+
+/**
+ * The Dali JPA state corresponding to an {@link IWorkspace Eclipse workspace}.
+ * <p>
+ * To retrieve the JPA workspace corresponding to an Eclipse workspace:
+ * <pre>
+ * IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ * JpaWorkspace jpaWorkspace = (JpaWorkspace) workspace.getAdapter(JpaWorkspace.class);
+ * </pre>
+ * <p>
+ * See <code>org.eclipse.jpt.jpa.core/plugin.xml:org.eclipse.core.runtime.adapters</code>.
+ * <p>
+ * Not intended to be implemented by clients.
+ * <p>
+ * Provisional API: This class is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.2
+ * @since 3.2
+ */
+public interface JpaWorkspace {
+ /**
+ * Return the corresponding Eclipse workspace.
+ */
+ IWorkspace getWorkspace();
+
+ /**
+ * Return the manager for the workspace's JPA platforms.
+ */
+ JpaPlatformManager getJpaPlatformManager();
+
+ /**
+ * Return the manager for all the workspace's JPA projects.
+ */
+ JpaProjectManager getJpaProjectManager();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JptJpaCorePlugin.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JptJpaCorePlugin.java
deleted file mode 100644
index 078b498282..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JptJpaCorePlugin.java
+++ /dev/null
@@ -1,533 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2012 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.jpa.core;
-
-import java.util.Hashtable;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.QualifiedName;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.common.core.JptResourceType;
-import org.eclipse.jpt.common.core.internal.JptPlugin;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.internal.InternalJpaProjectManager;
-import org.eclipse.jpt.jpa.core.internal.platform.JpaPlatformManagerImpl;
-import org.eclipse.jpt.jpa.core.internal.prefs.JpaPreferencesManager;
-import org.eclipse.jpt.jpa.core.platform.GenericPlatform;
-import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
-import org.eclipse.jpt.jpa.core.platform.JpaPlatformManager;
-import org.eclipse.jst.j2ee.internal.J2EEConstants;
-import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
-import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework;
-import org.eclipse.wst.common.project.facet.core.IProjectFacet;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-import org.osgi.framework.BundleContext;
-import org.osgi.service.prefs.Preferences;
-
-/**
- * The Dali core plug-in lifecycle implementation.
- * A number of globally-available constants and methods.
- * <p>
- * Provisional API: This class is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- *
- * @version 3.0
- * @since 2.0
- */
-// TODO bjv move to *private* internal package and move all public stuff to adapters etc.
-public class JptJpaCorePlugin
- extends JptPlugin
-{
- private final Hashtable<IWorkspace, InternalJpaProjectManager> jpaProjectManagers = new Hashtable<IWorkspace, InternalJpaProjectManager>();
-
- // ********** public constants **********
-
- /**
- * The plug-in identifier of the persistence support
- * (value <code>"org.eclipse.jpt.jpa.core"</code>).
- */
- public static final String PLUGIN_ID = "org.eclipse.jpt.jpa.core"; //$NON-NLS-1$
- public static final String PLUGIN_ID_ = PLUGIN_ID + '.';
-
- /**
- * The legacy plug-in identifier of the persistence support, used for project preferences
- * (value <code>"org.eclipse.jpt.core"</code>).
- */
- public static final String LEGACY_PLUGIN_ID = "org.eclipse.jpt.core"; //$NON-NLS-1$
- public static final String LEGACY_PLUGIN_ID_ = LEGACY_PLUGIN_ID + '.';
-
- /**
- * The key for storing a JPA project's data source connection profile name
- * in the Eclipse project's persistent properties.
- */
- public static final QualifiedName DATA_SOURCE_CONNECTION_PROFILE_NAME =
- new QualifiedName(PLUGIN_ID, "dataSource.connectionProfileName"); //$NON-NLS-1$
-
- /**
- * The key for storing a JPA project's user overridden default catalog name
- * in the Eclipse project's persistent properties.
- */
- public static final QualifiedName USER_OVERRIDE_DEFAULT_CATALOG =
- new QualifiedName(PLUGIN_ID, "userOverrideDefaultCatalogName"); //$NON-NLS-1$
-
- /**
- * The key for storing a JPA project's user overridden default schema name
- * in the Eclipse project's persistent properties.
- */
- public static final QualifiedName USER_OVERRIDE_DEFAULT_SCHEMA =
- new QualifiedName(PLUGIN_ID, "userOverrideDefaultSchemaName"); //$NON-NLS-1$
-
-
- /**
- * The identifier for the JPA validation marker
- * (value <code>"org.eclipse.jpt.jpa.core.jpaProblemMarker"</code>).
- */
- public static final String VALIDATION_MARKER_ID = PLUGIN_ID + ".jpaProblemMarker"; //$NON-NLS-1$
-
- /**
- * The identifier for the JPA validator
- * (value <code>"org.eclipse.jpt.jpa.core.jpaValidator"</code>).
- */
- public static final String VALIDATOR_ID = PLUGIN_ID_ + "jpaValidator"; //$NON-NLS-1$
-
- /**
- * The content type for <code>persistence.xml</code> files.
- */
- public static final IContentType PERSISTENCE_XML_CONTENT_TYPE = getJpaContentType("persistence"); //$NON-NLS-1$
-
- /**
- * The resource type for <code>persistence.xml</code> version 1.0 files
- */
- public static final JptResourceType PERSISTENCE_XML_1_0_RESOURCE_TYPE =
- new JptResourceType(PERSISTENCE_XML_CONTENT_TYPE, org.eclipse.jpt.jpa.core.resource.persistence.JPA.SCHEMA_VERSION);
-
- /**
- * The resource type for <code>persistence.xml</code> version 2.0 files
- */
- public static final JptResourceType PERSISTENCE_XML_2_0_RESOURCE_TYPE =
- new JptResourceType(PERSISTENCE_XML_CONTENT_TYPE, org.eclipse.jpt.jpa.core.resource.persistence.v2_0.JPA2_0.SCHEMA_VERSION);
-
- /**
- * The base content type for all mapping files.
- */
- public static final IContentType MAPPING_FILE_CONTENT_TYPE = getJpaContentType("mappingFile"); //$NON-NLS-1$
-
- /**
- * The content type for <code>orm.xml</code> mapping files.
- */
- public static final IContentType ORM_XML_CONTENT_TYPE = getJpaContentType("orm"); //$NON-NLS-1$
-
- /**
- * The resource type for <code>orm.xml</code> version 1.0 mapping files
- */
- public static final JptResourceType ORM_XML_1_0_RESOURCE_TYPE =
- new JptResourceType(ORM_XML_CONTENT_TYPE, org.eclipse.jpt.jpa.core.resource.orm.JPA.SCHEMA_VERSION);
-
- /**
- * The resource type for <code>orm.xml</code> version 2.0 mapping files
- */
- public static final JptResourceType ORM_XML_2_0_RESOURCE_TYPE =
- new JptResourceType(ORM_XML_CONTENT_TYPE, org.eclipse.jpt.jpa.core.resource.orm.v2_0.JPA2_0.SCHEMA_VERSION);
-
- /**
- * Web projects have some special exceptions.
- */
- public static final IProjectFacet WEB_FACET
- = ProjectFacetsManager.getProjectFacet(IModuleConstants.JST_WEB_MODULE);
-
- public static final IPath DEFAULT_PERSISTENCE_XML_RUNTIME_PATH = new Path("META-INF/persistence.xml"); //$NON-NLS-1$
-
- public static final IPath DEFAULT_ORM_XML_RUNTIME_PATH = new Path("META-INF/orm.xml"); //$NON-NLS-1$
-
- private static IContentType getJpaContentType(String jpaContentType) {
- return getContentType(CONTENT_PREFIX_ + jpaContentType);
- }
-
- public static final String CONTENT_PREFIX = PLUGIN_ID_ + "content"; //$NON-NLS-1$
-
- public static final String CONTENT_PREFIX_ = CONTENT_PREFIX + '.';
-
- private static IContentType getContentType(String contentType) {
- return Platform.getContentTypeManager().getContentType(contentType);
- }
-
- // ********** singleton **********
-
- static JptJpaCorePlugin INSTANCE;
-
- public static JptJpaCorePlugin instance() {
- return INSTANCE;
- }
-
- // ********** public static methods **********
-
- /**
- * Return the JPA project manager corresponding to the specified workspace.
- * <p>
- * The preferred way to retrieve the JPA project manager is via the Eclipse
- * adapter framework:
- * <pre>
- * JpaProjectManager manager = (JpaProjectManager) ResourcesPlugin.getWorkspace().getAdapter(JpaProjectManager.class)
- * </pre>
- * @deprecated use <code>workspace.getAdapter(JpaProjectManager.class)</code>
- */
- @Deprecated
- public static JpaProjectManager getJpaProjectManager(IWorkspace workspace) {
- return INSTANCE.getJpaProjectManager_(workspace);
- }
-
- /**
- * Return whether the specified Eclipse project has a Web facet.
- */
- public static boolean projectHasWebFacet(IProject project) {
- return projectHasFacet(project, WEB_FACET);
- }
-
- /**
- * Checked exceptions bite.
- */
- private static boolean projectHasFacet(IProject project, IProjectFacet facet) {
- try {
- return FacetedProjectFramework.hasProjectFacet(project, facet.getId());
- } catch (CoreException ex) {
- log(ex); // problems reading the project metadata - assume facet doesn't exist - return 'false'
- return false;
- }
- }
-
- /**
- * Return the runtime path to which JARs are relatively specified for
- * the given project.
- * (Web projects have a different runtime structure than non-web projects.)
- */
- public static IPath getJarRuntimeRootPath(IProject project) {
- return projectHasWebFacet(project) ?
- new Path("/" + J2EEConstants.WEB_INF) //$NON-NLS-1$
- : new Path("/"); //$NON-NLS-1$
- }
-
- /**
- * Return the default {@link JpaPlatformDescription} for new JPA projects with the given JPA facet version.
- */
- public static JpaPlatformDescription getDefaultJpaPlatform(IProjectFacetVersion jpaFacetVersion) {
- JpaPlatformDescription defaultPlatform = getDefaultJpaPlatform(
- jpaFacetVersion,
- JpaPreferencesManager.getLegacyWorkspacePreferences(),
- JpaPreferencesManager.getLegacyDefaultPreferences(),
- JpaPreferencesManager.getDefaultPreferences());
- if (defaultPlatform == null) {
- // if the platform ID stored in the workspace prefs is invalid (i.e. null), look in the default prefs
- defaultPlatform = getDefaultJpaPlatform(
- jpaFacetVersion,
- JpaPreferencesManager.getLegacyDefaultPreferences());
- }
- return defaultPlatform;
- }
-
- private static JpaPlatformDescription getDefaultJpaPlatform(IProjectFacetVersion jpaFacetVersion, Preferences ... nodes) {
- JpaPlatformDescription defaultDefaultPlatform = getDefaultJpaPlatform(
- jpaFacetVersion,
- JpaPreferencesManager.DEFAULT_JPA_PLATFORM_PREF_KEY,
- null,
- nodes);
- String preferenceKey = null;
- if (jpaFacetVersion.equals(JpaFacet.VERSION_1_0)) {
- if (defaultDefaultPlatform == null) {
- defaultDefaultPlatform = GenericPlatform.VERSION_1_0;
- }
- preferenceKey = JpaPreferencesManager.DEFAULT_JPA_PLATFORM_1_0_PREF_KEY;
- }
- else if (jpaFacetVersion.equals(JpaFacet.VERSION_2_0)) {
- if (defaultDefaultPlatform == null) {
- defaultDefaultPlatform = GenericPlatform.VERSION_2_0;
- }
- preferenceKey = JpaPreferencesManager.DEFAULT_JPA_PLATFORM_2_0_PREF_KEY;
- }
- else {
- throw new IllegalArgumentException("Illegal JPA facet version: " + jpaFacetVersion); //$NON-NLS-1$
- }
- return getDefaultJpaPlatform(jpaFacetVersion, preferenceKey, defaultDefaultPlatform, nodes);
- }
-
- private static JpaPlatformDescription getDefaultJpaPlatform(
- IProjectFacetVersion jpaFacetVersion, String preferenceKey, JpaPlatformDescription defaultDefault, Preferences ... nodes) {
-
- String defaultDefaultId = (defaultDefault == null) ? null : defaultDefault.getId();
- String defaultPlatformId = Platform.getPreferencesService().get(preferenceKey, defaultDefaultId, nodes);
- JpaPlatformDescription defaultPlatform = getJpaPlatformManager().getJpaPlatform(defaultPlatformId);
- if (defaultPlatform != null && defaultPlatform.supportsJpaFacetVersion(jpaFacetVersion)) {
- return defaultPlatform;
- }
- else if (defaultDefault != null && defaultDefault.supportsJpaFacetVersion(jpaFacetVersion)) {
- return defaultDefault;
- }
- return null;
- }
-
- public static JpaPlatformManager getJpaPlatformManager() {
- return JpaPlatformManagerImpl.instance();
- }
-
- /**
- * Set the default JPA platform ID for creating new JPA projects
- */
- public static void setDefaultJpaPlatformId(String jpaFacetVersion, String platformId) {
- String preferenceKey = null;
- if (JpaFacet.VERSION_1_0.getVersionString().equals(jpaFacetVersion)) {
- preferenceKey = JpaPreferencesManager.DEFAULT_JPA_PLATFORM_1_0_PREF_KEY;
- }
- else if (JpaFacet.VERSION_2_0.getVersionString().equals(jpaFacetVersion)) {
- preferenceKey = JpaPreferencesManager.DEFAULT_JPA_PLATFORM_2_0_PREF_KEY;
- }
- else {
- throw new IllegalArgumentException("Illegal JPA facet version: " + jpaFacetVersion); //$NON-NLS-1$
- }
- JpaPreferencesManager.setLegacyWorkspacePreference(preferenceKey, platformId);
- }
-
- /**
- * Return the JPA platform ID associated with the specified Eclipse project.
- */
- public static String getJpaPlatformId(IProject project) {
- return (new JpaPreferencesManager(project)).getJpaPlatformId();
- }
-
- /**
- * Return the JPA platform description associated with the specified Eclipse project.
- */
- public static JpaPlatformDescription getJpaPlatformDescription(IProject project) {
- String jpaPlatformId = getJpaPlatformId(project);
- return getJpaPlatformManager().getJpaPlatform(jpaPlatformId);
- }
-
- /**
- * Set the JPA platform ID associated with the specified Eclipse project.
- */
- public static void setJpaPlatformId(IProject project, String jpaPlatformId) {
- (new JpaPreferencesManager(project)).setJpaPlatformId(jpaPlatformId);
- }
-
- /**
- * Return the JPA "discover" flag associated with the specified
- * Eclipse project.
- */
- public static boolean getDiscoverAnnotatedClasses(IProject project) {
- return (new JpaPreferencesManager(project)).getDiscoverAnnotatedClasses();
- }
-
- /**
- * Set the JPA "discover" flag associated with the specified
- * Eclipse project.
- */
- public static void setDiscoverAnnotatedClasses(IProject project, boolean discoverAnnotatedClasses) {
- (new JpaPreferencesManager(project)).setDiscoverAnnotatedClasses(discoverAnnotatedClasses);
- }
-
- /**
- * Return the name of the metamodel source folder associated with the
- * specified Eclipse project.
- */
- public static String getMetamodelSourceFolderName(IProject project) {
- return (new JpaPreferencesManager(project)).getMetamodelSourceFolderName();
- }
-
- /**
- * Set the name of the metamodel source folder associated with the
- * specified Eclipse project.
- */
- public static void setMetamodelSourceFolderName(IProject project, String metamodelSourceFolderName) {
- (new JpaPreferencesManager(project)).setMetamodelSourceFolderName(metamodelSourceFolderName);
- }
-
- /**
- * Return the name of the connection profile associated with the specified
- * Eclipse project.
- */
- public static String getConnectionProfileName(IProject project) {
- try {
- String connectionProfileName = project.getPersistentProperty(DATA_SOURCE_CONNECTION_PROFILE_NAME);
- // some old connection profile names were stored as empty strings instead of nulls :-(
- // convert them here
- return (StringTools.stringIsEmpty(connectionProfileName)) ? null : connectionProfileName;
- } catch (CoreException ex) {
- log(ex);
- return null;
- }
- }
-
- /**
- * Set the name of the connection profile associated with the specified
- * Eclipse project.
- */
- public static void setConnectionProfileName(IProject project, String connectionProfileName) {
- try {
- project.setPersistentProperty(DATA_SOURCE_CONNECTION_PROFILE_NAME, connectionProfileName);
- } catch (CoreException ex) {
- log(ex);
- }
- }
-
- /**
- * Return the default catalog (identifier) associated with the specified Eclipse project.
- * @see JpaProject#getUserOverrideDefaultCatalog()
- */
- public static String getUserOverrideDefaultCatalog(IProject project) {
- try {
- return project.getPersistentProperty(USER_OVERRIDE_DEFAULT_CATALOG);
- } catch (CoreException ex) {
- log(ex);
- return null;
- }
- }
-
- /**
- * Set the default catalog (identifier) associated with the specified Eclipse project.
- * @see JpaProject#setUserOverrideDefaultCatalog(String)
- */
- public static void setUserOverrideDefaultCatalog(IProject project, String defaultCatalog) {
- try {
- project.setPersistentProperty(USER_OVERRIDE_DEFAULT_CATALOG, defaultCatalog);
- } catch (CoreException ex) {
- log(ex);
- }
- }
-
- /**
- * Return the default schema (identifier) associated with the specified Eclipse project.
- * @see JpaProject#getUserOverrideDefaultSchema()
- */
- public static String getUserOverrideDefaultSchema(IProject project) {
- try {
- return project.getPersistentProperty(USER_OVERRIDE_DEFAULT_SCHEMA);
- } catch (CoreException ex) {
- log(ex);
- return null;
- }
- }
-
- /**
- * Set the default schema (identifier) associated with the specified Eclipse project.
- * @see JpaProject#setUserOverrideDefaultSchema(String)
- */
- public static void setUserOverrideDefaultSchema(IProject project, String defaultSchema) {
- try {
- project.setPersistentProperty(USER_OVERRIDE_DEFAULT_SCHEMA, defaultSchema);
- } catch (CoreException ex) {
- log(ex);
- }
- }
-
- /**
- * Clear the JPA-specific project properties
- */
- public static void clearProjectPersistentProperties(IProject project) {
- try {
- project.setPersistentProperty(DATA_SOURCE_CONNECTION_PROFILE_NAME, null);
- project.setPersistentProperty(USER_OVERRIDE_DEFAULT_CATALOG, null);
- project.setPersistentProperty(USER_OVERRIDE_DEFAULT_SCHEMA, null);
- }
- catch (CoreException ce) {
- log(ce);
- }
- }
-
- public static boolean nodeIsJpa2_0Compatible(JpaNode jpaNode) {
- return jpaNode.getJpaProject().getJpaPlatform().getJpaVersion().isCompatibleWithJpaVersion(JpaFacet.VERSION_2_0.getVersionString());
- }
-
- public static boolean nodeIsXml2_0Compatible(XmlContextNode xmlContextNode) {
- return resourceTypeIsCompatible(xmlContextNode.getResourceType(), org.eclipse.jpt.jpa.core.resource.orm.v2_0.JPA2_0.SCHEMA_VERSION);
- }
-
- public static boolean resourceTypeIsCompatible(JptResourceType resourceType, String version) {
- return JpaPlatform.Version.VERSION_COMPARATOR.compare(resourceType.getVersion(), version) >= 0;
- }
-
- /**
- * Log the specified message.
- */
- public static void log(String msg) {
- INSTANCE.logError(msg);
- }
-
- /**
- * Log the specified exception or error.
- */
- public static void log(Throwable throwable) {
- INSTANCE.logError(throwable);
- }
-
- /**
- * Log the specified message and exception or error.
- */
- public static void log(String msg, Throwable throwable) {
- INSTANCE.logError(msg, throwable);
- }
-
-
- // ********** plug-in implementation **************************************************
-
- public JptJpaCorePlugin() {
- super();
- if (INSTANCE != null) {
- throw new IllegalStateException();
- }
- // this convention is *wack*... ~bjv
- INSTANCE = this;
- }
-
-
- @Override
- public synchronized void start(BundleContext context) throws Exception {
- super.start(context);
- // nothing yet
- }
-
- @Override
- public synchronized void stop(BundleContext context) throws Exception {
- try {
- for (InternalJpaProjectManager jpaProjectManager : this.jpaProjectManagers.values()) {
- jpaProjectManager.stop();
- }
- this.jpaProjectManagers.clear();
- } finally {
- super.stop(context);
- }
- }
-
-
- // ********** JPA project manager **********
-
- /**
- * @see #getJpaProjectManager(IWorkspace)
- */
- private synchronized InternalJpaProjectManager getJpaProjectManager_(IWorkspace workspace) {
- InternalJpaProjectManager jpaProjectManager = this.jpaProjectManagers.get(workspace);
- if (this.isActive() && (jpaProjectManager == null)) {
- jpaProjectManager = this.buildJpaProjectManager(workspace);
- jpaProjectManager.start();
- this.jpaProjectManagers.put(workspace, jpaProjectManager);
- }
- return jpaProjectManager;
- }
-
- private InternalJpaProjectManager buildJpaProjectManager(IWorkspace workspace) {
- return new InternalJpaProjectManager(workspace);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/ResourceDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/ResourceDefinition.java
index 7c73fe07f5..78599fd140 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/ResourceDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/ResourceDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2012 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.
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core;
-import org.eclipse.jpt.common.core.JptResourceType;
+import org.eclipse.jpt.common.core.JptResourceTypeReference;
/**
* A JPA platform can support multiple resources. Each will
@@ -25,9 +25,7 @@ import org.eclipse.jpt.common.core.JptResourceType;
* @since 2.3
*/
public interface ResourceDefinition
+ extends JptResourceTypeReference
{
- /**
- * Return the definition's resource type.
- */
- JptResourceType getResourceType();
+ // methods refactored to JptResourceTypeReference...
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JpaContextNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JpaContextNode.java
index 3de89e27bf..9e1e97af66 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JpaContextNode.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JpaContextNode.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 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.
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context;
-import org.eclipse.jpt.common.core.JptResourceType;
+import org.eclipse.jpt.common.core.JptResourceTypeReference;
import org.eclipse.jpt.jpa.core.JpaNode;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.jpa.db.Catalog;
@@ -30,14 +30,9 @@ import org.eclipse.jpt.jpa.db.SchemaContainer;
* @since 2.0
*/
public interface JpaContextNode
- extends JpaNode
+ extends JpaNode, JptResourceTypeReference
{
/**
- * Return the resource type of the context node's resource.
- */
- JptResourceType getResourceType();
-
- /**
* Return the persistence unit if the context node is within a
* persistence unit. Otherwise throw an exception.
*/
@@ -47,7 +42,7 @@ public interface JpaContextNode
* Return the mapping file root if the context node is within a
* mapping file. Otherwise throw an exception.
*/
- MappingFileRoot getMappingFileRoot();
+ MappingFile.Root getMappingFileRoot();
// ********** database stuff **********
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFile.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFile.java
index 8a89fda524..295de4bc4c 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFile.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFile.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2012 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.
@@ -9,13 +9,19 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context;
+import java.util.List;
import org.eclipse.core.resources.IFolder;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.common.core.utility.TextRange;
+import org.eclipse.jpt.jpa.core.JpaStructureNode;
+import org.eclipse.jpt.jpa.core.context.orm.MappingFileDefinition;
import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef;
import org.eclipse.jpt.jpa.core.context.persistence.PersistentTypeContainer;
import org.eclipse.text.edits.DeleteEdit;
import org.eclipse.text.edits.ReplaceEdit;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
/**
* JPA mapping file (typically <code>orm.xml</code>).
@@ -30,36 +36,61 @@ import org.eclipse.text.edits.ReplaceEdit;
* @since 2.1
*/
public interface MappingFile
- extends XmlFile, PersistentTypeContainer
+ extends JpaStructureNode, PersistentTypeContainer
{
- /**
- * Covariant override.
- */
MappingFileRef getParent();
/**
* Return the mapping file's root.
* This can be <code>null</code>.
*/
- MappingFileRoot getRoot();
+ Root getRoot();
+
+ /**
+ * String constant associated with changes to the
+ * {@link #getRoot() root property}.
+ */
+ String ROOT_PROPERTY = "root"; //$NON-NLS-1$
+
+ /**
+ * Return the mapping file's definition.
+ */
+ MappingFileDefinition getDefinition();
/**
* Return whether the mapping file exists in the specified folder.
*/
boolean isIn(IFolder folder);
+ /**
+ * Return the corresponding resource mapping file. The type of the returned
+ * resource mapping file is determined by the implementation and its
+ * clients.
+ */
+ Object getResourceMappingFile();
+
+ // TODO remove when XmlContextNode.validate(...)
+ // is moved to JpaContextNode (and JavaJpaContextNode.validate(...) is gone as a result)
+ void validate(List<IMessage> messages, IReporter reporter);
+
+ // TODO remove when XmlContextNode.validate(...)
+ // is moved to JpaContextNode (and JavaJpaContextNode.validate(...) is gone as a result)
+ TextRange getValidationTextRange();
+
// ********** queries/generators **********
/**
* Return the queries defined directly in the mapping file (as opposed to
- * including the queries defined in Java annotations).
+ * including the queries defined in Java types referenced by the mapping
+ * file).
*/
Iterable<Query> getMappingFileQueries();
/**
* Return the generators defined directly in the mapping file (as opposed to
- * including the generators defined in Java annotations).
+ * including the generators defined in Java types referenced by the mapping
+ * file).
*/
Iterable<Generator> getMappingFileGenerators();
@@ -67,26 +98,73 @@ public interface MappingFile
// ********** refactoring **********
/**
- * Create DeleteEdits for deleting references (if any) to the type about to be deleted.
- * Return an EmptyIterable if there are not any references to the given type.
+ * Create delete edits for deleting any references
+ * to the specified (about to be deleted) type.
+ * Return an empty collection if there are no references to the specified type.
*/
Iterable<DeleteEdit> createDeleteTypeEdits(IType type);
/**
- * Create ReplaceEdits for renaming any references to the originalType to the newName.
- * The originalType has not yet been renamed, the newName is the new short name.
+ * Create replace edits for renaming any references to
+ * the specified original type to the specified new name.
+ * The specified original type has not yet been renamed; and the specified
+ * new name is a "simple" (unqualified) name.
*/
Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName);
/**
- * Create ReplaceEdits for moving any references to the originalType to the newPackage.
- * The originalType has not yet been moved.
+ * Create replace edits for moving any references to
+ * the specified original type to the specified new package.
+ * The specified original type has not yet been moved.
*/
Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage);
/**
- * Create ReplaceEdits for renaming any references to the originalPackage to the newName.
- * The originalPackage has not yet been renamed.
+ * Create replace edits for renaming any references to
+ * the specified original package to the specified new name.
+ * The specified original package has not yet been renamed.
*/
Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName);
+
+
+ // ********** mapping file root **********
+
+ /**
+ * Common interface for the root of a mapping file.
+ */
+ interface Root
+ extends JpaStructureNode, PersistentTypeContainer
+ {
+ /**
+ * covariant override
+ */
+ MappingFile getParent();
+
+ /**
+ * Return the specified access if present, otherwise return the default
+ * access.
+ */
+ AccessType getAccess();
+
+ /**
+ * Return the specified catalog if present, otherwise return the default
+ * catalog.
+ */
+ String getCatalog();
+
+ /**
+ * Return the specified schema if present, otherwise return the default
+ * schema.
+ */
+ String getSchema();
+
+ /**
+ * Return the metadata defined within the mapping file
+ * <em>for the persistence unit</em>.
+ * Return <code>null</code> if none exists.
+ *
+ * @see MappingFilePersistenceUnitMetadata#resourceExists()
+ */
+ MappingFilePersistenceUnitMetadata getPersistenceUnitMetadata();
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFilePersistenceUnitDefaults.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFilePersistenceUnitDefaults.java
index f32ec18b8d..310028eeb8 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFilePersistenceUnitDefaults.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFilePersistenceUnitDefaults.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2012 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.
@@ -22,7 +22,7 @@ package org.eclipse.jpt.jpa.core.context;
* @since 2.1
*/
public interface MappingFilePersistenceUnitDefaults
- extends XmlContextNode
+ extends JpaContextNode
{
/**
* Covariant override.
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFilePersistenceUnitMetadata.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFilePersistenceUnitMetadata.java
index 1313b66fbe..127483922f 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFilePersistenceUnitMetadata.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFilePersistenceUnitMetadata.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2012 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.
@@ -9,6 +9,8 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context;
+import org.eclipse.jpt.common.core.utility.TextRange;
+
/**
* Persistence unit metadata held by a mapping file.
* <p>
@@ -19,12 +21,12 @@ package org.eclipse.jpt.jpa.core.context;
* will almost certainly be broken (repeatedly) as the API evolves.
*/
public interface MappingFilePersistenceUnitMetadata
- extends XmlContextNode
+ extends JpaContextNode
{
/**
* Covariant override.
*/
- MappingFileRoot getParent();
+ MappingFile.Root getParent();
/**
* Return whether any annotations on the persistent types associated with
@@ -44,4 +46,8 @@ public interface MappingFilePersistenceUnitMetadata
* return <code>true</code>; otherwise <code>false</code>.
*/
boolean resourceExists();
+
+ // TODO remove when XmlContextNode.validate(...)
+ // is moved to JpaContextNode (and JavaJpaContextNode.validate(...) is gone as a result)
+ TextRange getValidationTextRange();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFileRoot.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFileRoot.java
deleted file mode 100644
index 6a4aa3ed59..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFileRoot.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2012 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.jpa.core.context;
-
-import org.eclipse.jpt.jpa.core.JpaXmlStructureNode;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistentTypeContainer;
-
-/**
- * The root of a JPA mapping file.
- * <p>
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- *
- * @version 2.1
- * @since 2.1
- */
-public interface MappingFileRoot
- extends XmlContextNode, JpaXmlStructureNode, PersistentTypeContainer
-{
- /**
- * covariant override
- */
- MappingFile getParent();
-
- /**
- * Return the specified access if present, otherwise return the default
- * access.
- */
- AccessType getAccess();
-
- /**
- * Return the specified catalog if present, otherwise return the default
- * catalog.
- */
- String getCatalog();
-
- /**
- * Return the specified schema if present, otherwise return the default
- * schema.
- */
- String getSchema();
-
- /**
- * Return the metadata defined within the mapping file
- * <em>for the persistence unit</em>.
- * Return <code>null</code> if none exists.
- *
- * @see MappingFilePersistenceUnitMetadata#resourceExists()
- */
- MappingFilePersistenceUnitMetadata getPersistenceUnitMetadata();
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/XmlContextNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/XmlContextNode.java
index 0291d113ed..b4901c8b09 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/XmlContextNode.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/XmlContextNode.java
@@ -27,16 +27,16 @@ import org.eclipse.wst.validation.internal.provisional.core.IReporter;
* @version 2.2
* @since 2.1
*/
+// TODO bjv rename to XmlJpaContextNode
public interface XmlContextNode
extends JpaContextNode
{
-// TODO bjv rename to XmlJpaContextNode
-
/**
* Return the content assist proposals for the specified position
* in the XML file.
*/
Iterable<String> getXmlCompletionProposals(int pos);
+
/**
* Add to the list of current validation messages
*/
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/XmlFile.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/XmlFile.java
index 5f42cc33c4..6b56be1dad 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/XmlFile.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/XmlFile.java
@@ -29,6 +29,17 @@ public interface XmlFile
extends XmlContextNode, JpaStructureNode
{
/**
+ * Return the XML file's root element.
+ * This may be <code>null</code>.
+ */
+ Root getRoot();
+
+ /**
+ * String constant associated with changes to the root property.
+ */
+ String ROOT_PROPERTY = "root"; //$NON-NLS-1$
+
+ /**
* Return the resource model object
*/
JpaXmlResource getXmlResource();
@@ -40,11 +51,23 @@ public interface XmlFile
boolean isLatestSupportedVersion();
+ // ********** XML file root element **********
+
+ /**
+ * Common interface for the root element for a JPA XML file
+ * (e.g. <code>persistence</code>, <code>entity-mappings</code>).
+ */
+ interface Root
+ extends XmlContextNode, JpaStructureNode
+ {
+ // combine interfaces
+ }
+
+
/**
* Common implementations.
*/
class XmlFile_ {
-
/**
* @see #isLatestSupportedVersion()
*/
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/EntityMappings.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/EntityMappings.java
index 50987a1c60..3689d199e7 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/EntityMappings.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/EntityMappings.java
@@ -15,9 +15,10 @@ import org.eclipse.jpt.common.core.resource.java.JavaResourceAbstractType;
import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.jpa.core.context.AccessHolder;
import org.eclipse.jpt.jpa.core.context.Generator;
-import org.eclipse.jpt.jpa.core.context.MappingFileRoot;
+import org.eclipse.jpt.jpa.core.context.MappingFile;
import org.eclipse.jpt.jpa.core.context.PersistentType;
import org.eclipse.jpt.jpa.core.context.Query;
+import org.eclipse.jpt.jpa.core.context.XmlFile;
import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.db.Catalog;
import org.eclipse.jpt.jpa.db.Schema;
@@ -41,16 +42,14 @@ import org.eclipse.text.edits.ReplaceEdit;
* @since 2.0
*/
public interface EntityMappings
- extends MappingFileRoot, PersistentType.Owner, AccessHolder
+ extends MappingFile.Root, XmlFile.Root, PersistentType.Owner, AccessHolder
{
- /**
- * Covariant override.
- */
OrmXml getParent();
+ OrmXml getOrmXml();
+
XmlEntityMappings getXmlEntityMappings();
- // TODO bjv add version constants
String getVersion();
String getDescription();
@@ -159,7 +158,8 @@ public interface EntityMappings
/**
* Return the Java resource type for the specified class name
* found in the JPA project. Prepend the default package name
- * if the class name is not fully qualified (does not contain a '.').
+ * if the class name is not fully qualified (i.e. it does not contain a
+ * <code>'.'</code>).
*
* @see #getPackage()
*/
@@ -168,9 +168,9 @@ public interface EntityMappings
/**
* Return the Java resource type for the specified class name and kind
* found in the JPA project. Prepend the default package name
- * if the class name is not fully qualified (does not contain a '.').
- *
- * Return null if invalid or absent or if the kind does not match.
+ * if the class name is not fully qualified (i.e. it does not contain a
+ * <code>'.'</code>).
+ * Return <code>null</code> if invalid or absent or if the kind does not match.
*
* @see #getPackage()
*/
@@ -179,25 +179,27 @@ public interface EntityMappings
/**
* Return the persistent type for the specified class name
* found in the persistence unit. Prepend the default package name
- * if the class name is not fully qualified (does not contain a '.').
+ * if the class name is not fully qualified (i.e. it does not contain a
+ * <code>'.'</code>).
*
* @see #getPackage()
*/
PersistentType resolvePersistentType(String className);
/**
- * Return the JDT IType resource type for the specified class name
+ * Return the JDT type for the specified class name
* found in the Java project. Prepend the default package name
- * if the class name is not fully qualified (does not contain a '.').
+ * if the class name is not fully qualified (i.e. it does not contain a
+ * <code>'.'</code>).
*
* @see #getPackage()
*/
IType resolveJdtType(String className);
/**
- * If the specified class name is not qualified (does not contain a '.')
- * then prepend the default package name. Inner classes must
- * be specified with a '$' for this to work.
+ * If the specified class name is not qualified (i.e. it does not contain a
+ * <code>'.'</code>), prepend the default package name. Inner classes must
+ * be qualified with a <code>'$'</code> for this to work correctly.
*
* @see #getPackage()
*/
@@ -207,26 +209,31 @@ public interface EntityMappings
// ********** refactoring **********
/**
- * Create DeleteEdits for deleting references (if any) to the type about to be deleted.
- * Return an EmptyIterable if there are not any references to the given type.
+ * Create delete edits for deleting any references
+ * to the specified (about to be deleted) type.
+ * Return an empty collection if there are no references to the specified type.
*/
Iterable<DeleteEdit> createDeleteTypeEdits(IType type);
/**
- * Create ReplaceEdits for renaming any references to the originalType to the newName.
- * The originalType has not yet been renamed, the newName is the new short name.
+ * Create replace edits for renaming any references to
+ * the specified original type to the specified new name.
+ * The specified original type has not yet been renamed; and the specified
+ * new name is a "simple" (unqualified) name.
*/
Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName);
/**
- * Create ReplaceEdits for moving any references to the originalType to the newPackage.
- * The originalType has not yet been moved.
+ * Create replace edits for moving any references to
+ * the specified original type to the specified new package.
+ * The specified original type has not yet been moved.
*/
Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage);
/**
- * Create ReplaceEdits for renaming any references to the originalPackage to the newName.
- * The originalPackage has not yet been renamed.
+ * Create replace edits for renaming any references to
+ * the specified original package to the specified new name.
+ * The specified original package has not yet been renamed.
*/
Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistenceUnitDefaults.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistenceUnitDefaults.java
index 947ced672e..7eaffac57c 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistenceUnitDefaults.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistenceUnitDefaults.java
@@ -11,6 +11,7 @@ package org.eclipse.jpt.jpa.core.context.orm;
import org.eclipse.jpt.jpa.core.context.AccessHolder;
import org.eclipse.jpt.jpa.core.context.MappingFilePersistenceUnitDefaults;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
import org.eclipse.jpt.jpa.db.Catalog;
import org.eclipse.jpt.jpa.db.Schema;
import org.eclipse.jpt.jpa.db.SchemaContainer;
@@ -31,7 +32,7 @@ import org.eclipse.jpt.jpa.db.SchemaContainer;
* @since 2.1
*/
public interface OrmPersistenceUnitDefaults
- extends MappingFilePersistenceUnitDefaults, AccessHolder
+ extends MappingFilePersistenceUnitDefaults, XmlContextNode, AccessHolder
{
/**
* Covariant override.
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistenceUnitMetadata.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistenceUnitMetadata.java
index ae87ffc6bf..f37267681d 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistenceUnitMetadata.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistenceUnitMetadata.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2012 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.
@@ -10,6 +10,7 @@
package org.eclipse.jpt.jpa.core.context.orm;
import org.eclipse.jpt.jpa.core.context.MappingFilePersistenceUnitMetadata;
+import org.eclipse.jpt.jpa.core.context.XmlContextNode;
import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitMetadata;
@@ -27,7 +28,7 @@ import org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitMetadata;
* will almost certainly be broken (repeatedly) as the API evolves.
*/
public interface OrmPersistenceUnitMetadata
- extends MappingFilePersistenceUnitMetadata
+ extends MappingFilePersistenceUnitMetadata, XmlContextNode
{
/**
* Covariant override.
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistentType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistentType.java
index d4bd6093fe..319144b00d 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistentType.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistentType.java
@@ -137,29 +137,32 @@ public interface OrmPersistentType
// ********** refactoring **********
/**
- * If this {@link OrmPersistentType#isFor(String)} the given IType, create a text
- * DeleteEdit for deleting the type mapping element and any text that precedes it.
- * Otherwise return an EmptyIterable.
- * Though this will contain 1 or 0 DeleteEdits, using an Iterable
- * for ease of use with other createDeleteEdit API.
+ * If this {@link #isFor(String)} the specified type,
+ * create a text delete edit for deleting the type mapping element and
+ * any text that precedes it.
+ * Otherwise return an empty collection.
*/
Iterable<DeleteEdit> createDeleteTypeEdits(IType type);
/**
- * Create ReplaceEdits for renaming any references to the originalType to the newName.
- * The originalType has not yet been renamed, the newName is the new short name.
+ * Create replace edits for renaming any references to
+ * the specified original type to the specified new name.
+ * The specified original type has not yet been renamed; and the specified
+ * new name is a "simple" (unqualified) name.
*/
Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName);
/**
- * Create ReplaceEdits for moving any references to the originalType to the newPackage.
- * The originalType has not yet been moved.
+ * Create replace edits for moving any references to
+ * the specified original type to the specified new package.
+ * The specified original type has not yet been moved.
*/
Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage);
/**
- * Create ReplaceEdits for renaming any references to the originalPackage to the newName.
- * The originalPackage has not yet been renamed.
+ * Create replace edits for renaming any references to
+ * the specified original package to the specified new name.
+ * The specified original package has not yet been renamed.
*/
Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmXml.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmXml.java
index 0b4a509790..0a48946f37 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmXml.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmXml.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 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.
@@ -10,6 +10,7 @@
package org.eclipse.jpt.jpa.core.context.orm;
import org.eclipse.jpt.jpa.core.context.MappingFile;
+import org.eclipse.jpt.jpa.core.context.XmlFile;
/**
* JPA <code>orm.xml</code> file.
@@ -24,20 +25,11 @@ import org.eclipse.jpt.jpa.core.context.MappingFile;
* @since 2.0
*/
public interface OrmXml
- extends MappingFile
+ extends MappingFile, XmlFile
{
- // ********** root **********
-
- /**
- * String constant associated with changes to the
- * <code>entity-mappings</code> property
- */
- String ROOT_PROPERTY = "root"; //$NON-NLS-1$
-
- /**
- * Covariant override.
- */
EntityMappings getRoot();
+ OrmXmlDefinition getDefinition();
+
OrmPersistentType getPersistentType(String name);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/ClassRef.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/ClassRef.java
index 76a81be189..d18140c3ed 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/ClassRef.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/ClassRef.java
@@ -17,6 +17,7 @@ import org.eclipse.jpt.jpa.core.JpaStructureNode;
import org.eclipse.jpt.jpa.core.context.PersistentType;
import org.eclipse.jpt.jpa.core.context.XmlContextNode;
import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
+import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlJavaClassRef;
import org.eclipse.text.edits.DeleteEdit;
import org.eclipse.text.edits.ReplaceEdit;
@@ -112,31 +113,32 @@ public interface ClassRef
// ********** refactoring **********
/**
- * If this {@link #isFor(String)} the given IType, create a text
- * DeleteEdit for deleting the class element and any text that precedes it.
- * Otherwise return an EmptyIterable.
- * Though this will contain 1 or 0 DeleteEdits, using an Iterable
- * for ease of use with other createDeleteEdit API.
+ * If this {@link #isFor(String)} the specified type,
+ * create a text delete edit for deleting the type mapping element and
+ * any text that precedes it.
+ * Otherwise return an empty collection.
*/
Iterable<DeleteEdit> createDeleteTypeEdits(IType type);
/**
- * Create ReplaceEdits for renaming the class element to the newName.
- * The originalType has not yet been renamed, the newName is the new short name.
- * If this ClassRef does not match the original type, then return an empty Iterable.
+ * Create replace edits for renaming any references to
+ * the specified original type to the specified new name.
+ * The specified original type has not yet been renamed; and the specified
+ * new name is a "simple" (unqualified) name.
*/
Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName);
/**
- * Create ReplaceEdits for moving any references to the originalType to the newPackage.
- * The originalType has not yet been moved.
+ * Create replace edits for moving any references to
+ * the specified original type to the specified new package.
+ * The specified original type has not yet been moved.
*/
Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage);
/**
- * Create ReplaceEdits for renaming the class's package to the newName.
- * The originalPackage has not yet been renamed.
- * If this class is not a part of the original package, then return an empty Iterable.
+ * Create replace edits for renaming any references to
+ * the specified original package to the specified new name.
+ * The specified original package has not yet been renamed.
*/
Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/MappingFileRef.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/MappingFileRef.java
index 0c25241a99..85ff008e84 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/MappingFileRef.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/MappingFileRef.java
@@ -28,10 +28,14 @@ import org.eclipse.text.edits.ReplaceEdit;
/**
* Context model corresponding to the
- * XML resource model {@link XmlMappingFileRef},
- * which corresponds to the <code>mapping-file</code> element
+ * <code>mapping-file</code> element
* in the <code>persistence.xml</code> file.
* <p>
+ * <strong>NB:</strong>
+ * While this context model corresponds to an XML resource model, the mapping
+ * file it references does <em>not</em> necessarily correspond to an XML
+ * resource model.
+ * <p>
* Provisional API: This interface is part of an interim API that is still
* under development and expected to change significantly before reaching
* stability. It is available at this early stage to solicit feedback from
@@ -67,11 +71,6 @@ public interface MappingFileRef
*/
void setFileName(String fileName);
- /**
- * Return whether the mapping file ref is a reference to the specified file.
- */
- boolean isFor(IFile file);
-
// ********** mapping file (orm.xml) **********
@@ -82,7 +81,8 @@ public interface MappingFileRef
/**
* Return mapping file corresponding to the mapping file ref's file name.
- * This can be <code>null</code> if the file name is invalid.
+ * This can be <code>null</code> if the file name is invalid or if the
+ * file's content is unsupported.
*/
MappingFile getMappingFile();
@@ -119,10 +119,11 @@ public interface MappingFileRef
XmlMappingFileRef getXmlMappingFileRef();
/**
- * Return whether the mapping file ref is "implied" by (as opposed to
- * explicitly specified in) the <code>persistence.xml</code>.
+ * Return whether the mapping file ref is a
+ * <code>persistence.xml</code> default (as opposed to
+ * explicitly specified).
*/
- boolean isImplied();
+ boolean isDefault();
/**
* Return whether the specified text offset is within
@@ -144,66 +145,68 @@ public interface MappingFileRef
// ********** refactoring **********
/**
- * Create DeleteEdits for deleting any references to the given type
- * that is about to be deleted.
- * Return an EmptyIterable if there are not any references to the given type.
+ * Create delete edits for deleting any references
+ * to the specified (about to be deleted) type.
+ * Return an empty collection if there are no references to the specified type.
*/
Iterable<DeleteEdit> createDeleteTypeEdits(IType type);
/**
- * If this {@link #isFor(IFile)} the given IFile, create a text
- * DeleteEdit for deleting the mapping file element and any text that precedes it
- * from the persistence.xml.
- * Otherwise return an EmptyIterable.
- * Though this will contain 1 or 0 DeleteEdits, using an Iterable
- * for ease of use with other createDeleteEdit API.
- */
- Iterable<DeleteEdit> createDeleteMappingFileEdits(IFile file);
-
- /**
- * Create ReplaceEdits for renaming any references to the originalType to the newName.
- * The originalType has not yet been renamed, the newName is the new short name.
+ * Create replace edits for renaming any references to
+ * the specified original type to the specified new name.
+ * The specified original type has not yet been renamed; and the specified
+ * new name is a "simple" (unqualified) name.
*/
Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName);
/**
- * Create ReplaceEdits for moving any references to the originalType to the newPackage.
- * The originalType has not yet been moved.
+ * Create replace edits for moving any references to
+ * the specified original type to the specified new package.
+ * The specified original type has not yet been moved.
*/
Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage);
/**
- * Create ReplaceEdits for renaming any references to the originalPackage to the newName.
- * The originalPackage has not yet been renamed.
+ * Create replace edits for renaming any references to
+ * the specified original package to the specified new name.
+ * The specified original package has not yet been renamed.
*/
Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName);
/**
- * Create ReplaceEdits for renaming any references to the originalFolder to the newName.
- * The originalFolder has not yet been renamed.
+ * If the ref is for the specified file, create a text
+ * delete edit for deleting the mapping file element and any text that precedes it
+ * in the <code>persistence.xml</code> file.
+ * Otherwise return an empty collection.
+ */
+ Iterable<DeleteEdit> createDeleteMappingFileEdits(IFile file);
+
+ /**
+ * Create replace edits for renaming any references to the specified
+ * original folder to the specified new name.
+ * The specified original folder has not yet been renamed.
*/
Iterable<ReplaceEdit> createRenameFolderEdits(IFolder originalFolder, String newName);
/**
- * If this {@link #isFor(IFile)} the given IFile, create a text
- * ReplaceEdit for renaming the mapping file element to the new name.
- * Otherwise return an EmptyIterable.
- * Though this will contain 1 or 0 ReplaceEdits, using an Iterable
- * for ease of use with other createReplaceMappingFileEdits API.
+ * If the ref is for the specified file, create a text
+ * replace edit for renaming the mapping file element to the new name.
+ * Otherwise return an empty collection.
*/
Iterable<ReplaceEdit> createRenameMappingFileEdits(IFile originalFile, String newName);
/**
- * If this {@link #isFor(IFile)} the given IFile create a text
- * ReplaceEdit for moving the originalFile to the destination.
- * Otherwise return an EmptyIterable.
- * The originalFile has not been moved yet.
+ * If the ref is for the specified file, create a text replace edit for
+ * moving the specified original file to the specified destination.
+ * Otherwise return an empty collection.
+ * The specified original file has not been moved yet.
*/
- Iterable<ReplaceEdit> createMoveMappingFileEdits(IFile originalFile, IPath runtineDestination);
+ Iterable<ReplaceEdit> createMoveMappingFileEdits(IFile originalFile, IPath destination);
/**
- * Create ReplaceEdits for moving any references to the originalFolder to the runtimeDestination.
- * The runtimeDestination already includes the original folder name.
+ * Create replace edits for moving any references to the specified
+ * original folder to the specified destination.
+ * The specified destination already includes the original folder name.
*/
- Iterable<ReplaceEdit> createMoveFolderEdits(IFolder originalFolder, IPath runtimeDestination);
+ Iterable<ReplaceEdit> createMoveFolderEdits(IFolder originalFolder, IPath destination);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/Persistence.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/Persistence.java
index df47dbee8c..45940485ff 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/Persistence.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/Persistence.java
@@ -10,8 +10,7 @@
package org.eclipse.jpt.jpa.core.context.persistence;
import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.jpa.core.JpaXmlStructureNode;
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.context.XmlFile;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistence;
/**
@@ -29,7 +28,7 @@ import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistence;
* @since 2.0
*/
public interface Persistence
- extends XmlContextNode, JpaXmlStructureNode
+ extends XmlFile.Root
{
/**
* Return the resource model object associated with this context model object
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceUnit.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceUnit.java
index 91ab9bcc59..af10aee4cb 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceUnit.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceUnit.java
@@ -740,7 +740,6 @@ public interface PersistenceUnit
* the class refs (both specified and implied) and jar files.
* There can be duplicate types, and any of them may be overridden by a
* mapping file persistence type.
- * @see #getMappingFilePersistentTypes()
*/
Iterable<PersistentType> getJavaPersistentTypes();
@@ -784,7 +783,16 @@ public interface PersistenceUnit
* including the ones from jar files
*/
Iterable<String> getPackageNames();
+
+ /**
+ * Return a location relative to the beginning of the persistence.xml for
+ * inserting a new mapping-file element. If there are existing mapping files,
+ * the location should be after those. If no existing mapping files then make
+ * sure the location does not violate the persistence.xml schema.
+ */
+ int findInsertLocationForMappingFileRef();
+
// ********** validation **********
/**
@@ -797,66 +805,68 @@ public interface PersistenceUnit
// ********** refactoring **********
/**
- * Create DeleteEdits for deleting any references to the deleted type.
- * Return an EmptyIterable if there are not any references.
+ * Create delete edits for deleting any references
+ * to the specified (about to be deleted) type.
+ * Return an empty collection if there are no references to the specified type.
*/
Iterable<DeleteEdit> createDeleteTypeEdits(IType type);
/**
- * Create DeleteEdits for deleting any references to the deleted file
- * Return an EmptyIterable if there are not any references.
- */
- Iterable<DeleteEdit> createDeleteMappingFileEdits(IFile file);
-
- /**
- * Create ReplaceEdits for renaming any references to the originalType to the newName.
- * The originalType has not yet been renamed, the newName is the new short name.
+ * Create replace edits for renaming any references to
+ * the specified original type to the specified new name.
+ * The specified original type has not yet been renamed; and the specified
+ * new name is a "simple" (unqualified) name.
*/
Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName);
/**
- * Create ReplaceEdits for moving any references to the originalType to the newPackage.
- * The originalType has not yet been moved.
+ * Create replace edits for moving any references to
+ * the specified original type to the specified new package.
+ * The specified original type has not yet been moved.
*/
Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage);
/**
- * Create ReplaceEdits for renaming any references to the originalPackage to the newName.
- * The originalPackage has not yet been renamed.
+ * Create replace edits for renaming any references to
+ * the specified original package to the specified new name.
+ * The specified original package has not yet been renamed.
*/
Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName);
/**
- * Create ReplaceEdits for renaming any references to the originalFolder to the newName.
- * The originalFolder has not yet been renamed.
+ * Create delete edits for deleting any references to the specified file
+ * Return an empty collection if there are no references to the specified file.
*/
- Iterable<ReplaceEdit> createRenameFolderEdits(IFolder originalFolder, String newName);
+ Iterable<DeleteEdit> createDeleteMappingFileEdits(IFile file);
/**
- * Create ReplaceEdits for renaming any references to the originalFile to the newName.
- * Return an EmptyIterable if there are not any references.
- * The originalFile has not yet been renamed, the newName is the new short name.
+ * Create replace edits for renaming any references to the specified
+ * original folder to the specified new name.
+ * The specified original folder has not yet been renamed.
*/
- Iterable<ReplaceEdit> createRenameMappingFileEdits(IFile originalFile, String newName);
+ Iterable<ReplaceEdit> createRenameFolderEdits(IFolder originalFolder, String newName);
/**
- * Create ReplaceEdits for moving any references to the originalFile to the destination.
- * Return an EmptyIterable if there are not any references.
- * The originalFile has not been moved yet.
+ * Create replace edits for renaming any references to the specifie original
+ * file to the specified new name.
+ * Return an empty collection if there are not any references.
+ * The specified original file has not yet been renamed; and the specified
+ * new name is a "simple" (unqualified) name.
*/
- Iterable<ReplaceEdit> createMoveMappingFileEdits(IFile originalFile, IPath runtineDestination);
+ Iterable<ReplaceEdit> createRenameMappingFileEdits(IFile originalFile, String newName);
/**
- * Create ReplaceEdits for moving any references to the originalFolder to the runtimeDestination.
- * The runtimeDestination already includes the original folder name.
+ * Create replace edits for moving any references to the specified
+ * original file to the specified destination.
+ * Return an empty collection if there are not any references.
+ * The specified original file has not yet been moved.
*/
- Iterable<ReplaceEdit> createMoveFolderEdits(IFolder originalFolder, IPath runtimeDestination);
+ Iterable<ReplaceEdit> createMoveMappingFileEdits(IFile originalFile, IPath destination);
/**
- * Return a location relative to the beginning of the persistence.xml for
- * inserting a new mapping-file element. If there are existing mapping files,
- * the location should be after those. If no existing mapping files then make
- * sure the location does not violate the persistence.xml schema.
+ * Create replace edits for moving any references to the specified
+ * original folder to the specified destination.
+ * The specified destination already includes the original folder name.
*/
- int findInsertLocationForMappingFileRef();
+ Iterable<ReplaceEdit> createMoveFolderEdits(IFolder originalFolder, IPath destination);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceXml.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceXml.java
index ff1c034335..4f42b98c67 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceXml.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceXml.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 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.
@@ -26,17 +26,8 @@ import org.eclipse.jpt.jpa.core.context.XmlFile;
public interface PersistenceXml
extends XmlFile
{
- // ********** persistence **********
-
/**
- * String constant associated with changes to the persistence property
+ * Covariant override.
*/
- public final static String PERSISTENCE_PROPERTY = "persistence"; //$NON-NLS-1$
-
- /**
- * Return the content represented by the root of the <code>persistence.xml</code> file.
- * This may be null.
- */
- Persistence getPersistence();
-
+ Persistence getRoot();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceXmlContextNodeFactory.java
index 1ff70d585a..06111ff624 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceXmlContextNodeFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceXmlContextNodeFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 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.
@@ -42,9 +42,9 @@ public interface PersistenceXmlContextNodeFactory
MappingFileRef buildMappingFileRef(PersistenceUnit parent, XmlMappingFileRef xmlMappingFileRef);
/**
- * Build a "implied" mapping file ref.
+ * Build a "virtual" mapping file ref.
*/
- MappingFileRef buildImpliedMappingFileRef(PersistenceUnit parent);
+ MappingFileRef buildVirtualMappingFileRef(PersistenceUnit parent);
/**
* Build a "specified" class ref.
@@ -52,7 +52,7 @@ public interface PersistenceXmlContextNodeFactory
ClassRef buildClassRef(PersistenceUnit parent, XmlJavaClassRef xmlClassRef);
/**
- * Build an "implied" class ref.
+ * Build a "virtual" class ref.
*/
ClassRef buildClassRef(PersistenceUnit parent, String className);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaFactory.java
index f062735b68..dd3a9624e0 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaFactory.java
@@ -202,8 +202,8 @@ public abstract class AbstractJpaFactory
return new GenericPersistenceXml(parent, resource);
}
- public OrmXml buildMappingFile(MappingFileRef parent, JpaXmlResource resource) {
- return new GenericOrmXml(parent, resource);
+ public OrmXml buildMappingFile(MappingFileRef parent, Object resourceMappingFile) {
+ return new GenericOrmXml(parent, (JpaXmlResource) resourceMappingFile);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaNode.java
index c5b598ed08..e0a5fb62db 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaNode.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaNode.java
@@ -37,9 +37,9 @@ import org.eclipse.jpt.jpa.core.JpaNode;
import org.eclipse.jpt.jpa.core.JpaPlatform;
import org.eclipse.jpt.jpa.core.JpaPlatformVariation;
import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.JpaContextNode;
import org.eclipse.jpt.jpa.core.jpa2.JpaFactory2_0;
+import org.eclipse.jpt.jpa.core.jpa2.JpaProject2_0;
import org.eclipse.jpt.jpa.db.Catalog;
import org.eclipse.jpt.jpa.db.Database;
@@ -128,6 +128,10 @@ public abstract class AbstractJpaNode
return this.getJpaProject().getManager();
}
+ public JpaPlatform getJpaPlatform() {
+ return this.getJpaProject().getJpaPlatform();
+ }
+
// ********** convenience methods **********
@@ -135,20 +139,12 @@ public abstract class AbstractJpaNode
return this.getJpaProject().getJavaProject();
}
- /**
- * This is <code>public</code> as a convenience because various subclasses
- * implement interfaces that require this method.
- */
- public JpaPlatform getJpaPlatform() {
- return this.getJpaProject().getJpaPlatform();
- }
-
protected JpaPlatform.Version getJpaPlatformVersion() {
return this.getJpaPlatform().getJpaVersion();
}
protected boolean isJpa2_0Compatible() {
- return JptJpaCorePlugin.nodeIsJpa2_0Compatible(this);
+ return this.getJpaPlatformVersion().isCompatibleWithJpaVersion(JpaProject2_0.FACET_VERSION_STRING);
}
/**
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaPlatformProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaPlatformProvider.java
index 2f25d8bd72..9f844344d1 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaPlatformProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaPlatformProvider.java
@@ -10,12 +10,18 @@
package org.eclipse.jpt.jpa.core.internal;
import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+import org.eclipse.jpt.common.core.ContentTypeReference;
+import org.eclipse.jpt.common.core.JptResourceType;
+import org.eclipse.jpt.common.utility.internal.Transformer;
import org.eclipse.jpt.jpa.core.JpaPlatformProvider;
import org.eclipse.jpt.jpa.core.JpaResourceModelProvider;
import org.eclipse.jpt.jpa.core.ResourceDefinition;
import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition;
import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.plugin.JptJpaCorePlugin;
/**
* All the state in the JPA platform should be "static" (i.e. unchanging once
@@ -24,6 +30,8 @@ import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition;
public abstract class AbstractJpaPlatformProvider
implements JpaPlatformProvider
{
+ protected ArrayList<JptResourceType> mostRecentSupportedResourceTypes;
+
protected ArrayList<JpaResourceModelProvider> resourceModelProviders;
protected ArrayList<JavaTypeMappingDefinition> javaTypeMappingDefinitions;
@@ -43,9 +51,33 @@ public abstract class AbstractJpaPlatformProvider
}
+ // ********** most recent supported resource types **********
+
+ public synchronized ArrayList<JptResourceType> getMostRecentSupportedResourceTypes() {
+ if (this.mostRecentSupportedResourceTypes == null) {
+ this.mostRecentSupportedResourceTypes = this.buildMostRecentSupportedResourceTypes();
+ }
+ return this.mostRecentSupportedResourceTypes;
+ }
+
+ protected ArrayList<JptResourceType> buildMostRecentSupportedResourceTypes() {
+ ArrayList<JptResourceType> types = new ArrayList<JptResourceType>();
+ this.addMostRecentSupportedResourceTypesTo(types);
+ this.validateMostRecentSupportedResourceTypes(types);
+ return types;
+ }
+
+ protected abstract void addMostRecentSupportedResourceTypesTo(ArrayList<JptResourceType> types);
+
+ protected void validateMostRecentSupportedResourceTypes(ArrayList<JptResourceType> resourceTypes) {
+ String message = "Duplicate resource types listed as most recent for content type ''{0}'': {1}"; //$NON-NLS-1$
+ this.validate(resourceTypes, ContentTypeReference.CONTENT_TYPE_TRANSFORMER, message);
+ }
+
+
// ********** resource models **********
- public synchronized Iterable<JpaResourceModelProvider> getResourceModelProviders() {
+ public final synchronized Iterable<JpaResourceModelProvider> getResourceModelProviders() {
if (this.resourceModelProviders == null) {
this.resourceModelProviders = this.buildResourceModelProviders();
}
@@ -55,15 +87,21 @@ public abstract class AbstractJpaPlatformProvider
protected ArrayList<JpaResourceModelProvider> buildResourceModelProviders() {
ArrayList<JpaResourceModelProvider> providers = new ArrayList<JpaResourceModelProvider>();
this.addResourceModelProvidersTo(providers);
+ this.validateResourceModelProviders(providers);
return providers;
}
protected abstract void addResourceModelProvidersTo(ArrayList<JpaResourceModelProvider> providers);
+ protected void validateResourceModelProviders(ArrayList<JpaResourceModelProvider> providers) {
+ String message = "Duplicate resource model providers listed for content type ''{0}'': {1}"; //$NON-NLS-1$
+ this.validate(providers, ContentTypeReference.CONTENT_TYPE_TRANSFORMER, message);
+ }
+
// ********** Java type mappings **********
- public synchronized Iterable<JavaTypeMappingDefinition> getJavaTypeMappingDefinitions() {
+ public final synchronized Iterable<JavaTypeMappingDefinition> getJavaTypeMappingDefinitions() {
if (this.javaTypeMappingDefinitions == null) {
this.javaTypeMappingDefinitions = this.buildJavaTypeMappingDefinitions();
}
@@ -87,7 +125,7 @@ public abstract class AbstractJpaPlatformProvider
// ********** Java attribute mappings **********
- public synchronized Iterable<DefaultJavaAttributeMappingDefinition> getDefaultJavaAttributeMappingDefinitions() {
+ public final synchronized Iterable<DefaultJavaAttributeMappingDefinition> getDefaultJavaAttributeMappingDefinitions() {
if (this.defaultJavaAttributeMappingDefinitions == null) {
this.defaultJavaAttributeMappingDefinitions = this.buildDefaultJavaAttributeMappingDefinitions();
}
@@ -108,7 +146,7 @@ public abstract class AbstractJpaPlatformProvider
*/
protected abstract void addDefaultJavaAttributeMappingDefinitionsTo(ArrayList<DefaultJavaAttributeMappingDefinition> definitions);
- public synchronized Iterable<JavaAttributeMappingDefinition> getSpecifiedJavaAttributeMappingDefinitions() {
+ public final synchronized Iterable<JavaAttributeMappingDefinition> getSpecifiedJavaAttributeMappingDefinitions() {
if (this.specifiedJavaAttributeMappingDefinitions == null) {
this.specifiedJavaAttributeMappingDefinitions = this.buildSpecifiedJavaAttributeMappingDefinitions();
}
@@ -132,7 +170,7 @@ public abstract class AbstractJpaPlatformProvider
// ********** resource definitions **********
- public synchronized Iterable<ResourceDefinition> getResourceDefinitions() {
+ public final synchronized Iterable<ResourceDefinition> getResourceDefinitions() {
if (this.resourceDefinitions == null) {
this.resourceDefinitions = this.buildResourceDefinitions();
}
@@ -142,11 +180,39 @@ public abstract class AbstractJpaPlatformProvider
protected ArrayList<ResourceDefinition> buildResourceDefinitions() {
ArrayList<ResourceDefinition> definitions = new ArrayList<ResourceDefinition>();
this.addResourceDefinitionsTo(definitions);
+ this.validateResourceDefinitions(definitions);
return definitions;
}
protected abstract void addResourceDefinitionsTo(ArrayList<ResourceDefinition> definitions);
+ protected void validateResourceDefinitions(ArrayList<ResourceDefinition> definitions) {
+ String message = "Duplicate resource definitions listed for resource type ''{0}'': {1}"; //$NON-NLS-1$
+ this.validate(definitions, ResourceDefinition.RESOURCE_TYPE_TRANSFORMER, message);
+ }
+
+
+ // ********** misc **********
+
+ protected <K, V> void validate(ArrayList<? extends V> values, Transformer<V, K> keyTransformer, String message) {
+ HashMap<K, ArrayList<V>> map = new HashMap<K, ArrayList<V>>(values.size());
+ for (V element : values) {
+ K key = keyTransformer.transform(element);
+ ArrayList<V> dupes = map.get(key);
+ if (dupes == null) {
+ dupes = new ArrayList<V>();
+ map.put(key, dupes);
+ }
+ dupes.add(element);
+ }
+ for (Map.Entry<K, ArrayList<V>> entry : map.entrySet()) {
+ ArrayList<V> dupes = entry.getValue();
+ if (dupes.size() > 1) {
+ JptJpaCorePlugin.instance().logError(message, entry.getKey(), dupes);
+ }
+ }
+ }
+
@Override
public String toString() {
return this.getClass().getSimpleName();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaProject.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaProject.java
index 4af6c548c5..81c072d78b 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaProject.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaProject.java
@@ -43,7 +43,6 @@ import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
import org.eclipse.jpt.common.core.JptResourceModel;
import org.eclipse.jpt.common.core.JptResourceModelListener;
import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryTypeCache;
@@ -74,18 +73,21 @@ import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
import org.eclipse.jpt.common.utility.internal.iterables.SnapshotCloneIterable;
import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
import org.eclipse.jpt.jpa.core.JpaDataSource;
-import org.eclipse.jpt.jpa.core.JpaFacet;
import org.eclipse.jpt.jpa.core.JpaFile;
import org.eclipse.jpt.jpa.core.JpaPlatform;
+import org.eclipse.jpt.jpa.core.JpaPreferences;
import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.JpaRootContextNode;
import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.plugin.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
import org.eclipse.jpt.jpa.core.jpa2.JpaProject2_0;
import org.eclipse.jpt.jpa.core.jpa2.context.JpaRootContextNode2_0;
import org.eclipse.jpt.jpa.core.libprov.JpaLibraryProviderInstallOperationConfig;
+import org.eclipse.jpt.jpa.core.resource.ResourceMappingFile;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
+import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistence;
import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
import org.eclipse.jpt.jpa.db.Catalog;
import org.eclipse.jpt.jpa.db.ConnectionProfile;
@@ -487,8 +489,9 @@ public abstract class AbstractJpaProject
public void setUserOverrideDefaultCatalog(String catalog) {
String old = this.userOverrideDefaultCatalog;
this.userOverrideDefaultCatalog = catalog;
- JptJpaCorePlugin.setUserOverrideDefaultCatalog(this.project, catalog);
- this.firePropertyChanged(USER_OVERRIDE_DEFAULT_CATALOG_PROPERTY, old, catalog);
+ if (this.firePropertyChanged(USER_OVERRIDE_DEFAULT_CATALOG_PROPERTY, old, catalog)) {
+ JpaPreferences.setUserOverrideDefaultCatalog(this.project, catalog);
+ }
}
@@ -501,8 +504,9 @@ public abstract class AbstractJpaProject
public void setUserOverrideDefaultSchema(String schema) {
String old = this.userOverrideDefaultSchema;
this.userOverrideDefaultSchema = schema;
- JptJpaCorePlugin.setUserOverrideDefaultSchema(this.project, schema);
- this.firePropertyChanged(USER_OVERRIDE_DEFAULT_SCHEMA_PROPERTY, old, schema);
+ if (this.firePropertyChanged(USER_OVERRIDE_DEFAULT_SCHEMA_PROPERTY, old, schema)) {
+ JpaPreferences.setUserOverrideDefaultSchema(this.project, schema);
+ }
}
@@ -515,7 +519,7 @@ public abstract class AbstractJpaProject
public void setDiscoversAnnotatedClasses(boolean discoversAnnotatedClasses) {
boolean old = this.discoversAnnotatedClasses;
this.discoversAnnotatedClasses = discoversAnnotatedClasses;
- JptJpaCorePlugin.setDiscoverAnnotatedClasses(this.project, discoversAnnotatedClasses);
+ JpaPreferences.setDiscoverAnnotatedClasses(this.project, discoversAnnotatedClasses);
this.firePropertyChanged(DISCOVERS_ANNOTATED_CLASSES_PROPERTY, old, discoversAnnotatedClasses);
}
@@ -593,8 +597,8 @@ public abstract class AbstractJpaProject
* pre-condition: content type is not <code>null</code>
*/
protected boolean contentTypeIsJavaRelated(IContentType contentType) {
- return contentType.isKindOf(JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE) ||
- contentType.isKindOf(JptCommonCorePlugin.JAR_CONTENT_TYPE);
+ return contentType.isKindOf(JavaResourceCompilationUnit.CONTENT_TYPE) ||
+ contentType.isKindOf(JavaResourcePackageFragmentRoot.JAR_CONTENT_TYPE);
}
protected boolean fileResourceLocationIsValid(IFile file) {
@@ -613,7 +617,7 @@ public abstract class AbstractJpaProject
try {
return this.getJpaPlatform().buildJpaFile(this, file);
} catch (Exception ex) {
- JptJpaCorePlugin.log("Error building JPA file: " + file.getFullPath(), ex); //$NON-NLS-1$
+ JptJpaCorePlugin.instance().logError(ex, "Error building JPA file: " + file.getFullPath()); //$NON-NLS-1$
return null;
}
}
@@ -767,17 +771,17 @@ public abstract class AbstractJpaProject
public JpaXmlResource getPersistenceXmlResource() {
return (JpaXmlResource) this.getResourceModel(
- JptJpaCorePlugin.DEFAULT_PERSISTENCE_XML_RUNTIME_PATH,
- JptJpaCorePlugin.PERSISTENCE_XML_CONTENT_TYPE
+ XmlPersistence.DEFAULT_RUNTIME_PATH,
+ XmlPersistence.CONTENT_TYPE
);
}
public JpaXmlResource getDefaultOrmXmlResource() {
- return this.getMappingFileXmlResource(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH);
+ return this.getMappingFileXmlResource(XmlEntityMappings.DEFAULT_RUNTIME_PATH);
}
public JpaXmlResource getMappingFileXmlResource(IPath runtimePath) {
- return (JpaXmlResource) this.getResourceModel(runtimePath, JptJpaCorePlugin.MAPPING_FILE_CONTENT_TYPE);
+ return (JpaXmlResource) this.getResourceModel(runtimePath, ResourceMappingFile.Root.CONTENT_TYPE);
}
/**
@@ -906,7 +910,7 @@ public abstract class AbstractJpaProject
* Return the JPA project's JPA files with Java source <em>content</em>.
*/
protected Iterable<JpaFile> getJavaSourceJpaFiles() {
- return this.getJpaFiles(JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE);
+ return this.getJpaFiles(JavaResourceCompilationUnit.CONTENT_TYPE);
}
@@ -994,7 +998,7 @@ public abstract class AbstractJpaProject
* return JPA files with package-info source "content"
*/
protected Iterable<JpaFile> getPackageInfoSourceJpaFiles() {
- return this.getJpaFiles(JptCommonCorePlugin.JAVA_SOURCE_PACKAGE_INFO_CONTENT_TYPE);
+ return this.getJpaFiles(JavaResourceCompilationUnit.PACKAGE_INFO_CONTENT_TYPE);
}
@@ -1028,7 +1032,7 @@ public abstract class AbstractJpaProject
* return JPA files with JAR "content"
*/
public Iterable<JpaFile> getJarJpaFiles() {
- return this.getJpaFiles(JptCommonCorePlugin.JAR_CONTENT_TYPE);
+ return this.getJpaFiles(JavaResourcePackageFragmentRoot.JAR_CONTENT_TYPE);
}
@@ -1060,7 +1064,7 @@ public abstract class AbstractJpaProject
}
protected JavaResourceCompilationUnit getJavaResourceCompilationUnit(IFile file) {
- return (JavaResourceCompilationUnit) this.getResourceModel(file, JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE);
+ return (JavaResourceCompilationUnit) this.getResourceModel(file, JavaResourceCompilationUnit.CONTENT_TYPE);
}
public String getMetamodelSourceFolderName() {
@@ -1069,7 +1073,7 @@ public abstract class AbstractJpaProject
public void setMetamodelSourceFolderName(String folderName) {
if (this.setMetamodelSourceFolderName_(folderName)) {
- JptJpaCorePlugin.setMetamodelSourceFolderName(this.project, folderName);
+ JpaPreferences.setMetamodelSourceFolderName(this.project, folderName);
if (folderName == null) {
this.disposeMetamodel();
} else {
@@ -1198,7 +1202,7 @@ public abstract class AbstractJpaProject
try {
return this.getJavaSourceFolderNames_();
} catch (JavaModelException ex) {
- JptJpaCorePlugin.log(ex);
+ JptJpaCorePlugin.instance().logError(ex);
return EmptyIterable.instance();
}
}
@@ -1495,7 +1499,7 @@ public abstract class AbstractJpaProject
try {
this.validateLibraryProvider_(messages);
} catch (CoreException ex) {
- JptJpaCorePlugin.log(ex);
+ JptJpaCorePlugin.instance().logError(ex);
}
}
@@ -1504,9 +1508,9 @@ public abstract class AbstractJpaProject
enablementVariables.put(JpaLibraryProviderInstallOperationConfig.JPA_PLATFORM_ENABLEMENT_EXP, this.getJpaPlatform().getId());
enablementVariables.put(JpaLibraryProviderInstallOperationConfig.JPA_PLATFORM_DESCRIPTION_ENABLEMENT_EXP, this.getJpaPlatform().getDescription());
- ILibraryProvider libraryProvider = LibraryProviderFramework.getCurrentProvider(this.project, JpaFacet.FACET);
+ ILibraryProvider libraryProvider = LibraryProviderFramework.getCurrentProvider(this.project, JpaProject.FACET);
IFacetedProject facetedProject = ProjectFacetsManager.create(this.project);
- IProjectFacetVersion facetVersion = facetedProject.getInstalledVersion(JpaFacet.FACET);
+ IProjectFacetVersion facetVersion = facetedProject.getInstalledVersion(JpaProject.FACET);
if ( ! libraryProvider.isEnabledFor(facetedProject, facetVersion, enablementVariables)) {
messages.add(
DefaultJpaValidationMessages.buildMessage(
@@ -1561,6 +1565,8 @@ public abstract class AbstractJpaProject
this.stopCommand(this.synchronizeContextModelCommand);
this.stopCommand(this.updateCommand);
this.updateCommand.removeListener(this.updateCommandListener);
+ this.setUserOverrideDefaultCatalog(null);
+ this.setUserOverrideDefaultSchema(null);
this.dataSource.dispose();
// the XML resources are held indefinitely by the WTP translator framework,
// so we better remove our listener or the JPA project will not be GCed
@@ -1784,10 +1790,10 @@ public abstract class AbstractJpaProject
if (contentType == null) {
return false;
}
- if (contentType.equals(JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE)) {
+ if (contentType.equals(JavaResourceCompilationUnit.CONTENT_TYPE)) {
return true;
}
- if (contentType.equals(JptCommonCorePlugin.JAR_CONTENT_TYPE)) {
+ if (contentType.equals(JavaResourcePackageFragmentRoot.JAR_CONTENT_TYPE)) {
return true;
}
return false;
@@ -1798,10 +1804,10 @@ public abstract class AbstractJpaProject
if (contentType == null) {
return false;
}
- if (contentType.equals(JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE)) {
+ if (contentType.equals(JavaResourceCompilationUnit.CONTENT_TYPE)) {
return this.removeExternalJavaResourceCompilationUnit(file);
}
- if (contentType.equals(JptCommonCorePlugin.JAR_CONTENT_TYPE)) {
+ if (contentType.equals(JavaResourcePackageFragmentRoot.JAR_CONTENT_TYPE)) {
return this.externalJavaResourceTypeCache.removeTypes(file);
}
return false;
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/FileAdapterFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/FileAdapterFactory.java
index 30c17dd44e..4e7f0fe96b 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/FileAdapterFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/FileAdapterFactory.java
@@ -32,7 +32,7 @@ import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
* for the JPA XML resource every time it executes and its results are only
* temporary (e.g. UI menus).
* </ul>
- * See <code>org.eclipse.jpt.jpa.core/plugin.xml</code>.
+ * See <code>org.eclipse.jpt.jpa.core/plugin.xml:org.eclipse.core.runtime.adapters</code>.
*
* @see ProjectAdapterFactory
*/
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatform.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatform.java
index 0b86db2af9..41a29d63e6 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatform.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatform.java
@@ -10,17 +10,16 @@
package org.eclipse.jpt.jpa.core.internal;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jpt.common.core.AnnotationProvider;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
import org.eclipse.jpt.common.core.JptResourceModel;
import org.eclipse.jpt.common.core.JptResourceType;
import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
import org.eclipse.jpt.common.core.internal.utility.jdt.DefaultAnnotationEditFormatter;
import org.eclipse.jpt.common.core.resource.java.JavaResourceCompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
import org.eclipse.jpt.common.core.utility.jdt.AnnotationEditFormatter;
import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.jpa.core.EntityGeneratorDatabaseAnnotationNameBuilder;
@@ -31,14 +30,14 @@ import org.eclipse.jpt.jpa.core.JpaPlatformProvider;
import org.eclipse.jpt.jpa.core.JpaPlatformVariation;
import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.JpaResourceModelProvider;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.JpaWorkspace;
import org.eclipse.jpt.jpa.core.ResourceDefinition;
import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition;
import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition;
import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
+import org.eclipse.jpt.jpa.core.platform.JpaPlatformManager;
import org.eclipse.jpt.jpa.db.ConnectionProfileFactory;
-import org.eclipse.jpt.jpa.db.JptJpaDbPlugin;
import org.eclipse.persistence.jpa.jpql.parser.JPQLGrammar;
/**
@@ -82,7 +81,15 @@ public class GenericJpaPlatform
}
public JpaPlatformDescription getDescription() {
- return JptJpaCorePlugin.getJpaPlatformManager().getJpaPlatform(this.getId());
+ return this.getJpaPlatformManager().getJpaPlatformDescription(this.getId());
+ }
+
+ private JpaPlatformManager getJpaPlatformManager() {
+ return this.getJpaWorkspace().getJpaPlatformManager();
+ }
+
+ private JpaWorkspace getJpaWorkspace() {
+ return (JpaWorkspace) ResourcesPlugin.getWorkspace().getAdapter(JpaWorkspace.class);
}
public Version getJpaVersion() {
@@ -128,7 +135,7 @@ public class GenericJpaPlatform
public static IContentType getContentType(IFile file) {
IContentType contentType = Platform.getContentTypeManager().findContentTypeFor(file.getName());
if (contentType != null) {
- if (contentType.equals(JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE)) {
+ if (contentType.equals(JavaResourceCompilationUnit.CONTENT_TYPE)) {
return contentType;
}
if (contentType.equals(JAVA_CLASS_CONTENT_TYPE)) {
@@ -155,7 +162,7 @@ public class GenericJpaPlatform
}
/**
- * Return null if we don't have a provider for the specified content type
+ * Return <code>null</code> if we don't have a provider for the specified content type
* (since we don't have control over the possible content types).
*/
protected JpaResourceModelProvider getResourceModelProvider(IContentType contentType) {
@@ -200,36 +207,40 @@ public class GenericJpaPlatform
// ********** resource types and definitions **********
public boolean supportsResourceType(JptResourceType resourceType) {
- if (JptCommonCorePlugin.JAVA_SOURCE_RESOURCE_TYPE.equals(resourceType)) {
- // every platform supports java
- return true;
- }
- for (ResourceDefinition resourceDefinition : this.platformProvider.getResourceDefinitions()) {
- if (resourceDefinition.getResourceType().equals(resourceType)) {
- return true;
- }
- }
- return false;
+ return this.getResourceDefinition_(resourceType) != null;
}
public ResourceDefinition getResourceDefinition(JptResourceType resourceType) {
+ ResourceDefinition definition = this.getResourceDefinition_(resourceType);
+ if (definition == null) {
+ throw new IllegalArgumentException("Illegal resource type: " + resourceType); //$NON-NLS-1$
+ }
+ return definition;
+ }
+
+ protected ResourceDefinition getResourceDefinition_(JptResourceType resourceType) {
for (ResourceDefinition resourceDefinition : this.platformProvider.getResourceDefinitions()) {
if (resourceDefinition.getResourceType().equals(resourceType)) {
return resourceDefinition;
}
}
- throw new IllegalArgumentException("Illegal resource type: " + resourceType); //$NON-NLS-1$
+ return null;
}
public JptResourceType getMostRecentSupportedResourceType(IContentType contentType) {
- return this.platformProvider.getMostRecentSupportedResourceType(contentType);
+ for (JptResourceType resourceType : this.platformProvider.getMostRecentSupportedResourceTypes()) {
+ if (resourceType.getContentType().equals(contentType)) {
+ return resourceType;
+ }
+ }
+ throw new IllegalArgumentException(contentType.toString());
}
// ********** database **********
public ConnectionProfileFactory getConnectionProfileFactory() {
- return JptJpaDbPlugin.getConnectionProfileFactory();
+ return (ConnectionProfileFactory) ResourcesPlugin.getWorkspace().getAdapter(ConnectionProfileFactory.class);
}
public EntityGeneratorDatabaseAnnotationNameBuilder getEntityGeneratorDatabaseAnnotationNameBuilder() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatformFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatformFactory.java
index 11cc11c2b2..cc6a9d0279 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatformFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatformFactory.java
@@ -10,10 +10,11 @@
package org.eclipse.jpt.jpa.core.internal;
import org.eclipse.jpt.common.core.JptResourceType;
-import org.eclipse.jpt.jpa.core.JpaFacet;
+import org.eclipse.jpt.common.utility.internal.VersionComparator;
import org.eclipse.jpt.jpa.core.JpaPlatform;
import org.eclipse.jpt.jpa.core.JpaPlatformFactory;
import org.eclipse.jpt.jpa.core.JpaPlatformVariation;
+import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.context.AccessType;
import org.eclipse.jpt.jpa.core.internal.jpa1.GenericJpaFactory;
import org.eclipse.persistence.jpa.jpql.parser.JPQLGrammar1_0;
@@ -26,6 +27,16 @@ public class GenericJpaPlatformFactory
implements JpaPlatformFactory
{
/**
+ * See <code>org.eclipse.jpt.jpa.core/plugin.xml:org.eclipse.jpt.jpa.core.jpaPlatforms</code>.
+ */
+ public static final String ID = "generic"; //$NON-NLS-1$
+
+ /**
+ * See <code>org.eclipse.jpt.jpa.core/plugin.xml:org.eclipse.jpt.jpa.core.jpaPlatforms</code>.
+ */
+ public static final String GROUP_ID = "generic"; //$NON-NLS-1$
+
+ /**
* zero-argument constructor
*/
public GenericJpaPlatformFactory() {
@@ -44,7 +55,7 @@ public class GenericJpaPlatformFactory
}
private JpaPlatform.Version buildJpaVersion() {
- return new SimpleVersion(JpaFacet.VERSION_1_0.getVersionString());
+ return new GenericJpaPlatformVersion(JpaProject.FACET_VERSION_STRING);
}
protected JpaPlatformVariation buildJpaPlatformVariation() {
@@ -61,16 +72,21 @@ public class GenericJpaPlatformFactory
};
}
- public static class SimpleVersion implements JpaPlatform.Version {
+ /**
+ * Generic JPA platform version
+ */
+ public static class GenericJpaPlatformVersion
+ implements JpaPlatform.Version
+ {
protected final String jpaVersion;
- public SimpleVersion(String jpaVersion) {
+ public GenericJpaPlatformVersion(String jpaVersion) {
super();
this.jpaVersion = jpaVersion;
}
/**
- * The generic platform's version is the same as the JPA version.
+ * The generic JPA platform's version is the same as the JPA version.
*/
public String getVersion() {
return this.getJpaVersion();
@@ -84,12 +100,12 @@ public class GenericJpaPlatformFactory
* For now, generic platforms are backward-compatible.
*/
public boolean isCompatibleWithJpaVersion(String version) {
- return VERSION_COMPARATOR.compare(this.jpaVersion, version) >= 0;
+ return VersionComparator.INTEGER_VERSION_COMPARATOR.compare(this.jpaVersion, version) >= 0;
}
@Override
public String toString() {
- return "JPA version: " + this.getJpaVersion(); //$NON-NLS-1$
+ return "JPA " + this.jpaVersion; //$NON-NLS-1$
}
}
} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatformProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatformProvider.java
index e2409e017e..65e8f58e04 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatformProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatformProvider.java
@@ -10,17 +10,15 @@
package org.eclipse.jpt.jpa.core.internal;
import java.util.ArrayList;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
import org.eclipse.jpt.common.core.JptResourceType;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.jpa.core.JpaPlatformProvider;
import org.eclipse.jpt.jpa.core.JpaResourceModelProvider;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.ResourceDefinition;
import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition;
import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.java.JarDefinition;
import org.eclipse.jpt.jpa.core.internal.context.java.JavaBasicMappingDefinition;
import org.eclipse.jpt.jpa.core.internal.context.java.JavaEmbeddableDefinition;
import org.eclipse.jpt.jpa.core.internal.context.java.JavaEmbeddedIdMappingDefinition;
@@ -32,6 +30,7 @@ import org.eclipse.jpt.jpa.core.internal.context.java.JavaManyToOneMappingDefini
import org.eclipse.jpt.jpa.core.internal.context.java.JavaMappedSuperclassDefinition;
import org.eclipse.jpt.jpa.core.internal.context.java.JavaOneToManyMappingDefinition;
import org.eclipse.jpt.jpa.core.internal.context.java.JavaOneToOneMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.java.JavaSourceFileDefinition;
import org.eclipse.jpt.jpa.core.internal.context.java.JavaTransientMappingDefinition;
import org.eclipse.jpt.jpa.core.internal.context.java.JavaVersionMappingDefinition;
import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmXmlDefinition;
@@ -54,7 +53,6 @@ public class GenericJpaPlatformProvider
return INSTANCE;
}
-
/**
* Enforce singleton usage
*/
@@ -65,24 +63,19 @@ public class GenericJpaPlatformProvider
// ********** resource models **********
- public JptResourceType getMostRecentSupportedResourceType(IContentType contentType) {
- if (contentType.equals(JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE)) {
- return JptCommonCorePlugin.JAVA_SOURCE_RESOURCE_TYPE;
- }
- else if (contentType.equals(JptCommonCorePlugin.JAR_CONTENT_TYPE)) {
- return JptCommonCorePlugin.JAR_RESOURCE_TYPE;
- }
- else if (contentType.equals(JptJpaCorePlugin.PERSISTENCE_XML_CONTENT_TYPE)) {
- return JptJpaCorePlugin.PERSISTENCE_XML_1_0_RESOURCE_TYPE;
- }
- else if (contentType.equals(JptJpaCorePlugin.ORM_XML_CONTENT_TYPE)) {
- return JptJpaCorePlugin.ORM_XML_1_0_RESOURCE_TYPE;
- }
- else {
- throw new IllegalArgumentException(contentType.toString());
- }
+ @Override
+ protected void addMostRecentSupportedResourceTypesTo(ArrayList<JptResourceType> types) {
+ CollectionTools.addAll(types, MOST_RECENT_SUPPORTED_RESOURCE_TYPES);
}
+ // order should not be important here
+ protected static final JptResourceType[] MOST_RECENT_SUPPORTED_RESOURCE_TYPES = new JptResourceType[] {
+ JavaSourceFileDefinition.instance().getResourceType(),
+ JarDefinition.instance().getResourceType(),
+ GenericPersistenceXmlDefinition.instance().getResourceType(),
+ GenericOrmXmlDefinition.instance().getResourceType()
+ };
+
@Override
protected void addResourceModelProvidersTo(ArrayList<JpaResourceModelProvider> providers) {
CollectionTools.addAll(providers, RESOURCE_MODEL_PROVIDERS);
@@ -153,10 +146,15 @@ public class GenericJpaPlatformProvider
}
protected static final ResourceDefinition[] RESOURCE_DEFINITIONS = new ResourceDefinition[] {
+ JavaSourceFileDefinition.instance(),
+ JarDefinition.instance(),
GenericPersistenceXmlDefinition.instance(),
GenericOrmXmlDefinition.instance()
};
+
+ // ********** misc **********
+
@Override
public String toString() {
return this.getClass().getSimpleName();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/InternalJpaProjectManager.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/InternalJpaProjectManager.java
index 56476f9b75..ae5bc11d6e 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/InternalJpaProjectManager.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/InternalJpaProjectManager.java
@@ -23,6 +23,7 @@ import org.eclipse.core.resources.IResourceProxyVisitor;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
@@ -35,6 +36,7 @@ import org.eclipse.jdt.core.ElementChangedEvent;
import org.eclipse.jdt.core.IElementChangedListener;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jpt.common.core.internal.JptCommonCoreMessages;
+import org.eclipse.jpt.common.core.internal.utility.ProjectTools;
import org.eclipse.jpt.common.core.internal.utility.command.CommandJobCommandAdapter;
import org.eclipse.jpt.common.core.internal.utility.command.SimpleJobCommandExecutor;
import org.eclipse.jpt.common.core.internal.utility.command.SingleUseQueueingExtendedJobCommandExecutor;
@@ -51,15 +53,19 @@ import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable;
import org.eclipse.jpt.common.utility.internal.iterables.SnapshotCloneIterable;
import org.eclipse.jpt.common.utility.internal.model.AbstractModel;
-import org.eclipse.jpt.jpa.core.JpaFacet;
import org.eclipse.jpt.jpa.core.JpaPlatform;
+import org.eclipse.jpt.jpa.core.JpaPreferences;
import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.JpaProjectManager;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.JpaWorkspace;
+import org.eclipse.jpt.jpa.core.internal.plugin.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.osgi.util.NLS;
+import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
+import org.eclipse.jpt.jpa.core.platform.JpaPlatformManager;
import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -91,12 +97,12 @@ import org.eclipse.wst.validation.internal.provisional.core.IReporter;
* {@link #start() start} a JPA project manager as appropriate.
* This will trigger the manager to find and add all pre-existing
* JPA projects.
- *
+ *
* <li>Project created and facet installed<p>
* {@link IResourceChangeEvent#POST_CHANGE}
* <li>Project facet uninstalled<p>
* {@link IResourceChangeEvent#POST_CHANGE}
- *
+ *
* <li>Project opened<p>
* {@link IResourceChangeEvent#POST_CHANGE}<p>
* -> {@link IResource#FILE}<p>
@@ -108,7 +114,7 @@ import org.eclipse.wst.validation.internal.provisional.core.IReporter;
* -> {@link IResource#FILE}<p>
* -> {@link IResourceDelta#REMOVED}
* <p>facet settings file
- *
+ *
* <li>Pre-existing project imported from directory or archive (created and opened)<p>
* {@link IResourceChangeEvent#POST_CHANGE}<p>
* -> {@link IResource#FILE}<p>
@@ -126,7 +132,7 @@ import org.eclipse.wst.validation.internal.provisional.core.IReporter;
* -> {@link IResource#FILE}<p>
* -> {@link IResourceDelta#REMOVED}<p>
* facet settings file
- *
+ *
* <li>Project facet installed by editing the facets settings file directly<p>
* {@link IResourceChangeEvent#POST_CHANGE}<p>
* -> {@link IResource#FILE}<p>
@@ -144,9 +150,9 @@ public class InternalJpaProjectManager
implements JpaProjectManager, JpaProject.Manager
{
/**
- * The workspace the JPA project manager corresponds to.
+ * The JPA workspace the JPA project manager corresponds to.
*/
- private final IWorkspace workspace;
+ private final JpaWorkspace jpaWorkspace;
/**
* Determine how commands (Resource and Java change events etc.) are
@@ -236,31 +242,16 @@ public class InternalJpaProjectManager
*/
private final ThreadLocalExtendedCommandExecutor modifySharedDocumentCommandExecutor = new ThreadLocalExtendedCommandExecutor();
- /**
- * Log any exceptions appropriately.
- */
- private final ExceptionHandler exceptionHandler;
-
- /**
- * See org.eclipse.jpt.jpa.core.tests.JptJpaCoreTestsPlugin#start(org.osgi.framework.BundleContext).
- */
- /* CU private */ volatile boolean test = false;
-
// ********** constructor **********
/**
* Internal: Called <em>only</em> by the
- * {@link JptJpaCorePlugin#getJpaProjectManager_(IWorkspace) Dali plug-in}.
+ * {@link InternalJpaWorkspace#buildJpaProjectManager() JPA workspace}.
*/
- public InternalJpaProjectManager(IWorkspace workspace) {
+ public InternalJpaProjectManager(JpaWorkspace jpaWorkspace) {
super();
- this.workspace = workspace;
- this.exceptionHandler = this.buildExceptionHandler();
- }
-
- private ExceptionHandler buildExceptionHandler() {
- return new LocalExceptionHandler();
+ this.jpaWorkspace = jpaWorkspace;
}
@@ -268,39 +259,39 @@ public class InternalJpaProjectManager
/**
* Internal: Called <em>only</em> by the
- * {@link JptJpaCorePlugin#getJpaProjectManager_(IWorkspace) Dali plug-in}.
+ * {@link InternalJpaWorkspace#getJpaProjectManager() JPA workspace}.
* The JPA project manager will not be returned to any clients by the
- * {@link JptJpaCorePlugin Dali plug-in} until <em>after</em>
+ * {@link JpaWorkspace JPA workspace} until <em>after</em>
* the manager has been started (i.e. this method has been called).
* As a result, we need not synchronize with the scheduling rule.
*/
public void start() {
- debug("*** JPA project manager START ***"); //$NON-NLS-1$
+ JptJpaCorePlugin.instance().trace(TRACE_OPTION, "*** JPA project manager START ***"); //$NON-NLS-1$
try {
this.commandExecutor = this.buildAsynchronousCommandExecutor();
this.buildJpaProjects();
- this.workspace.addResourceChangeListener(this.resourceChangeListener, RESOURCE_CHANGE_EVENT_TYPES);
+ this.getWorkspace().addResourceChangeListener(this.resourceChangeListener, RESOURCE_CHANGE_EVENT_TYPES);
JavaCore.addElementChangedListener(this.javaElementChangeListener, JAVA_CHANGE_EVENT_TYPES);
} catch (RuntimeException ex) {
- this.log(ex);
+ JptJpaCorePlugin.instance().logError(ex);
this.stop();
}
}
/**
* Internal: Called <em>only</em> by the
- * {@link JptJpaCorePlugin#stop(org.osgi.framework.BundleContext) Dali plug-in}.
+ * {@link InternalJpaWorkspace#stop() JPA workspace}.
* The JPA project manager will <em>not</em> be restarted.
*/
public void stop() {
- debug("*** JPA project manager STOP ***"); //$NON-NLS-1$
+ JptJpaCorePlugin.instance().trace(TRACE_OPTION, "*** JPA project manager STOP ***"); //$NON-NLS-1$
JavaCore.removeElementChangedListener(this.javaElementChangeListener);
- this.workspace.removeResourceChangeListener(this.resourceChangeListener);
+ this.getWorkspace().removeResourceChangeListener(this.resourceChangeListener);
this.clearJpaProjects();
// if the current executor is async, commands can continue to execute
// after we replace it here, but there will be no JPA projects for them to process...
this.commandExecutor = ExtendedJobCommandExecutor.Inactive.instance();
- debug("*** JPA project manager DEAD ***"); //$NON-NLS-1$
+ JptJpaCorePlugin.instance().trace(TRACE_OPTION, "*** JPA project manager DEAD ***"); //$NON-NLS-1$
}
@@ -311,7 +302,7 @@ public class InternalJpaProjectManager
* Side-effect: {@link #jpaProjects} populated.
*/
private void buildJpaProjects() {
- debug("dispatch: build JPA projects"); //$NON-NLS-1$
+ JptJpaCorePlugin.instance().trace(TRACE_OPTION, "dispatch: build JPA projects"); //$NON-NLS-1$
BuildJpaProjectsCommand command = new BuildJpaProjectsCommand();
this.execute(command, JptCoreMessages.BUILD_JPA_PROJECTS_JOB_NAME, this.getWorkspaceRoot());
}
@@ -326,15 +317,15 @@ public class InternalJpaProjectManager
}
/* CU private */ void buildJpaProjects_(IProgressMonitor monitor) {
- debug("execute: build JPA projects"); //$NON-NLS-1$
+ JptJpaCorePlugin.instance().trace(TRACE_OPTION, "execute: build JPA projects"); //$NON-NLS-1$
try {
this.getWorkspaceRoot().accept(new ResourceProxyVisitor(monitor), IResource.NONE);
} catch (Exception ex) {
// if we have a problem, leave the currently built JPA projects in
// place and keep executing (should be OK...)
- this.log(ex);
+ JptJpaCorePlugin.instance().logError(ex);
}
- debug("end: build JPA projects"); //$NON-NLS-1$
+ JptJpaCorePlugin.instance().trace(TRACE_OPTION, "end: build JPA projects"); //$NON-NLS-1$
}
@@ -356,19 +347,19 @@ public class InternalJpaProjectManager
}
private void clearJpaProjects_() {
- debug("execute: clear JPA projects"); //$NON-NLS-1$
+ JptJpaCorePlugin.instance().trace(TRACE_OPTION, "execute: clear JPA projects"); //$NON-NLS-1$
// clone the collection to prevent concurrent modification exception
for (JpaProject jpaProject : this.getJpaProjects()) {
this.removeJpaProject(jpaProject);
}
- debug("end: clear JPA projects"); //$NON-NLS-1$
+ JptJpaCorePlugin.instance().trace(TRACE_OPTION, "end: clear JPA projects"); //$NON-NLS-1$
}
// ********** get JPA projects **********
public Iterable<JpaProject> waitToGetJpaProjects() throws InterruptedException {
- debug("dispatch: get JPA projects"); //$NON-NLS-1$
+ JptJpaCorePlugin.instance().trace(TRACE_OPTION, "dispatch: get JPA projects"); //$NON-NLS-1$
GetJpaProjectsCommand command = new GetJpaProjectsCommand();
this.waitToExecute(command, JptCoreMessages.GET_JPA_PROJECTS_JOB_NAME, this.getWorkspaceRoot());
return command.result;
@@ -387,7 +378,7 @@ public class InternalJpaProjectManager
* Pre-condition: called from {@link GetJpaProjectsCommand#execute()}
*/
/* CU private */ Iterable<JpaProject> getJpaProjects_() {
- debug("execute: get JPA projects: {0}", this.jpaProjects); //$NON-NLS-1$
+ JptJpaCorePlugin.instance().trace(TRACE_OPTION, "execute: get JPA projects: {0}", this.jpaProjects); //$NON-NLS-1$
// clone the JPA projects immediately, while we have the lock
return this.getJpaProjects();
}
@@ -407,7 +398,7 @@ public class InternalJpaProjectManager
* @see ProjectAdapterFactory.JpaProjectReference#getValue()
*/
JpaProject waitToGetJpaProject(IProject project) throws InterruptedException {
- debug("dispatch: get JPA project: {0}", project.getName()); //$NON-NLS-1$
+ JptJpaCorePlugin.instance().trace(TRACE_OPTION, "dispatch: get JPA project: {0}", project.getName()); //$NON-NLS-1$
GetJpaProjectCommand command = new GetJpaProjectCommand(project);
this.waitToExecute(command, JptCoreMessages.GET_JPA_PROJECT_JOB_NAME, project);
return command.result;
@@ -425,13 +416,13 @@ public class InternalJpaProjectManager
// @see ProjectAdapterFactory.JpaProjectReference#getValue(ModifiableObjectReference, long)
@SuppressWarnings("unused")
private boolean waitToGetJpaProject(ModifiableObjectReference<JpaProject> jpaProjectRef, IProject project, long timeout) throws InterruptedException {
- debug("dispatch: get JPA project (time-out): {0}", project.getName()); //$NON-NLS-1$
+ JptJpaCorePlugin.instance().trace(TRACE_OPTION, "dispatch: get JPA project (time-out): {0}", project.getName()); //$NON-NLS-1$
GetJpaProjectCommand command = new GetJpaProjectCommand(project);
boolean result = this.waitToExecute(command, JptCoreMessages.GET_JPA_PROJECT_JOB_NAME, project, timeout);
if (result) {
jpaProjectRef.setValue(command.result);
} else {
- debug("time-out: get JPA project: {0}", project.getName()); //$NON-NLS-1$
+ JptJpaCorePlugin.instance().trace(TRACE_OPTION, "time-out: get JPA project: {0}", project.getName()); //$NON-NLS-1$
}
return result;
}
@@ -453,11 +444,11 @@ public class InternalJpaProjectManager
* Pre-condition: called from {@link GetJpaProjectCommand#execute()}
*/
/* CU private */ JpaProject getJpaProjectUnsafe(IProject project) {
- debug("execute: get JPA project: {0}", project.getName()); //$NON-NLS-1$
+ JptJpaCorePlugin.instance().trace(TRACE_OPTION, "execute: get JPA project: {0}", project.getName()); //$NON-NLS-1$
// no need to clone here, since we have the lock
JpaProject jpaProject = selectJpaProject(this.jpaProjects, project);
if (jpaProject == null) {
- debug("not found: get JPA project: {0}", project.getName()); //$NON-NLS-1$
+ JptJpaCorePlugin.instance().trace(TRACE_OPTION, "not found: get JPA project: {0}", project.getName()); //$NON-NLS-1$
}
return jpaProject;
}
@@ -486,7 +477,7 @@ public class InternalJpaProjectManager
*/
// e.g. changed JPA platform
JpaProject rebuildJpaProject(IProject project) throws InterruptedException {
- debug("dispatch: rebuild JPA project: {0}", project.getName()); //$NON-NLS-1$
+ JptJpaCorePlugin.instance().trace(TRACE_OPTION, "dispatch: rebuild JPA project: {0}", project.getName()); //$NON-NLS-1$
RebuildJpaProjectCommand command = new RebuildJpaProjectCommand(project);
this.waitToExecute(command, JptCoreMessages.REBUILD_JPA_PROJECT_JOB_NAME, project);
return command.result;
@@ -507,7 +498,7 @@ public class InternalJpaProjectManager
}
/* CU private */ JpaProject rebuildJpaProject_(IProject project, IProgressMonitor monitor) {
- debug("execute: rebuild JPA project: {0}", project.getName()); //$NON-NLS-1$
+ JptJpaCorePlugin.instance().trace(TRACE_OPTION, "execute: rebuild JPA project: {0}", project.getName()); //$NON-NLS-1$
this.removeJpaProject(this.getJpaProject_(project));
if (monitor.isCanceled()) {
throw new OperationCanceledException();
@@ -522,7 +513,7 @@ public class InternalJpaProjectManager
* @see ProjectAdapterFactory.JpaProjectReference#buildValidationMessages(IReporter)
*/
Iterable<IMessage> buildValidationMessages(IProject project, IReporter reporter) throws InterruptedException {
- debug("dispatch: build validation messages: {0}", project.getName()); //$NON-NLS-1$
+ JptJpaCorePlugin.instance().trace(TRACE_OPTION, "dispatch: build validation messages: {0}", project.getName()); //$NON-NLS-1$
BuildValidationMessagesCommand command = new BuildValidationMessagesCommand(project, reporter);
this.waitToExecute(command, JptCoreMessages.BUILD_VALIDATION_MESSAGES_JOB_NAME, project);
return command.result;
@@ -544,15 +535,16 @@ public class InternalJpaProjectManager
}
/* CU private */ Iterable<IMessage> buildValidationMessages_(IProject project, IReporter reporter) {
- debug("execute: build validation messages: {0}", project.getName()); //$NON-NLS-1$
+ JptJpaCorePlugin.instance().trace(TRACE_OPTION, "execute: build validation messages: {0}", project.getName()); //$NON-NLS-1$
JpaProject jpaProject = this.getJpaProject_(project);
if (jpaProject == null) {
return this.buildNoJpaProjectMessages(project);
}
try {
+ // TODO catch exceptions further down too - so we get at least some msgs
return jpaProject.getValidationMessages(reporter);
} catch (RuntimeException ex) {
- this.log(ex);
+ JptJpaCorePlugin.instance().logError(ex);
return EmptyIterable.<IMessage>instance();
}
}
@@ -582,9 +574,9 @@ public class InternalJpaProjectManager
JpaProject jpaProject = this.buildJpaProject(project);
// figure out exactly when JPA projects are added
if (jpaProject == null) {
- dumpStackTrace("add JPA project fail: {0}", project); //$NON-NLS-1$
+ JptJpaCorePlugin.instance().dumpStackTrace(TRACE_OPTION, "add JPA project fail: {0}", project); //$NON-NLS-1$
} else {
- dumpStackTrace("add JPA project: {0}", jpaProject); //$NON-NLS-1$
+ JptJpaCorePlugin.instance().dumpStackTrace(TRACE_OPTION, "add JPA project: {0}", jpaProject); //$NON-NLS-1$
}
// the JPA project will be null if we have any problems building it...
// (e.g. if we have problems getting the JPA platform)
@@ -612,10 +604,14 @@ public class InternalJpaProjectManager
* Return <code>null</code> if we have any problems....
*/
private JpaProject buildJpaProject(JpaPlatform jpaPlatform, JpaProject.Config config) {
+ if (jpaPlatform == null) {
+ JptJpaCorePlugin.instance().logError(new IllegalArgumentException(), "null JPA platform: {0}", config.getProject()); //$NON-NLS-1$
+ return null;
+ }
try {
- return (jpaPlatform == null) ? null : jpaPlatform.getJpaFactory().buildJpaProject(config);
+ return jpaPlatform.getJpaFactory().buildJpaProject(config);
} catch (RuntimeException ex) {
- this.log(ex);
+ JptJpaCorePlugin.instance().logError(ex);
return null;
}
}
@@ -624,15 +620,52 @@ public class InternalJpaProjectManager
SimpleJpaProjectConfig config = new SimpleJpaProjectConfig();
config.setJpaProjectManager(this);
config.setProject(project);
- config.setJpaPlatform(JptJpaCorePlugin.getJpaPlatformManager().buildJpaPlatformImplementation(project));
- config.setConnectionProfileName(JptJpaCorePlugin.getConnectionProfileName(project));
- config.setUserOverrideDefaultCatalog(JptJpaCorePlugin.getUserOverrideDefaultCatalog(project));
- config.setUserOverrideDefaultSchema(JptJpaCorePlugin.getUserOverrideDefaultSchema(project));
- config.setDiscoverAnnotatedClasses(JptJpaCorePlugin.getDiscoverAnnotatedClasses(project));
- config.setMetamodelSourceFolderName(JptJpaCorePlugin.getMetamodelSourceFolderName(project));
+ config.setJpaPlatform(this.getJpaPlatform(project));
+ config.setConnectionProfileName(JpaPreferences.getConnectionProfileName(project));
+ config.setUserOverrideDefaultCatalog(JpaPreferences.getUserOverrideDefaultCatalog(project));
+ config.setUserOverrideDefaultSchema(JpaPreferences.getUserOverrideDefaultSchema(project));
+ config.setDiscoverAnnotatedClasses(JpaPreferences.getDiscoverAnnotatedClasses(project));
+ config.setMetamodelSourceFolderName(JpaPreferences.getMetamodelSourceFolderName(project));
return config;
}
+ private JpaPlatform getJpaPlatform(IProject project) {
+ JpaPlatformManager mgr = this.jpaWorkspace.getJpaPlatformManager();
+ String jpaPlatformID = JpaPreferences.getJpaPlatformID(project);
+ if (jpaPlatformID != null) {
+ return mgr.getJpaPlatform(jpaPlatformID);
+ }
+ // the ID taken from the JPA preferences can be null if the JPA facet is
+ // added by editing the facet metadata file directly and there are no
+ // pre-existing Dali project preferences in the project .settings directory
+ jpaPlatformID = this.getDefaultJpaPlatformID(project);
+ // it's unlikely the default ID will be null...
+ return (jpaPlatformID == null) ? null : mgr.getJpaPlatform(jpaPlatformID);
+ }
+
+ /**
+ * Return the default JPA platform ID for the specified project.
+ * This will be determined by the current default JPA platform for the
+ * project's JPA facet version.
+ */
+ private String getDefaultJpaPlatformID(IProject project) {
+ IProjectFacetVersion jpaFacetVersion = this.getJpaFacetVersion(project);
+ if (jpaFacetVersion == null) {
+ return null;
+ }
+ JpaPlatformDescription desc = this.jpaWorkspace.getJpaPlatformManager().getDefaultJpaPlatformDescription(jpaFacetVersion);
+ return (desc == null) ? null : desc.getId();
+ }
+
+ private IProjectFacetVersion getJpaFacetVersion(IProject project) {
+ try {
+ return ProjectFacetsManager.create(project).getProjectFacetVersion(JpaProject.FACET);
+ } catch (CoreException ex) {
+ JptJpaCorePlugin.instance().logError(ex);
+ return null;
+ }
+ }
+
// ********** remove JPA project **********
@@ -641,12 +674,12 @@ public class InternalJpaProjectManager
*/
private void removeJpaProject(JpaProject jpaProject) {
// figure out exactly when JPA projects are removed
- dumpStackTrace("remove JPA project: {0}", jpaProject); //$NON-NLS-1$
+ JptJpaCorePlugin.instance().dumpStackTrace(TRACE_OPTION, "remove JPA project: {0}", jpaProject); //$NON-NLS-1$
this.removeItemFromCollection(jpaProject, this.jpaProjects, JPA_PROJECTS_COLLECTION);
try {
jpaProject.dispose();
} catch (RuntimeException ex) {
- this.log(ex);
+ JptJpaCorePlugin.instance().logError(ex);
}
}
@@ -654,7 +687,7 @@ public class InternalJpaProjectManager
// ********** Project POST_CHANGE **********
/* CU private */ void projectChanged(IResourceDelta delta) {
- debug("dispatch: project changed: {0}", delta.getResource()); //$NON-NLS-1$
+ JptJpaCorePlugin.instance().trace(TRACE_OPTION, "dispatch: project changed: {0}", delta.getResource()); //$NON-NLS-1$
ProjectChangeEventHandlerCommand command = new ProjectChangeEventHandlerCommand(delta);
this.execute(command, JptCoreMessages.PROJECT_CHANGE_EVENT_HANDLER_JOB_NAME, this.getWorkspaceRoot());
}
@@ -677,13 +710,13 @@ public class InternalJpaProjectManager
* they will each determine whether the event is significant.
*/
/* CU private */ void projectChanged_(IResourceDelta delta, IProgressMonitor monitor) {
- debug("execute: project changed: {0}", delta.getResource()); //$NON-NLS-1$
+ JptJpaCorePlugin.instance().trace(TRACE_OPTION, "execute: project changed: {0}", delta.getResource()); //$NON-NLS-1$
// debug("execute: project changed: ", ((org.eclipse.core.internal.events.ResourceDelta) delta).toDeepDebugString()); //$NON-NLS-1$
for (JpaProject jpaProject : this.jpaProjects) {
try {
jpaProject.projectChanged(delta);
} catch (RuntimeException ex) {
- this.log(ex);
+ JptJpaCorePlugin.instance().logError(ex);
}
if (monitor.isCanceled()) {
throw new OperationCanceledException();
@@ -695,7 +728,7 @@ public class InternalJpaProjectManager
// ********** Project POST_BUILD (CLEAN_BUILD) **********
/* CU private */ void projectPostCleanBuild(IProject project) {
- debug("dispatch: post clean build: {0}", project.getName()); //$NON-NLS-1$
+ JptJpaCorePlugin.instance().trace(TRACE_OPTION, "dispatch: post clean build: {0}", project.getName()); //$NON-NLS-1$
ProjectPostCleanBuildEventHandlerCommand command = new ProjectPostCleanBuildEventHandlerCommand(project);
this.execute(command, JptCoreMessages.PROJECT_POST_CLEAN_BUILD_EVENT_HANDLER_JOB_NAME, project);
}
@@ -714,7 +747,7 @@ public class InternalJpaProjectManager
}
/* CU private */ void projectPostCleanBuild_(IProject project, IProgressMonitor monitor) {
- debug("execute: post clean build: {0}", project.getName()); //$NON-NLS-1$
+ JptJpaCorePlugin.instance().trace(TRACE_OPTION, "execute: post clean build: {0}", project.getName()); //$NON-NLS-1$
JpaProject jpaProject = this.getJpaProject_(project);
if (jpaProject != null) {
this.removeJpaProject(jpaProject);
@@ -734,7 +767,7 @@ public class InternalJpaProjectManager
* project.
*/
/* CU private */ void checkForJpaFacetTransition(IProject project) {
- debug("dispatch: project facet file changed: {0}", project.getName()); //$NON-NLS-1$
+ JptJpaCorePlugin.instance().trace(TRACE_OPTION, "dispatch: project facet file changed: {0}", project.getName()); //$NON-NLS-1$
FacetFileChangeEventHandlerCommand command = new FacetFileChangeEventHandlerCommand(project);
this.execute(command, JptCoreMessages.FACET_FILE_CHANGE_EVENT_HANDLER_JOB_NAME, project);
}
@@ -752,10 +785,10 @@ public class InternalJpaProjectManager
}
/* CU private */ void checkForJpaFacetTransition_(IProject project) {
- debug("execute: project facet file changed: {0}", project.getName()); //$NON-NLS-1$
+ JptJpaCorePlugin.instance().trace(TRACE_OPTION, "execute: project facet file changed: {0}", project.getName()); //$NON-NLS-1$
JpaProject jpaProject = this.getJpaProject_(project);
- if (JpaFacet.isInstalled(project)) {
+ if (ProjectTools.hasFacet(project, JpaProject.FACET)) {
if (jpaProject == null) { // JPA facet added
this.addJpaProject(project);
}
@@ -770,7 +803,7 @@ public class InternalJpaProjectManager
// ********** Java element changed **********
/* CU private */ void javaElementChanged(ElementChangedEvent event) {
- debug("dispatch: Java element changed: {0}", event.getDelta()); //$NON-NLS-1$
+ JptJpaCorePlugin.instance().trace(TRACE_OPTION, "dispatch: Java element changed: {0}", event.getDelta()); //$NON-NLS-1$
JavaChangeEventHandlerCommand command = new JavaChangeEventHandlerCommand(event);
this.execute(command, JptCoreMessages.JAVA_CHANGE_EVENT_HANDLER_JOB_NAME, this.getWorkspaceRoot());
}
@@ -793,12 +826,12 @@ public class InternalJpaProjectManager
* as the event could affect multiple projects.
*/
/* CU private */ void javaElementChanged_(ElementChangedEvent event, IProgressMonitor monitor) {
- debug("execute: Java element changed: {0}", event.getDelta()); //$NON-NLS-1$
+ JptJpaCorePlugin.instance().trace(TRACE_OPTION, "execute: Java element changed: {0}", event.getDelta()); //$NON-NLS-1$
for (JpaProject jpaProject : this.jpaProjects) {
try {
jpaProject.javaElementChanged(event);
} catch (RuntimeException ex) {
- this.log(ex);
+ JptJpaCorePlugin.instance().logError(ex);
}
if (monitor.isCanceled()) {
throw new OperationCanceledException();
@@ -821,45 +854,34 @@ public class InternalJpaProjectManager
// ********** logging **********
public void log(String msg) {
- JptJpaCorePlugin.log(msg);
+ JptJpaCorePlugin.instance().logError(msg);
}
public void log(Throwable throwable) {
- JptJpaCorePlugin.log(throwable);
+ JptJpaCorePlugin.instance().logError(throwable);
}
public void log(String msg, Throwable throwable) {
- JptJpaCorePlugin.log(msg, throwable);
+ JptJpaCorePlugin.instance().logError(throwable, msg);
}
public ExceptionHandler getExceptionHandler() {
- return this.exceptionHandler;
- }
-
- /* CU private */ class LocalExceptionHandler
- implements ExceptionHandler
- {
- public void handleException(Throwable t) {
- InternalJpaProjectManager.this.log(t);
- if (InternalJpaProjectManager.this.test) {
- t.printStackTrace();
- }
- }
- @Override
- public String toString() {
- return StringTools.buildToStringFor(this);
- }
+ return JptJpaCorePlugin.instance().getExceptionHandler();
}
// ********** misc **********
- public IWorkspace getWorkspace() {
- return this.workspace;
+ public JpaWorkspace getJpaWorkspace() {
+ return this.jpaWorkspace;
+ }
+
+ private IWorkspace getWorkspace() {
+ return this.jpaWorkspace.getWorkspace();
}
private IWorkspaceRoot getWorkspaceRoot() {
- return this.workspace.getRoot();
+ return this.getWorkspace().getRoot();
}
private ISchedulingRule getCurrentRule() {
@@ -886,7 +908,7 @@ public class InternalJpaProjectManager
* @see org.eclipse.jpt.jpa.core.internal.AbstractJpaProject.ManagerJobCommandExecutor#execute(JobCommand, String)
*/
public void execute(JobCommand command, String jobName, JpaProject jpaProject) {
- debug("dispatch: client command: {0}", command); //$NON-NLS-1$
+ JptJpaCorePlugin.instance().trace(TRACE_OPTION, "dispatch: client command: {0}", command); //$NON-NLS-1$
this.execute(new ClientJobCommandWrapper(command, jpaProject), jobName, jpaProject.getProject());
}
@@ -922,7 +944,7 @@ public class InternalJpaProjectManager
private boolean waitToExecute(JobCommand command, String jobName, ISchedulingRule schedulingRule, long timeout) throws InterruptedException {
ISchedulingRule currentRule = this.getCurrentRule();
if ((currentRule != null) && schedulingRule.isConflicting(currentRule)) {
- dumpStackTrace("scheduling rule conflict: {0} vs. {1}", schedulingRule, currentRule); //$NON-NLS-1$
+ JptJpaCorePlugin.instance().dumpStackTrace(TRACE_OPTION, "scheduling rule conflict: {0} vs. {1}", schedulingRule, currentRule); //$NON-NLS-1$
command.execute(new NullProgressMonitor());
return true;
}
@@ -953,7 +975,7 @@ public class InternalJpaProjectManager
* 0.5 second delay).
* <p>
* See org.eclipse.jpt.jpa.core.tests.JptJpaCoreTestsPlugin#start(org.osgi.framework.BundleContext).
- *
+ *
* @see #executeCommandsAsynchronously()
*/
private synchronized void executeCommandsSynchronously() throws InterruptedException {
@@ -1032,10 +1054,10 @@ public class InternalJpaProjectManager
*/
/* CU private */ void execute_(JobCommand command, IProgressMonitor monitor, JpaProject jpaProject) {
if (this.jpaProjects.contains(jpaProject)) {
- debug("execute: client command: {0}", command); //$NON-NLS-1$
+ JptJpaCorePlugin.instance().trace(TRACE_OPTION, "execute: client command: {0}", command); //$NON-NLS-1$
command.execute(monitor);
} else {
- debug("ignore: client command: {0}", command); //$NON-NLS-1$
+ JptJpaCorePlugin.instance().trace(TRACE_OPTION, "ignore: client command: {0}", command); //$NON-NLS-1$
}
}
@@ -1075,7 +1097,7 @@ public class InternalJpaProjectManager
private void processProject(IResourceProxy resourceProxy) {
if (resourceProxy.isAccessible()) { // the project exists and is open
IProject project = (IProject) resourceProxy.requestResource();
- if (JpaFacet.isInstalled(project)) {
+ if (ProjectTools.hasFacet(project, JpaProject.FACET)) {
InternalJpaProjectManager.this.addJpaProject(project);
}
}
@@ -1097,7 +1119,7 @@ public class InternalJpaProjectManager
implements IResourceChangeListener
{
/**
- * PRE_UNINSTALL is the only facet event we use for
+ * PRE_UNINSTALL is the only facet event we use for
* removing JPA projects. These are the cases where we listen for resource events.
* <p>
* Check for:<ul>
@@ -1123,7 +1145,7 @@ public class InternalJpaProjectManager
break;
// project-only events
- case IResourceChangeEvent.PRE_CLOSE :
+ case IResourceChangeEvent.PRE_CLOSE :
break; // ignore
case IResourceChangeEvent.PRE_DELETE :
break; // ignore
@@ -1133,7 +1155,7 @@ public class InternalJpaProjectManager
}
private void processPostChangeEvent(IResourceChangeEvent event) {
- debug("Resource POST_CHANGE event: {0}", event.getResource()); //$NON-NLS-1$
+ JptJpaCorePlugin.instance().trace(TRACE_OPTION, "Resource POST_CHANGE event: {0}", event.getResource()); //$NON-NLS-1$
this.processPostChangeDelta(event.getDelta());
}
@@ -1191,12 +1213,12 @@ public class InternalJpaProjectManager
this.checkForFacetFileChanges(file, delta);
}
}
-
+
private void checkForFacetFileChanges(IFile file, IResourceDelta delta) {
switch (delta.getKind()) {
case IResourceDelta.ADDED :
case IResourceDelta.REMOVED :
- case IResourceDelta.CHANGED :
+ case IResourceDelta.CHANGED :
InternalJpaProjectManager.this.checkForJpaFacetTransition(file.getProject());
break;
case IResourceDelta.ADDED_PHANTOM :
@@ -1221,7 +1243,7 @@ public class InternalJpaProjectManager
*/
// ***** POST_BUILD
private void processPostBuildEvent(IResourceChangeEvent event) {
- debug("Resource POST_BUILD event: {0}", event.getDelta().getResource()); //$NON-NLS-1$
+ JptJpaCorePlugin.instance().trace(TRACE_OPTION, "Resource POST_BUILD event: {0}", event.getDelta().getResource()); //$NON-NLS-1$
if (event.getBuildKind() == IncrementalProjectBuilder.CLEAN_BUILD) {
this.processPostCleanBuildDelta(event.getDelta());
}
@@ -1252,7 +1274,7 @@ public class InternalJpaProjectManager
}
private void processProjectPostCleanBuild(IProject project) {
- debug("\tProject CLEAN event: {0}", project.getName()); //$NON-NLS-1$
+ JptJpaCorePlugin.instance().trace(TRACE_OPTION, "\tProject CLEAN event: {0}", project.getName()); //$NON-NLS-1$
InternalJpaProjectManager.this.projectPostCleanBuild(project);
}
@@ -1333,46 +1355,16 @@ public class InternalJpaProjectManager
}
- // ********** DEBUG **********
+ // ********** tracing **********
- /* CU private */ static void debug(String message) {
- debug(message, EMPTY_OBJECT_ARRAY);
- }
- private static final Object[] EMPTY_OBJECT_ARRAY = new Object[0];
-
- /* CU private */ static void debug(String message, Object... args) {
- if (debug()) {
- debug_(message, args);
- }
- }
+ /* CU private */ static final String TRACE_OPTION = JpaProjectManager.class.getSimpleName();
- private static void debug_(String message, Object... args) {
- JptJpaCorePlugin.instance().log(IStatus.INFO, NLS.bind(message, args));
- }
-
- private static boolean debug() {
- return JptJpaCorePlugin.instance().getBooleanDebugOption(DEBUG_OPTION);
- }
- private static final String DEBUG_OPTION = JpaProjectManager.class.getSimpleName();
- private static final String DEBUG_OPTION_ = DEBUG_OPTION + '.';
-
- /* CU private */ static void dumpStackTrace(String message) {
- dumpStackTrace(message, EMPTY_OBJECT_ARRAY);
- }
-
- /* CU private */ static void dumpStackTrace(String message, Object... args) {
- if (debug()) {
- dumpStackTrace_(message, args);
- }
- }
-
- private static void dumpStackTrace_(String message, Object... args) {
- Exception ex = debugStackTrace() ? new Exception() : null;
- JptJpaCorePlugin.instance().log(IStatus.INFO, NLS.bind(message, args), ex);
- }
-
- private static boolean debugStackTrace() {
- return JptJpaCorePlugin.instance().getBooleanDebugOption(DEBUG_STACK_TRACE_OPTION);
+ /**
+ * This method should be invoked (reflectively) <em>only</em> from the tests.
+ * See <code>JpaProjectManagerTests.trace(String)</code>.
+ */
+ @SuppressWarnings("unused")
+ private static void trace(String message) {
+ JptJpaCorePlugin.instance().trace(TRACE_OPTION, message);
}
- private static final String DEBUG_STACK_TRACE_OPTION = DEBUG_OPTION_ + "stack_trace"; //$NON-NLS-1$
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/InternalJpaWorkspace.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/InternalJpaWorkspace.java
new file mode 100644
index 0000000000..d4b7546335
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/InternalJpaWorkspace.java
@@ -0,0 +1,104 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.jpa.core.internal;
+
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.jpa.core.JpaWorkspace;
+import org.eclipse.jpt.jpa.core.internal.platform.InternalJpaPlatformManager;
+import org.eclipse.jpt.jpa.core.internal.plugin.JptJpaCorePlugin;
+
+public class InternalJpaWorkspace
+ implements JpaWorkspace
+{
+ private final IWorkspace workspace;
+
+ // NB: the JPA workspace must be synchronized whenever accessing any of this state
+ private InternalJpaPlatformManager jpaPlatformManager;
+ private InternalJpaProjectManager jpaProjectManager;
+
+
+ /**
+ * Internal: Called <em>only</em> by the
+ * {@link JptJpaCorePlugin#buildJpaWorkspace(IWorkspace) Dali JPA plug-in}.
+ */
+ public InternalJpaWorkspace(IWorkspace workspace) {
+ super();
+ this.workspace = workspace;
+ }
+
+ public IWorkspace getWorkspace() {
+ return workspace;
+ }
+
+ /**
+ * Internal: Called <em>only</em> by the
+ * {@link JpaPreferenceInitializer#initializeDefaultPreferences()
+ * JPA preferences initializer}.
+ */
+ void initializeDefaultPreferences() {
+ this.getJpaPlatformManager().initializeDefaultPreferences();
+ }
+
+
+ // ********** JPA platform manager **********
+
+ public synchronized InternalJpaPlatformManager getJpaPlatformManager() {
+ if ((this.jpaPlatformManager == null) && this.isActive()) {
+ this.jpaPlatformManager = this.buildJpaPlatformManager();
+ }
+ return this.jpaPlatformManager;
+ }
+
+ private InternalJpaPlatformManager buildJpaPlatformManager() {
+ return new InternalJpaPlatformManager(this);
+ }
+
+
+ // ********** JPA project manager **********
+
+ public synchronized InternalJpaProjectManager getJpaProjectManager() {
+ if ((this.jpaProjectManager == null) && this.isActive()) {
+ this.jpaProjectManager = this.buildJpaProjectManager();
+ this.jpaProjectManager.start();
+ }
+ return this.jpaProjectManager;
+ }
+
+ private InternalJpaProjectManager buildJpaProjectManager() {
+ return new InternalJpaProjectManager(this);
+ }
+
+
+ // ********** misc **********
+
+ private boolean isActive() {
+ return JptJpaCorePlugin.instance().isActive();
+ }
+
+ /**
+ * Internal: Called <em>only</em> by the
+ * {@link JptJpaCorePlugin#stop_() Dali plug-in}.
+ */
+ public synchronized void stop() {
+ if (this.jpaPlatformManager != null) {
+ this.jpaPlatformManager = null;
+ }
+ if (this.jpaProjectManager != null) {
+ this.jpaProjectManager.stop();
+ this.jpaProjectManager = null;
+ }
+ }
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this, this.workspace);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JarResourceModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JarResourceModelProvider.java
index e79e3d5b0c..fce3081935 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JarResourceModelProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JarResourceModelProvider.java
@@ -13,9 +13,9 @@ import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
import org.eclipse.jpt.common.core.JptResourceModel;
import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryPackageFragmentRoot;
+import org.eclipse.jpt.common.core.resource.java.JavaResourcePackageFragmentRoot;
import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.JpaResourceModelProvider;
@@ -43,7 +43,7 @@ public class JarResourceModelProvider
}
public IContentType getContentType() {
- return JptCommonCorePlugin.JAR_CONTENT_TYPE;
+ return JavaResourcePackageFragmentRoot.JAR_CONTENT_TYPE;
}
/**
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JavaPackageInfoResourceModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JavaPackageInfoResourceModelProvider.java
index f4132f0dff..9105cb797d 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JavaPackageInfoResourceModelProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JavaPackageInfoResourceModelProvider.java
@@ -14,7 +14,6 @@ import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
import org.eclipse.jpt.common.core.internal.resource.java.source.SourcePackageInfoCompilationUnit;
import org.eclipse.jpt.common.core.resource.java.JavaResourceCompilationUnit;
import org.eclipse.jpt.jpa.core.JpaProject;
@@ -44,7 +43,7 @@ public class JavaPackageInfoResourceModelProvider
}
public IContentType getContentType() {
- return JptCommonCorePlugin.JAVA_SOURCE_PACKAGE_INFO_CONTENT_TYPE;
+ return JavaResourceCompilationUnit.PACKAGE_INFO_CONTENT_TYPE;
}
public JavaResourceCompilationUnit buildResourceModel(JpaProject jpaProject, IFile file) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JavaResourceModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JavaResourceModelProvider.java
index d523f11c86..203be2af9e 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JavaResourceModelProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JavaResourceModelProvider.java
@@ -12,7 +12,6 @@ package org.eclipse.jpt.jpa.core.internal;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
import org.eclipse.jpt.common.core.internal.resource.java.source.SourceTypeCompilationUnit;
import org.eclipse.jpt.common.core.resource.java.JavaResourceCompilationUnit;
import org.eclipse.jpt.jpa.core.JpaProject;
@@ -42,7 +41,7 @@ public class JavaResourceModelProvider
}
public IContentType getContentType() {
- return JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE;
+ return JavaResourceCompilationUnit.CONTENT_TYPE;
}
public JavaResourceCompilationUnit buildResourceModel(JpaProject jpaProject, IFile file) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JpaContextNodePropertyTester.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JpaContextNodePropertyTester.java
deleted file mode 100644
index f8b5be3f2c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JpaContextNodePropertyTester.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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.jpa.core.internal;
-
-import org.eclipse.core.expressions.PropertyTester;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.context.JpaContextNode;
-
-/**
- * Property tester for {@link JpaContextNode}.
- * See <code>org.eclipse.jpt.jpa.core/plugin.xml</code>
- */
-public class JpaContextNodePropertyTester
- extends PropertyTester
-{
- public static final String IS_COMPATIBLE_VERSION = "isCompatibleVersion"; //$NON-NLS-1$
-
-
- public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
- if (receiver instanceof JpaContextNode) {
- return this.test((JpaContextNode) receiver, property, expectedValue);
- }
- return false;
- }
-
- private boolean test(JpaContextNode contextNode, String property, Object expectedValue) {
- if (property.equals(IS_COMPATIBLE_VERSION)) {
- return JptJpaCorePlugin.resourceTypeIsCompatible(contextNode.getResourceType(), (String) expectedValue);
- }
- return false;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/prefs/JpaPreferenceInitializer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JpaPreferenceInitializer.java
index c8136cf4b4..7bed27d2e4 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/prefs/JpaPreferenceInitializer.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JpaPreferenceInitializer.java
@@ -7,19 +7,28 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.prefs;
+package org.eclipse.jpt.jpa.core.internal;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.jpt.jpa.core.JpaPreferences;
+import org.eclipse.jpt.jpa.core.internal.plugin.JptJpaCorePlugin;
/**
- * Class used to initialize default preference values.
- * See <code>org.eclipse.core.runtime.preferences</code> extension point.
+ * Class used to initialize default (non-persistent) preference values.
+ * <p>
+ * See <code>org.eclipse.jpt.jpa.core/plugin.xml:org.eclipse.core.runtime.preferences</code>.
*/
public class JpaPreferenceInitializer
extends AbstractPreferenceInitializer
{
@Override
public void initializeDefaultPreferences() {
- JpaPreferencesManager.initializeDefaultPreferences();
+ JpaPreferences.initializeDefaultPreferences();
+ this.getJpaWorkspace().initializeDefaultPreferences();
+ }
+
+ private InternalJpaWorkspace getJpaWorkspace() {
+ return JptJpaCorePlugin.instance().getJpaWorkspace(ResourcesPlugin.getWorkspace());
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JptCoreMessages.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JptCoreMessages.java
index e05ce8d596..185d769e2c 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JptCoreMessages.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JptCoreMessages.java
@@ -54,14 +54,16 @@ public class JptCoreMessages {
public static String CONTEXT_MODEL_SYNC_JOB_NAME;
public static String UPDATE_JOB_NAME;
public static String METAMODEL_SYNC_JOB_NAME;
- public static String PREFERENCES_FLUSH_JOB_NAME;
public static String OSGI_BUNDLES_LIBRARY_VALIDATOR__BUNDLE_NOT_FOUND;
public static String OSGI_BUNDLES_LIBRARY_VALIDATOR__IMPROPER_BUNDLE_VERSION;
+ public static String INVALID_FACET;
+
public static String JAVA_METADATA_CONVERSION_IN_PROGRESS;
public static String JAVA_METADATA_CONVERSION_CONVERT_GENERATOR;
public static String JAVA_METADATA_CONVERSION_CONVERT_QUERY;
public static String JAVA_METADATA_CONVERSION_CANCELED;
public static String JAVA_METADATA_CONVERSION_COMPLETE;
+
public static String MAKE_PERSISTENT_ADD_TO_XML_RESOURCE_MODEL;
public static String MAKE_PERSISTENT_BUILDING_PERSISTENT_TYPE;
public static String MAKE_PERSISTENT_PROCESSING_MAPPED_SUPERCLASSES;
@@ -72,6 +74,7 @@ public class JptCoreMessages {
public static String MAKE_PERSISTENT_ANNOTATING_CLASS;
public static String MAKE_PERSISTENT_ADD_TO_PERSISTENCE_XML_RESOURCE_MODEL;
public static String MAKE_PERSISTENT_LISTING_IN_PERSISTENCE_XML;
+
private JptCoreMessages() {
throw new UnsupportedOperationException();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JptResourceModelPropertyTester.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JptResourceModelPropertyTester.java
index 9a2033bee8..5a136cc62a 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JptResourceModelPropertyTester.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JptResourceModelPropertyTester.java
@@ -18,7 +18,7 @@ import org.eclipse.jpt.jpa.core.JpaProject;
/**
* Property tester for {@link JptResourceModel}.
- * See <code>org.eclipse.jpt.jpa.core/plugin.xml</code>
+ * See <code>org.eclipse.jpt.jpa.core/plugin.xml:org.eclipse.core.expressions.propertyTesters</code>
*/
public class JptResourceModelPropertyTester
extends PropertyTester
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/OrmResourceModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/OrmResourceModelProvider.java
index 95503b18d9..877f91a6d2 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/OrmResourceModelProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/OrmResourceModelProvider.java
@@ -13,8 +13,8 @@ import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.JpaResourceModelProvider;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.internal.resource.orm.OrmXmlResourceProvider;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
/**
@@ -41,7 +41,7 @@ public class OrmResourceModelProvider
}
public IContentType getContentType() {
- return JptJpaCorePlugin.ORM_XML_CONTENT_TYPE;
+ return XmlEntityMappings.CONTENT_TYPE;
}
public JpaXmlResource buildResourceModel(JpaProject jpaProject, IFile file) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/PersistenceResourceModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/PersistenceResourceModelProvider.java
index 26d032336f..54f21ed78d 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/PersistenceResourceModelProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/PersistenceResourceModelProvider.java
@@ -14,8 +14,8 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.JpaResourceModelProvider;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.internal.resource.persistence.PersistenceXmlResourceProvider;
+import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistence;
import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
/**
@@ -42,7 +42,7 @@ public class PersistenceResourceModelProvider
}
public IContentType getContentType() {
- return JptJpaCorePlugin.PERSISTENCE_XML_CONTENT_TYPE;
+ return XmlPersistence.CONTENT_TYPE;
}
public JpaXmlResource buildResourceModel(JpaProject jpaProject, IFile file) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/WorkspaceAdapterFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/WorkspaceAdapterFactory.java
index e2f6e475b9..786c73cdb1 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/WorkspaceAdapterFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/WorkspaceAdapterFactory.java
@@ -12,18 +12,21 @@ package org.eclipse.jpt.jpa.core.internal;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.jpt.jpa.core.JpaProjectManager;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.JpaWorkspace;
+import org.eclipse.jpt.jpa.core.internal.plugin.JptJpaCorePlugin;
/**
- * Factory to build Dali adapters for an {@link IWorkspace}:<ul>
- * <li>{@link org.eclipse.jpt.jpa.core.JpaProjectManager}
+ * Factory to build Dali JPA adapters for an {@link IWorkspace Eclipse workspace}:<ul>
+ * <li>{@link org.eclipse.jpt.jpa.core.JpaWorkspace}
+ * <li>{@link JpaProjectManager}
* </ul>
- * See <code>org.eclipse.jpt.jpa.core/plugin.xml</code>.
+ * See <code>org.eclipse.jpt.jpa.core/plugin.xml:org.eclipse.core.runtime.adapters</code>.
*/
public class WorkspaceAdapterFactory
implements IAdapterFactory
{
private static final Class<?>[] ADAPTER_LIST = new Class[] {
+ JpaWorkspace.class,
JpaProjectManager.class
};
@@ -37,15 +40,22 @@ public class WorkspaceAdapterFactory
}
return null;
}
-
+
private Object getAdapter(IWorkspace workspace, Class<?> adapterType) {
+ if (adapterType == JpaWorkspace.class) {
+ return this.getJpaWorkspace(workspace);
+ }
if (adapterType == JpaProjectManager.class) {
return this.getJpaProjectManager(workspace);
}
return null;
}
-
+
+ private JpaWorkspace getJpaWorkspace(IWorkspace workspace) {
+ return JptJpaCorePlugin.instance().getJpaWorkspace(workspace);
+ }
+
private JpaProjectManager getJpaProjectManager(IWorkspace workspace) {
- return JptJpaCorePlugin.getJpaProjectManager(workspace);
+ return this.getJpaWorkspace(workspace).getJpaProjectManager();
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/AbstractJpaContextNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/AbstractJpaContextNode.java
index 22507e4026..65a7d0a264 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/AbstractJpaContextNode.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/AbstractJpaContextNode.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 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.
@@ -12,7 +12,7 @@ package org.eclipse.jpt.jpa.core.internal.context;
import org.eclipse.jpt.common.core.JptResourceType;
import org.eclipse.jpt.jpa.core.JpaNode;
import org.eclipse.jpt.jpa.core.context.JpaContextNode;
-import org.eclipse.jpt.jpa.core.context.MappingFileRoot;
+import org.eclipse.jpt.jpa.core.context.MappingFile;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.jpa.core.internal.AbstractJpaNode;
import org.eclipse.jpt.jpa.db.Catalog;
@@ -99,7 +99,7 @@ public abstract class AbstractJpaContextNode
* to return <code>null</code>
* </ul>
*/
- public MappingFileRoot getMappingFileRoot() {
+ public MappingFile.Root getMappingFileRoot() {
return this.getParent().getMappingFileRoot();
}
@@ -112,7 +112,7 @@ public abstract class AbstractJpaContextNode
}
protected String getContextDefaultSchema() {
- MappingFileRoot mfr = this.getMappingFileRoot();
+ MappingFile.Root mfr = this.getMappingFileRoot();
return (mfr != null) ? mfr.getSchema() : this.getPersistenceUnit().getDefaultSchema();
}
@@ -136,7 +136,7 @@ public abstract class AbstractJpaContextNode
}
protected String getContextDefaultCatalog() {
- MappingFileRoot mfr = this.getMappingFileRoot();
+ MappingFile.Root mfr = this.getMappingFileRoot();
return (mfr != null) ? mfr.getCatalog() : this.getPersistenceUnit().getDefaultCatalog();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/PersistentAttributePropertyTester.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/PersistentAttributePropertyTester.java
index ff5cfc699e..b1ac00ad21 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/PersistentAttributePropertyTester.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/PersistentAttributePropertyTester.java
@@ -14,7 +14,7 @@ import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
/**
* Property tester for {@link ReadOnlyPersistentAttribute}.
- * See <code>org.eclipse.jpt.jpa.core/plugin.xml</code>
+ * See <code>org.eclipse.jpt.jpa.core/plugin.xml:org.eclipse.core.expressions.propertyTesters</code>
*/
public class PersistentAttributePropertyTester
extends PropertyTester
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/XmlFilePropertyTester.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/XmlFilePropertyTester.java
index 4b8da00999..df04779fc2 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/XmlFilePropertyTester.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/XmlFilePropertyTester.java
@@ -14,7 +14,7 @@ import org.eclipse.jpt.jpa.core.context.XmlFile;
/**
* Property tester for {@link XmlFile}.
- * See <code>org.eclipse.jpt.jpa.core/plugin.xml</code>
+ * See <code>org.eclipse.jpt.jpa.core/plugin.xml:org.eclipse.core.expressions.propertyTesters</code>
*/
public class XmlFilePropertyTester
extends PropertyTester
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaJpaContextNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaJpaContextNode.java
index 965f34f8f2..d462f5cbf7 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaJpaContextNode.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaJpaContextNode.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 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.
@@ -11,7 +11,6 @@ package org.eclipse.jpt.jpa.core.internal.context.java;
import java.util.List;
import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
import org.eclipse.jpt.common.core.JptResourceType;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.common.utility.Filter;
@@ -32,7 +31,7 @@ public abstract class AbstractJavaJpaContextNode
@Override
public JptResourceType getResourceType() {
- return JptCommonCorePlugin.JAVA_SOURCE_RESOURCE_TYPE;
+ return JavaSourceFileDefinition.instance().getResourceType();
}
public Iterable<String> getJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentAttribute.java
index d0a7681531..334046478b 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentAttribute.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentAttribute.java
@@ -12,11 +12,12 @@ package org.eclipse.jpt.jpa.core.internal.context.java;
import java.util.List;
import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
import org.eclipse.jpt.common.core.internal.utility.JDTTools;
import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceCompilationUnit;
import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
import org.eclipse.jpt.common.core.resource.java.JavaResourceMethod;
+import org.eclipse.jpt.common.core.resource.java.JavaResourcePackageFragmentRoot;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.common.utility.Filter;
import org.eclipse.jpt.common.utility.internal.ClassName;
@@ -646,8 +647,8 @@ public abstract class AbstractJavaPersistentAttribute
*/
public boolean isVirtual() {
IContentType persistentTypeContentType = this.getOwningPersistentType().getResourceType().getContentType();
- return ! persistentTypeContentType.isKindOf(JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE)
- && ! persistentTypeContentType.isKindOf(JptCommonCorePlugin.JAR_CONTENT_TYPE);
+ return ! persistentTypeContentType.isKindOf(JavaResourceCompilationUnit.CONTENT_TYPE)
+ && ! persistentTypeContentType.isKindOf(JavaResourcePackageFragmentRoot.JAR_CONTENT_TYPE);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentType.java
index 5a992db996..9fb69db125 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentType.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentType.java
@@ -43,7 +43,6 @@ import org.eclipse.jpt.common.utility.internal.iterables.SuperListIterableWrappe
import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
import org.eclipse.jpt.jpa.core.JpaFile;
import org.eclipse.jpt.jpa.core.JpaStructureNode;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.AccessType;
import org.eclipse.jpt.jpa.core.context.PersistentType;
import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
@@ -52,6 +51,7 @@ import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
import org.eclipse.jpt.jpa.core.context.java.JavaTypeMapping;
import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition;
import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
+import org.eclipse.jpt.jpa.core.internal.plugin.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.Access2_0Annotation;
import org.eclipse.jst.j2ee.model.internal.validation.ValidationCancelledException;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
@@ -1030,7 +1030,7 @@ public abstract class AbstractJavaPersistentType
try {
this.mapping.validate(messages, reporter, astRoot);
} catch(Throwable t) {
- JptJpaCorePlugin.log(t);
+ JptJpaCorePlugin.instance().logError(t);
}
}
@@ -1044,7 +1044,7 @@ public abstract class AbstractJavaPersistentType
try {
attribute.validate(messages, reporter, astRoot);
} catch(Throwable t) {
- JptJpaCorePlugin.log(t);
+ JptJpaCorePlugin.instance().logError(t);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JarDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JarDefinition.java
new file mode 100644
index 0000000000..85d375542f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JarDefinition.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.jpa.core.internal.context.java;
+
+import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.jpt.common.core.JptResourceType;
+import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
+import org.eclipse.jpt.common.core.resource.java.JavaResourcePackageFragmentRoot;
+import org.eclipse.jpt.jpa.core.ResourceDefinition;
+
+public class JarDefinition
+ implements ResourceDefinition
+{
+ // singleton
+ private static final ResourceDefinition INSTANCE = new JarDefinition();
+
+ /**
+ * Return the singleton
+ */
+ public static ResourceDefinition instance() {
+ return INSTANCE;
+ }
+
+
+ /**
+ * Enforce singleton usage
+ */
+ private JarDefinition() {
+ super();
+ }
+
+ public JptResourceType getResourceType() {
+ return this.getResourceType(JavaResourcePackageFragmentRoot.JAR_CONTENT_TYPE);
+ }
+
+
+ // ********** misc **********
+
+ protected JptResourceType getResourceType(IContentType contentType) {
+ return PlatformTools.getResourceType(contentType);
+ }
+
+ @Override
+ public String toString() {
+ return this.getClass().getSimpleName();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaSourceFileDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaSourceFileDefinition.java
new file mode 100644
index 0000000000..84320c43ab
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaSourceFileDefinition.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.jpa.core.internal.context.java;
+
+import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.jpt.common.core.JptResourceType;
+import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceCompilationUnit;
+import org.eclipse.jpt.jpa.core.ResourceDefinition;
+
+public class JavaSourceFileDefinition
+ implements ResourceDefinition
+{
+ // singleton
+ private static final ResourceDefinition INSTANCE = new JavaSourceFileDefinition();
+
+ /**
+ * Return the singleton
+ */
+ public static ResourceDefinition instance() {
+ return INSTANCE;
+ }
+
+
+ /**
+ * Enforce singleton usage
+ */
+ private JavaSourceFileDefinition() {
+ super();
+ }
+
+ public JptResourceType getResourceType() {
+ return this.getResourceType(JavaResourceCompilationUnit.CONTENT_TYPE);
+ }
+
+
+ // ********** misc **********
+
+ protected JptResourceType getResourceType(IContentType contentType) {
+ return PlatformTools.getResourceType(contentType);
+ }
+
+ @Override
+ public String toString() {
+ return this.getClass().getSimpleName();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/PackageInfoDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/PackageInfoDefinition.java
new file mode 100644
index 0000000000..d5ce457548
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/PackageInfoDefinition.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.jpa.core.internal.context.java;
+
+import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.jpt.common.core.JptResourceType;
+import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceCompilationUnit;
+import org.eclipse.jpt.jpa.core.ResourceDefinition;
+
+/**
+ * <code>package-info</code> Java source code files.
+ */
+public class PackageInfoDefinition
+ implements ResourceDefinition
+{
+ // singleton
+ private static final ResourceDefinition INSTANCE = new PackageInfoDefinition();
+
+ /**
+ * Return the singleton
+ */
+ public static ResourceDefinition instance() {
+ return INSTANCE;
+ }
+
+
+ /**
+ * Enforce singleton usage
+ */
+ private PackageInfoDefinition() {
+ super();
+ }
+
+ public JptResourceType getResourceType() {
+ return this.getResourceType(JavaResourceCompilationUnit.PACKAGE_INFO_CONTENT_TYPE);
+ }
+
+
+ // ********** misc **********
+
+ protected JptResourceType getResourceType(IContentType contentType) {
+ return PlatformTools.getResourceType(contentType);
+ }
+
+ @Override
+ public String toString() {
+ return this.getClass().getSimpleName();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractEntityMappings.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractEntityMappings.java
index 85d9c809c9..273ca0ef5d 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractEntityMappings.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractEntityMappings.java
@@ -35,7 +35,6 @@ import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable;
import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
import org.eclipse.jpt.jpa.core.JpaStructureNode;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.AccessType;
import org.eclipse.jpt.jpa.core.context.Generator;
@@ -54,6 +53,7 @@ import org.eclipse.jpt.jpa.core.context.orm.OrmXml;
import org.eclipse.jpt.jpa.core.internal.JptCoreMessages;
import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceUnit;
+import org.eclipse.jpt.jpa.core.internal.plugin.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
@@ -181,7 +181,7 @@ public abstract class AbstractEntityMappings
return (OrmXml) super.getParent();
}
- // TODO bjv add to interface
+ @Override
public OrmXml getOrmXml() {
return this.getParent();
}
@@ -1109,14 +1109,14 @@ public abstract class AbstractEntityMappings
}
protected IContentType getContentType() {
- return JptJpaCorePlugin.ORM_XML_CONTENT_TYPE;
+ return XmlEntityMappings.CONTENT_TYPE;
}
protected void validatePersistentType(OrmPersistentType persistentType, List<IMessage> messages, IReporter reporter) {
try {
persistentType.validate(messages, reporter);
} catch (Throwable exception) {
- JptJpaCorePlugin.log(exception);
+ JptJpaCorePlugin.instance().logError(exception);
}
}
@@ -1217,7 +1217,7 @@ public abstract class AbstractEntityMappings
return result;
}
}
- return null;
+ return EmptyIterable.instance();
}
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmXmlContextNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmXmlContextNode.java
index 75569ed57a..58eac36df7 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmXmlContextNode.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmXmlContextNode.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 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.
@@ -15,11 +15,9 @@ import org.eclipse.jpt.jpa.core.context.orm.EntityMappings;
import org.eclipse.jpt.jpa.core.context.orm.OrmXml;
import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
import org.eclipse.jpt.jpa.core.context.orm.OrmXmlDefinition;
-import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatformFactory.SimpleVersion;
import org.eclipse.jpt.jpa.core.internal.context.AbstractXmlContextNode;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmXml;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.GenericOrmXml2_0Definition;
import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmXml2_0ContextNodeFactory;
-import org.eclipse.wst.common.project.facet.core.VersionFormatException;
/**
* Use this abstract class for context nodes that are part of an
@@ -42,28 +40,20 @@ public abstract class AbstractOrmXmlContextNode
return (EntityMappings) super.getMappingFileRoot();
}
- // TODO bjv need to cascade up containment hierarchy... (need public API:
- // JpaContextNode.getMappingFileDefinition() ?)
+ protected OrmXml getOrmXml() {
+ return this.getMappingFileRoot().getOrmXml();
+ }
+
protected OrmXmlDefinition getMappingFileDefinition() {
- OrmXml ormXml = this.getMappingFileRoot().getParent();
- if (ormXml instanceof GenericOrmXml) {
- return ((GenericOrmXml) ormXml).getMappingFileDefinition();
- }
- return (OrmXmlDefinition) this.getJpaPlatform().getResourceDefinition(this.getResourceType());
+ return this.getOrmXml().getDefinition();
}
protected EFactory getResourceNodeFactory() {
return this.getMappingFileDefinition().getResourceNodeFactory();
}
- // TODO bjv need to add API and delegate to orm.xml/entity mappings interface...
protected boolean isOrmXml2_0Compatible() {
- String version = this.getMappingFileRoot().getVersion();
- try {
- return (version != null) && SimpleVersion.VERSION_COMPARATOR.compare(version, "2.0") >= 0; //$NON-NLS-1$
- } catch (VersionFormatException ex) {
- return false;
- }
+ return this.getResourceType().isKindOf(GenericOrmXml2_0Definition.instance().getResourceType());
}
/**
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmXmlDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmXmlDefinition.java
index 9bc92f0f24..9ce4ecd589 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmXmlDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmXmlDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2012 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.
@@ -10,7 +10,9 @@
package org.eclipse.jpt.jpa.core.internal.context.orm;
import java.util.ArrayList;
-
+import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.jpt.common.core.JptResourceType;
+import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.Tools;
import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition;
@@ -86,7 +88,7 @@ public abstract class AbstractOrmXmlDefinition
/**
* Order should not matter here; but we'll use the same order as for Java.
- * @see GenericJpaPlatformProvider
+ * @see org.eclipse.jpt.jpa.core.internal.GenericJpaPlatformProvider
*/
protected static final OrmTypeMappingDefinition[] TYPE_MAPPING_DEFINITIONS = new OrmTypeMappingDefinition[] {
OrmEntityDefinition.instance(),
@@ -125,4 +127,16 @@ public abstract class AbstractOrmXmlDefinition
}
protected abstract void addAttributeMappingDefinitionsTo(ArrayList<OrmAttributeMappingDefinition> definitions);
+
+
+ // ********** misc **********
+
+ protected JptResourceType getResourceType(IContentType contentType, String version) {
+ return PlatformTools.getResourceType(contentType, version);
+ }
+
+ @Override
+ public String toString() {
+ return this.getClass().getSimpleName();
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/SpecifiedOrmPersistentType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/SpecifiedOrmPersistentType.java
index 36c53a9228..65b807836e 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/SpecifiedOrmPersistentType.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/SpecifiedOrmPersistentType.java
@@ -42,7 +42,6 @@ import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable;
import org.eclipse.jpt.common.utility.internal.iterables.SuperListIterableWrapper;
import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
import org.eclipse.jpt.jpa.core.JpaStructureNode;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.AccessType;
import org.eclipse.jpt.jpa.core.context.PersistentType;
import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
@@ -58,6 +57,7 @@ import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMappingDefinition;
import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaPersistentType;
import org.eclipse.jpt.jpa.core.internal.context.java.PropertyAccessor;
+import org.eclipse.jpt.jpa.core.internal.plugin.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelSourceType;
@@ -1273,7 +1273,7 @@ public abstract class SpecifiedOrmPersistentType
try {
this.mapping.validate(messages, reporter);
} catch(Throwable t) {
- JptJpaCorePlugin.log(t);
+ JptJpaCorePlugin.instance().logError(t);
}
}
@@ -1287,7 +1287,7 @@ public abstract class SpecifiedOrmPersistentType
try {
attribute.validate(messages, reporter);
} catch(Throwable t) {
- JptJpaCorePlugin.log(t);
+ JptJpaCorePlugin.instance().logError(t);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractJarFileRef.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractJarFileRef.java
index cb65b89725..7000456e60 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractJarFileRef.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractJarFileRef.java
@@ -15,6 +15,7 @@ import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
+import org.eclipse.jpt.common.core.internal.utility.ProjectTools;
import org.eclipse.jpt.common.core.resource.java.JavaResourcePackageFragmentRoot;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.common.utility.internal.StringTools;
@@ -22,7 +23,6 @@ import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable;
import org.eclipse.jpt.jpa.core.JpaFile;
import org.eclipse.jpt.jpa.core.JpaStructureNode;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.PersistentType;
import org.eclipse.jpt.jpa.core.context.java.JarFile;
import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
@@ -232,11 +232,11 @@ public abstract class AbstractJarFileRef
}
protected IPath getJarRuntimeRootPath() {
- return JptJpaCorePlugin.getJarRuntimeRootPath(this.getProject());
+ return ProjectTools.getJarRuntimeRootPath(this.getProject());
}
protected boolean projectHasWebFacet() {
- return JptJpaCorePlugin.projectHasWebFacet(this.getProject());
+ return ProjectTools.hasWebFacet(this.getProject());
}
protected IPath[] buildRuntimeJarFilePathWeb(IPath root, IPath jarFilePath) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractMappingFileRef.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractMappingFileRef.java
index 33c7fb9e9d..b27bb6f4ba 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractMappingFileRef.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractMappingFileRef.java
@@ -16,7 +16,6 @@ import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IType;
-import org.eclipse.jpt.common.core.JptResourceType;
import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable;
@@ -24,7 +23,6 @@ import org.eclipse.jpt.jpa.core.JpaStructureNode;
import org.eclipse.jpt.jpa.core.context.Generator;
import org.eclipse.jpt.jpa.core.context.MappingFile;
import org.eclipse.jpt.jpa.core.context.MappingFilePersistenceUnitMetadata;
-import org.eclipse.jpt.jpa.core.context.MappingFileRoot;
import org.eclipse.jpt.jpa.core.context.PersistentType;
import org.eclipse.jpt.jpa.core.context.Query;
import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
@@ -32,7 +30,6 @@ import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
import org.eclipse.text.edits.DeleteEdit;
import org.eclipse.text.edits.ReplaceEdit;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
@@ -43,7 +40,7 @@ import org.eclipse.wst.validation.internal.provisional.core.IReporter;
* <br>
* <code>mapping-file</code> element
*/
-public abstract class AbstractMappingFileRef
+public abstract class AbstractMappingFileRef<MF extends MappingFile>
extends AbstractPersistenceXmlContextNode
implements MappingFileRef
{
@@ -53,7 +50,7 @@ public abstract class AbstractMappingFileRef
* The mapping file corresponding to the ref's file name.
* This can be <code>null</code> if the name is invalid.
*/
- protected MappingFile mappingFile;
+ protected MF mappingFile;
// ********** construction/initialization **********
@@ -86,10 +83,6 @@ public abstract class AbstractMappingFileRef
return this.fileName;
}
- public boolean isFor(IFile file) {
- return (this.mappingFile != null) && file.equals(this.mappingFile.getXmlResource().getFile());
- }
-
protected boolean isIn(IFolder folder) {
return (this.mappingFile != null) && this.mappingFile.isIn(folder);
}
@@ -101,16 +94,13 @@ public abstract class AbstractMappingFileRef
return this.mappingFile;
}
- protected void setMappingFile(MappingFile mappingFile) {
+ protected void setMappingFile(MF mappingFile) {
MappingFile old = this.mappingFile;
this.mappingFile = mappingFile;
this.firePropertyChanged(MAPPING_FILE_PROPERTY, old, mappingFile);
}
- protected MappingFile buildMappingFile() {
- JpaXmlResource xmlResource = this.resolveMappingFileXmlResource();
- return (xmlResource == null) ? null : this.buildMappingFile(xmlResource);
- }
+ protected abstract MF buildMappingFile();
protected void syncMappingFile() {
this.syncMappingFile(true);
@@ -122,23 +112,23 @@ public abstract class AbstractMappingFileRef
* <li>a <em>sync</em> will occur when the file is edited directly;
* and the user could modify something (e.g. the version number) that
* triggers the file being "resolved" or not;
- * see {@link #resolveMappingFileXmlResource()}
+ * see {@link #resolveResourceMappingFile()}
* <li>an <em>update</em> will occur whenever the entire file is added or
* removed
* </ul>
*/
protected void syncMappingFile(boolean sync) {
- JpaXmlResource newXmlResource = this.resolveMappingFileXmlResource();
- if (newXmlResource == null) {
+ Object newResourceMappingFile = this.resolveResourceMappingFile();
+ if (newResourceMappingFile == null) {
if (this.mappingFile != null) {
this.mappingFile.dispose();
this.setMappingFile(null);
}
} else {
if (this.mappingFile == null) {
- this.setMappingFile(this.buildMappingFile(newXmlResource));
+ this.setMappingFile(this.buildMappingFile(newResourceMappingFile));
} else {
- if (this.mappingFile.getXmlResource() == newXmlResource) {
+ if (this.mappingFile.getResourceMappingFile() == newResourceMappingFile) {
if (sync) {
this.mappingFile.synchronizeWithResourceModel();
} else {
@@ -150,49 +140,24 @@ public abstract class AbstractMappingFileRef
// [I have hit this before (had this println uncommmented),
// but I am not sure how... ~kfb]
// [I hit this by deleting the implied orm.xml file and then adding it back, I think
- // it will not be possible to hit it now that I null out the mappingFile is dispose() ~kfb]
+ // it will not be possible to hit it now that I null out the mappingFile in dispose() ~kfb]
// System.out.println("AbstractMappingFileRef.syncMappingFile");
// if the resource's content type has changed, we completely rebuild the mapping file
this.mappingFile.dispose();
- this.setMappingFile(this.buildMappingFile(newXmlResource));
+ this.setMappingFile(this.buildMappingFile(newResourceMappingFile));
}
}
}
}
- /**
- * The mapping file ref resource is in the persistence xml resource
- * (<code>persistence.xml</code>). This returns the resource of
- * the mapping file itself (<code>orm.xml</code>).
- */
- protected JpaXmlResource resolveMappingFileXmlResource() {
- if (this.fileName == null) {
- return null;
- }
- JpaXmlResource xmlResource = this.getJpaProject().getMappingFileXmlResource(new Path(this.fileName));
- if (xmlResource == null) {
- return null;
- }
- if (xmlResource.isReverting()) {
- // 308254 - this can happen when orm.xml is closed without saving;
- // the model is completely whacked in another thread - so wipe our model(?)
- return null;
- }
- JptResourceType resourceType = xmlResource.getResourceType();
- if (resourceType == null) {
- return null;
- }
- if ( ! this.getJpaPlatform().supportsResourceType(resourceType)) {
- return null;
- }
- return xmlResource;
- }
+ protected abstract Object resolveResourceMappingFile();
/**
- * pre-condition: 'xmlResource' is not <code>null</code>
+ * pre-condition: 'resourceMappingFile' is not <code>null</code>
*/
- protected MappingFile buildMappingFile(JpaXmlResource xmlResource) {
- return this.getJpaFactory().buildMappingFile(this, xmlResource);
+ @SuppressWarnings("unchecked")
+ protected MF buildMappingFile(Object resourceMappingFile) {
+ return (MF) this.getJpaFactory().buildMappingFile(this, resourceMappingFile);
}
protected void updateMappingFile() {
@@ -242,7 +207,7 @@ public abstract class AbstractMappingFileRef
}
public MappingFilePersistenceUnitMetadata getPersistenceUnitMetadata() {
- MappingFileRoot root = this.getChildMappingFileRoot();
+ MappingFile.Root root = this.getChildMappingFileRoot();
return (root == null) ? null : root.getPersistenceUnitMetadata();
}
@@ -254,7 +219,7 @@ public abstract class AbstractMappingFileRef
* "mapping file root" contained by the mapping file ref (since, actually,
* the mapping file ref is not even contained by a "mapping file root").
*/
- protected MappingFileRoot getChildMappingFileRoot() {
+ protected MappingFile.Root getChildMappingFileRoot() {
return (this.mappingFile == null) ? null : this.mappingFile.getRoot();
}
@@ -297,14 +262,14 @@ public abstract class AbstractMappingFileRef
}
if (this.mappingFile == null) {
- messages.add(this.buildMappingFileValidationMessage());
+ messages.add(this.buildMissingMappingFileValidationMessage());
return;
}
this.mappingFile.validate(messages, reporter);
}
- protected IMessage buildMappingFileValidationMessage() {
+ protected IMessage buildMissingMappingFileValidationMessage() {
int severity = IMessage.HIGH_SEVERITY;
IFile file = this.getPlatformFile();
if ( ! file.exists()) {
@@ -334,10 +299,7 @@ public abstract class AbstractMappingFileRef
/**
* pre-condition: {@link #getPlatformFile()} exists
*/
- protected boolean mappingFileContentIsUnsupported() {
- JpaXmlResource xmlResource = this.getJpaProject().getMappingFileXmlResource(new Path(this.fileName));
- return (xmlResource != null) && ! this.getJpaPlatform().supportsResourceType(xmlResource.getResourceType());
- }
+ protected abstract boolean mappingFileContentIsUnsupported();
// ********** refactoring **********
@@ -381,4 +343,8 @@ public abstract class AbstractMappingFileRef
}
protected abstract ReplaceEdit createMoveEdit(IFile originalFile, IPath runtineDestination);
+
+ protected boolean isFor(IFile file) {
+ return (this.mappingFile != null) && file.equals(this.mappingFile.getResource());
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractOrmXmlRef.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractOrmXmlRef.java
new file mode 100644
index 0000000000..f7cb337b80
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractOrmXmlRef.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2012 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.jpa.core.internal.context.persistence;
+
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jpt.common.core.JptResourceType;
+import org.eclipse.jpt.jpa.core.context.orm.OrmXml;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
+import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
+
+/**
+ * <code>persistence.xml</code> file
+ * <br>
+ * <code>mapping-file</code> element (when it refers to an
+ * <code>orm.xml</code> file)
+ */
+public abstract class AbstractOrmXmlRef
+ extends AbstractMappingFileRef<OrmXml>
+{
+ protected AbstractOrmXmlRef(PersistenceUnit parent, String fileName) {
+ super(parent, fileName);
+ }
+
+ @Override
+ protected OrmXml buildMappingFile() {
+ JpaXmlResource xmlResource = this.resolveResourceMappingFile();
+ return (xmlResource == null) ? null : this.buildMappingFile(xmlResource);
+ }
+
+ /**
+ * The mapping file ref resource is in the persistence XML resource
+ * (<code>persistence.xml</code>). This returns the resource of
+ * the mapping file itself (<code>orm.xml</code>).
+ */
+ @Override
+ protected JpaXmlResource resolveResourceMappingFile() {
+ if (this.fileName == null) {
+ return null;
+ }
+ JpaXmlResource xmlResource = this.getJpaProject().getMappingFileXmlResource(new Path(this.fileName));
+ if (xmlResource == null) {
+ return null;
+ }
+ if (xmlResource.isReverting()) {
+ // 308254 - this can happen when orm.xml is closed without saving;
+ // the model is completely whacked in another thread - so wipe our model(?)
+ return null;
+ }
+ JptResourceType resourceType = xmlResource.getResourceType();
+ if (resourceType == null) {
+ return null;
+ }
+ if ( ! this.getJpaPlatform().supportsResourceType(resourceType)) {
+ return null;
+ }
+ return xmlResource;
+ }
+
+ @Override
+ protected boolean mappingFileContentIsUnsupported() {
+ JpaXmlResource xmlResource = this.getJpaProject().getMappingFileXmlResource(new Path(this.fileName));
+ return (xmlResource != null) && ! this.getJpaPlatform().supportsResourceType(xmlResource.getResourceType());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceUnit.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceUnit.java
index 6c1e5575d5..6553ee94a9 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceUnit.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceUnit.java
@@ -53,7 +53,6 @@ import org.eclipse.jpt.common.utility.internal.iterables.SubIterableWrapper;
import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.JpaStructureNode;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.AccessType;
import org.eclipse.jpt.jpa.core.context.Embeddable;
import org.eclipse.jpt.jpa.core.context.Entity;
@@ -86,6 +85,7 @@ import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnitTransactionTy
import org.eclipse.jpt.jpa.core.context.persistence.PersistentTypeContainer;
import org.eclipse.jpt.jpa.core.internal.JptCoreMessages;
import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
+import org.eclipse.jpt.jpa.core.internal.plugin.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
import org.eclipse.jpt.jpa.core.jpa2.JpaFactory2_0;
@@ -97,6 +97,7 @@ import org.eclipse.jpt.jpa.core.jpa2.context.persistence.PersistenceUnit2_0;
import org.eclipse.jpt.jpa.core.jpa2.context.persistence.options.SharedCacheMode;
import org.eclipse.jpt.jpa.core.jpa2.context.persistence.options.ValidationMode;
import org.eclipse.jpt.jpa.core.jpql.JpaJpqlQueryHelper;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlJarFileRef;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlJavaClassRef;
@@ -628,7 +629,7 @@ public abstract class AbstractPersistenceUnit
}
protected MappingFileRef buildImpliedMappingFileRef() {
- return this.getContextNodeFactory().buildImpliedMappingFileRef(this);
+ return this.getContextNodeFactory().buildVirtualMappingFileRef(this);
}
protected void syncImpliedMappingFileRef() {
@@ -656,7 +657,7 @@ public abstract class AbstractPersistenceUnit
}
protected boolean impliedMappingFileIsSpecified() {
- return this.mappingFileIsSpecified(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ return this.mappingFileIsSpecified(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
}
protected boolean mappingFileIsSpecified(String impliedMappingFileName) {
@@ -2999,7 +3000,7 @@ public abstract class AbstractPersistenceUnit
try {
return this.getJpaProject().getJavaProject().findType(typeName);
} catch (JavaModelException ex) {
- JptJpaCorePlugin.log(ex);
+ JptJpaCorePlugin.instance().logError(ex);
return null;
}
}
@@ -3008,7 +3009,7 @@ public abstract class AbstractPersistenceUnit
try {
this.deleteMetamodelFile_(file);
} catch (CoreException ex) {
- JptJpaCorePlugin.log(ex);
+ JptJpaCorePlugin.instance().logError(ex);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceXmlContextNodeFactory.java
index 46e333c58d..7d64437126 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceXmlContextNodeFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceXmlContextNodeFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2012 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.
@@ -10,7 +10,6 @@
package org.eclipse.jpt.jpa.core.internal.context.persistence;
import org.eclipse.jpt.common.core.resource.java.JavaResourcePackageFragmentRoot;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.java.JarFile;
import org.eclipse.jpt.jpa.core.context.persistence.ClassRef;
import org.eclipse.jpt.jpa.core.context.persistence.JarFileRef;
@@ -22,11 +21,12 @@ import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXmlContextNodeFac
import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJarFile;
import org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.GenericClassRef;
import org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.GenericJarFileRef;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.GenericMappingFileRef;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.GenericOrmXmlRef;
import org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.GenericPersistence;
import org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.GenericPersistenceUnit;
import org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.GenericPersistenceUnitProperty;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.ImpliedMappingFileRef;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.VirtualOrmXmlRef;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlJarFileRef;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlJavaClassRef;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
@@ -34,9 +34,9 @@ import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistence;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlProperty;
-public abstract class AbstractPersistenceXmlContextNodeFactory implements PersistenceXmlContextNodeFactory
+public abstract class AbstractPersistenceXmlContextNodeFactory
+ implements PersistenceXmlContextNodeFactory
{
-
public Persistence buildPersistence(PersistenceXml parent, XmlPersistence xmlPersistence) {
return new GenericPersistence(parent, xmlPersistence);
}
@@ -46,11 +46,11 @@ public abstract class AbstractPersistenceXmlContextNodeFactory implements Persis
}
public MappingFileRef buildMappingFileRef(PersistenceUnit parent, XmlMappingFileRef xmlMappingFileRef) {
- return new GenericMappingFileRef(parent, xmlMappingFileRef);
+ return new GenericOrmXmlRef(parent, xmlMappingFileRef);
}
- public MappingFileRef buildImpliedMappingFileRef(PersistenceUnit parent) {
- return new ImpliedMappingFileRef(parent, JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ public MappingFileRef buildVirtualMappingFileRef(PersistenceUnit parent) {
+ return new VirtualOrmXmlRef(parent, XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
}
public ClassRef buildClassRef(PersistenceUnit parent, XmlJavaClassRef classRef) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceXmlDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceXmlDefinition.java
index 712ef7e546..f0f83c89bf 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceXmlDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceXmlDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2012 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.
@@ -9,6 +9,9 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.context.persistence;
+import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.jpt.common.core.JptResourceType;
+import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXmlContextNodeFactory;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXmlDefinition;
@@ -35,4 +38,16 @@ public abstract class AbstractPersistenceXmlDefinition
public PersistenceXmlContextNodeFactory getContextNodeFactory() {
return this.factory;
}
+
+
+ // ********** misc **********
+
+ protected JptResourceType getResourceType(IContentType contentType, String version) {
+ return PlatformTools.getResourceType(contentType, version);
+ }
+
+ @Override
+ public String toString() {
+ return this.getClass().getSimpleName();
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetActionDelegate.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetActionDelegate.java
index 69485c5d54..d7bd97da30 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetActionDelegate.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetActionDelegate.java
@@ -1,21 +1,23 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 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
- *******************************************************************************/
+ * Copyright (c) 2009, 2012 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.jpa.core.internal.facet;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.SubMonitor;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.JpaPreferences;
+import org.eclipse.jpt.jpa.core.JpaWorkspace;
import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
+import org.eclipse.jpt.jpa.core.platform.JpaPlatformManager;
import org.eclipse.jst.common.project.facet.core.libprov.LibraryInstallDelegate;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.project.facet.core.IDelegate;
@@ -43,33 +45,41 @@ public abstract class JpaFacetActionDelegate
IDataModel dataModel = (IDataModel) config;
// project settings
- JpaPlatformDescription platform = (JpaPlatformDescription) dataModel.getProperty(PLATFORM);
- JptJpaCorePlugin.setJpaPlatformId(project, platform.getId());
+ JpaPlatformDescription platformDescription = (JpaPlatformDescription) dataModel.getProperty(PLATFORM);
+ JpaPreferences.setJpaPlatformID(project, platformDescription.getId());
subMonitor.worked(1);
// do NOT use IDataModel.getStringProperty(String) - or the connection profile name can
// be set to an empty string - we want it to be null
- JptJpaCorePlugin.setConnectionProfileName(project, (String) dataModel.getProperty(CONNECTION));
+ JpaPreferences.setConnectionProfileName(project, (String) dataModel.getProperty(CONNECTION));
subMonitor.worked(1);
if (dataModel.getBooleanProperty(USER_WANTS_TO_OVERRIDE_DEFAULT_CATALOG)) {
- JptJpaCorePlugin.setUserOverrideDefaultCatalog(project, dataModel.getStringProperty(USER_OVERRIDE_DEFAULT_CATALOG));
+ JpaPreferences.setUserOverrideDefaultCatalog(project, dataModel.getStringProperty(USER_OVERRIDE_DEFAULT_CATALOG));
}
subMonitor.worked(1);
if (dataModel.getBooleanProperty(USER_WANTS_TO_OVERRIDE_DEFAULT_SCHEMA)) {
- JptJpaCorePlugin.setUserOverrideDefaultSchema(project, dataModel.getStringProperty(USER_OVERRIDE_DEFAULT_SCHEMA));
+ JpaPreferences.setUserOverrideDefaultSchema(project, dataModel.getStringProperty(USER_OVERRIDE_DEFAULT_SCHEMA));
}
subMonitor.worked(1);
- JptJpaCorePlugin.setDiscoverAnnotatedClasses(project, dataModel.getBooleanProperty(DISCOVER_ANNOTATED_CLASSES));
+ JpaPreferences.setDiscoverAnnotatedClasses(project, dataModel.getBooleanProperty(DISCOVER_ANNOTATED_CLASSES));
subMonitor.worked(1);
// defaults settings
- JptJpaCorePlugin.setDefaultJpaPlatformId(fv.getVersionString(), platform.getId());
+ this.getJpaPlatformManager().setDefaultJpaPlatformDescription(fv, platformDescription);
subMonitor.worked(1);
//Delegate to LibraryInstallDelegate to configure the project classpath
((LibraryInstallDelegate) dataModel.getProperty(JpaFacetDataModelProperties.LIBRARY_PROVIDER_DELEGATE)).execute(subMonitor.newChild(1));
}
+
+ protected JpaPlatformManager getJpaPlatformManager() {
+ return this.getJpaWorkspace().getJpaPlatformManager();
+ }
+
+ protected JpaWorkspace getJpaWorkspace() {
+ return (JpaWorkspace) ResourcesPlugin.getWorkspace().getAdapter(JpaWorkspace.class);
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetDataModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetDataModelProvider.java
index 9c20df0ae4..24b6725975 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetDataModelProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetDataModelProvider.java
@@ -1,13 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 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
- *******************************************************************************/
+ * Copyright (c) 2009, 2012 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.jpa.core.internal.facet;
import java.util.ArrayList;
@@ -16,30 +15,29 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
import org.eclipse.jpt.common.utility.internal.ArrayTools;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.jpa.core.JpaFacet;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.JpaProject;
+import org.eclipse.jpt.jpa.core.JpaWorkspace;
import org.eclipse.jpt.jpa.core.internal.JptCoreMessages;
+import org.eclipse.jpt.jpa.core.internal.plugin.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.libprov.JpaLibraryProviderInstallOperationConfig;
import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
+import org.eclipse.jpt.jpa.core.platform.JpaPlatformManager;
import org.eclipse.jpt.jpa.db.Catalog;
import org.eclipse.jpt.jpa.db.ConnectionProfile;
import org.eclipse.jpt.jpa.db.ConnectionProfileFactory;
import org.eclipse.jpt.jpa.db.Database;
import org.eclipse.jpt.jpa.db.DatabaseIdentifierAdapter;
-import org.eclipse.jpt.jpa.db.JptJpaDbPlugin;
import org.eclipse.jpt.jpa.db.SchemaContainer;
import org.eclipse.jst.common.project.facet.core.libprov.ILibraryProvider;
import org.eclipse.jst.common.project.facet.core.libprov.IPropertyChangeListener;
import org.eclipse.jst.common.project.facet.core.libprov.LibraryInstallDelegate;
import org.eclipse.jst.common.project.facet.core.libprov.LibraryProviderOperationConfig;
-import org.eclipse.osgi.util.NLS;
import org.eclipse.wst.common.componentcore.datamodel.FacetInstallDataModelProvider;
import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
import org.eclipse.wst.common.frameworks.datamodel.DataModelPropertyDescriptor;
@@ -55,18 +53,6 @@ public abstract class JpaFacetDataModelProvider
{
protected static final String EJB_FACET_ID = IModuleConstants.JST_EJB_MODULE;
- protected static final IStatus PLATFORM_NOT_SPECIFIED_STATUS =
- buildErrorStatus(JptCoreMessages.VALIDATE_PLATFORM_NOT_SPECIFIED);
-
- protected static final IStatus CONNECTION_NOT_CONNECTED_STATUS =
- buildInfoStatus(JptCoreMessages.VALIDATE_CONNECTION_NOT_CONNECTED);
-
- protected static final IStatus USER_OVERRIDE_DEFAULT_CATALOG_NOT_SPECIFIED_STATUS =
- buildErrorStatus(JptCoreMessages.VALIDATE_DEFAULT_CATALOG_NOT_SPECIFIED);
-
- protected static final IStatus USER_OVERRIDE_DEFAULT_SCHEMA_NOT_SPECIFIED_STATUS =
- buildErrorStatus(JptCoreMessages.VALIDATE_DEFAULT_SCHEMA_NOT_SPECIFIED);
-
private LibraryInstallDelegate defaultLibraryProvider;
@@ -175,13 +161,13 @@ public abstract class JpaFacetDataModelProvider
@Override
public Object getDefaultProperty(String propertyName) {
if (propertyName.equals(FACET_ID)) {
- return JpaFacet.ID;
+ return JpaProject.FACET_ID;
}
if (propertyName.equals(RUNTIME)) {
return null;
}
if (propertyName.equals(PLATFORM)) {
- return getDefaultPlatform();
+ return getDefaultPlatformDescription();
}
if (propertyName.equals(LIBRARY_PROVIDER_DELEGATE)) {
return getDefaultLibraryProvider();
@@ -214,7 +200,7 @@ public abstract class JpaFacetDataModelProvider
return super.getDefaultProperty(propertyName);
}
- protected abstract JpaPlatformDescription getDefaultPlatform();
+ protected abstract JpaPlatformDescription getDefaultPlatformDescription();
protected LibraryInstallDelegate getDefaultLibraryProvider() {
// delegate itself changes only when facet version changes
@@ -468,13 +454,7 @@ public abstract class JpaFacetDataModelProvider
}
protected Iterable<JpaPlatformDescription> buildValidPlatformDescriptions() {
- return new FilteringIterable<JpaPlatformDescription>(
- JptJpaCorePlugin.getJpaPlatformManager().getJpaPlatforms()) {
- @Override
- protected boolean accept(JpaPlatformDescription o) {
- return o.supportsJpaFacetVersion(getProjectFacetVersion());
- }
- };
+ return this.getJpaPlatformManager().getJpaPlatformDescriptions(this.getProjectFacetVersion());
}
protected static final Comparator<DataModelPropertyDescriptor> DESCRIPTOR_COMPARATOR =
@@ -569,10 +549,6 @@ public abstract class JpaFacetDataModelProvider
return new DataModelPropertyDescriptor(platform, platform.getLabel());
}
- protected String getPlatformLabel(String platformId) {
- return JptJpaCorePlugin.getJpaPlatformManager().getJpaPlatform(platformId).getLabel();
- }
-
protected DataModelPropertyDescriptor buildConnectionDescriptor(String connectionName) {
String description = (connectionName == null) ? JptCoreMessages.NONE : null;
return new DataModelPropertyDescriptor(connectionName, description);
@@ -642,7 +618,7 @@ public abstract class JpaFacetDataModelProvider
protected ConnectionProfileFactory getConnectionProfileFactory() {
// we don't have a JPA project yet, so go to the db plug-in directly to get the factory
- return JptJpaDbPlugin.getConnectionProfileFactory();
+ return (ConnectionProfileFactory) ResourcesPlugin.getWorkspace().getAdapter(ConnectionProfileFactory.class);
}
@@ -675,7 +651,9 @@ public abstract class JpaFacetDataModelProvider
}
protected IStatus validatePlatform() {
- return (this.getPlatform() == null) ? PLATFORM_NOT_SPECIFIED_STATUS : OK_STATUS;
+ return (this.getPlatform() == null) ?
+ JptJpaCorePlugin.instance().buildErrorStatus(JptCoreMessages.VALIDATE_PLATFORM_NOT_SPECIFIED) :
+ OK_STATUS;
}
protected IStatus validateConnection() {
@@ -686,10 +664,10 @@ public abstract class JpaFacetDataModelProvider
protected IStatus validateNonNullConnection(String connectionName) {
ConnectionProfile cp = this.getConnectionProfile(connectionName);
if (cp == null) {
- return buildErrorStatus(NLS.bind(JptCoreMessages.VALIDATE_CONNECTION_INVALID, connectionName));
+ return JptJpaCorePlugin.instance().buildErrorStatus(JptCoreMessages.VALIDATE_CONNECTION_INVALID, connectionName);
}
if ( ! cp.isActive()) {
- return CONNECTION_NOT_CONNECTED_STATUS;
+ return JptJpaCorePlugin.instance().buildStatus(IStatus.INFO, JptCoreMessages.VALIDATE_CONNECTION_NOT_CONNECTED);
}
return OK_STATUS;
}
@@ -697,7 +675,7 @@ public abstract class JpaFacetDataModelProvider
protected IStatus validateUserOverrideDefaultCatalog() {
if (this.userWantsToOverrideDefaultCatalog()) {
if (this.getUserOverrideDefaultCatalog() == null) {
- return USER_OVERRIDE_DEFAULT_CATALOG_NOT_SPECIFIED_STATUS;
+ return JptJpaCorePlugin.instance().buildErrorStatus(JptCoreMessages.VALIDATE_DEFAULT_CATALOG_NOT_SPECIFIED);
}
}
return OK_STATUS;
@@ -706,7 +684,7 @@ public abstract class JpaFacetDataModelProvider
protected IStatus validateUserOverrideDefaultSchema() {
if (this.userWantsToOverrideDefaultSchema()) {
if (this.getUserOverrideDefaultSchema() == null) {
- return USER_OVERRIDE_DEFAULT_SCHEMA_NOT_SPECIFIED_STATUS;
+ return JptJpaCorePlugin.instance().buildErrorStatus(JptCoreMessages.VALIDATE_DEFAULT_SCHEMA_NOT_SPECIFIED);
}
}
return OK_STATUS;
@@ -719,22 +697,14 @@ public abstract class JpaFacetDataModelProvider
}
- // ********** static methods **********
-
- protected static IStatus buildInfoStatus(String message) {
- return buildStatus(IStatus.INFO, message);
- }
-
-// private static IStatus buildWarningStatus(String message) {
-// return buildStatus(IStatus.WARNING, message);
-// }
+ // ********** misc **********
- protected static IStatus buildErrorStatus(String message) {
- return buildStatus(IStatus.ERROR, message);
+ protected JpaPlatformManager getJpaPlatformManager() {
+ return this.getJpaWorkspace().getJpaPlatformManager();
}
-
- protected static IStatus buildStatus(int severity, String message) {
- return new Status(severity, JptJpaCorePlugin.PLUGIN_ID, message);
+
+ protected JpaWorkspace getJpaWorkspace() {
+ return (JpaWorkspace) ResourcesPlugin.getWorkspace().getAdapter(JpaWorkspace.class);
}
@Override
@@ -743,5 +713,4 @@ public abstract class JpaFacetDataModelProvider
this.defaultLibraryProvider.removeListener(this.libraryProviderListener);
this.defaultLibraryProvider.dispose();
}
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetInstallDataModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetInstallDataModelProvider.java
index a70e069003..eac5aa4fab 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetInstallDataModelProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetInstallDataModelProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2012 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.
@@ -11,7 +11,6 @@ package org.eclipse.jpt.jpa.core.internal.facet;
import java.util.Set;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
import org.eclipse.jpt.jpa.db.ConnectionProfile;
import org.eclipse.jpt.jpa.db.Database;
@@ -84,8 +83,8 @@ public class JpaFacetInstallDataModelProvider
}
@Override
- protected JpaPlatformDescription getDefaultPlatform() {
- return JptJpaCorePlugin.getDefaultJpaPlatform(getProjectFacetVersion());
+ protected JpaPlatformDescription getDefaultPlatformDescription() {
+ return this.getJpaPlatformManager().getDefaultJpaPlatformDescription(this.getProjectFacetVersion());
}
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetInstallDelegate.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetInstallDelegate.java
index 81073a58a1..8dd1959846 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetInstallDelegate.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetInstallDelegate.java
@@ -12,6 +12,7 @@ package org.eclipse.jpt.jpa.core.internal.facet;
import static org.eclipse.jpt.common.core.internal.operations.JptFileCreationDataModelProperties.CONTAINER_PATH;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -22,10 +23,10 @@ import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jpt.common.core.resource.ProjectResourceLocator;
import org.eclipse.jpt.common.utility.internal.ArrayTools;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.internal.operations.OrmFileCreationDataModelProvider;
import org.eclipse.jpt.jpa.core.internal.operations.PersistenceFileCreationDataModelProvider;
-import org.eclipse.jpt.jpa.db.JptJpaDbPlugin;
+import org.eclipse.jpt.jpa.core.internal.plugin.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.db.ConnectionProfileFactory;
import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
@@ -70,27 +71,24 @@ public class JpaFacetInstallDelegate
}
String driverName = dataModel.getStringProperty(DB_DRIVER_NAME);
- IClasspathContainer container = JptJpaDbPlugin.instance().buildDriverClasspathContainerFor(driverName);
+ IClasspathContainer container = this.getConnectionProfileFactory().buildDriverClasspathContainer(driverName);
IClasspathEntry entry = JavaCore.newContainerEntry(container.getPath());
this.addClasspathEntryToProject(entry, javaProject, monitor);
}
+ private ConnectionProfileFactory getConnectionProfileFactory() {
+ return (ConnectionProfileFactory) ResourcesPlugin.getWorkspace().getAdapter(ConnectionProfileFactory.class);
+ }
+
private void addClasspathEntryToProject(
IClasspathEntry classpathEntry, IJavaProject javaProject, IProgressMonitor monitor)
throws CoreException {
- // if the classpathEntry is already there, do nothing
+ // add the classpath entry to the classpath if it is not already present
IClasspathEntry[] classpath = javaProject.getRawClasspath();
- if (ArrayTools.contains(classpath, classpathEntry)) {
- return;
+ if ( ! ArrayTools.contains(classpath, classpathEntry)) {
+ javaProject.setRawClasspath(ArrayTools.add(classpath, classpathEntry), monitor);
}
-
- // add the given classpathEntry to the project classpath
- int len = classpath.length;
- IClasspathEntry[] newClasspath = new IClasspathEntry[len + 1];
- System.arraycopy(classpath, 0, newClasspath, 0, len);
- newClasspath[len] = classpathEntry;
- javaProject.setRawClasspath(newClasspath, monitor);
}
private void createProjectXml(IProject project, boolean buildOrmXml, IProgressMonitor monitor) {
@@ -113,7 +111,7 @@ public class JpaFacetInstallDelegate
try {
config.getDefaultOperation().execute(sm.newChild(4), null);
} catch (ExecutionException ex) {
- JptJpaCorePlugin.log(ex);
+ JptJpaCorePlugin.instance().logError(ex);
}
}
@@ -127,14 +125,14 @@ public class JpaFacetInstallDelegate
try {
config.getDefaultOperation().execute(sm.newChild(4), null);
} catch (ExecutionException ex) {
- JptJpaCorePlugin.log(ex);
+ JptJpaCorePlugin.instance().logError(ex);
}
}
protected IPath defaultResourceLocation(IProject project) {
ProjectResourceLocator resourceLocator = (ProjectResourceLocator) project.getAdapter(ProjectResourceLocator.class);
if (resourceLocator == null) {
- JptJpaCorePlugin.log("No resource locator for project: " + project); //$NON-NLS-1$
+ JptJpaCorePlugin.instance().logError("No resource locator for project: " + project); //$NON-NLS-1$
return null;
}
return resourceLocator.getDefaultResourceLocation().getFullPath();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetUninstallDelegate.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetUninstallDelegate.java
index 60ed303a78..44dfd7be52 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetUninstallDelegate.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetUninstallDelegate.java
@@ -14,20 +14,16 @@ import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.prefs.JpaValidationPreferencesManager;
+import org.eclipse.jpt.jpa.core.JpaPreferences;
import org.eclipse.wst.common.project.facet.core.IDelegate;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
public class JpaFacetUninstallDelegate
implements IDelegate
{
- public void execute(IProject project, IProjectFacetVersion fv,
- Object config, IProgressMonitor monitor) throws CoreException {
-
- (new JpaValidationPreferencesManager(project)).clearProjectPreferences();
+ public void execute(IProject project, IProjectFacetVersion fv, Object config, IProgressMonitor monitor) throws CoreException {
+ JpaPreferences.removePreferences(project);
removeBuilder(project, STATIC_WEAVING_BUILDER_ID);
- JptJpaCorePlugin.clearProjectPersistentProperties(project);
}
//TODO hack to fix bug 380735 in RC2. We need to move this code into the eclipselink plug-in
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetVersionChangeDataModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetVersionChangeDataModelProvider.java
index e7540f9fa3..a2b4b0b5cc 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetVersionChangeDataModelProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetVersionChangeDataModelProvider.java
@@ -16,15 +16,12 @@ import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.internal.JptCoreMessages;
+import org.eclipse.jpt.jpa.core.internal.plugin.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
public class JpaFacetVersionChangeDataModelProvider
extends JpaFacetDataModelProvider
{
- protected static final IStatus PLATFORM_DOES_NOT_SUPPORT_FACET_VERSION_STATUS =
- buildErrorStatus(JptCoreMessages.VALIDATE_PLATFORM_DOES_NOT_SUPPORT_FACET_VERSION);
-
-
/**
* required default constructor
*/
@@ -58,7 +55,7 @@ public class JpaFacetVersionChangeDataModelProvider
// **************** defaults **********************************************
@Override
- protected JpaPlatformDescription getDefaultPlatform() {
+ protected JpaPlatformDescription getDefaultPlatformDescription() {
return getJpaProject().getJpaPlatform().getDescription();
}
@@ -111,8 +108,8 @@ public class JpaFacetVersionChangeDataModelProvider
protected Iterable<JpaPlatformDescription> buildValidPlatformDescriptions() {
// add existing platform to list of choices
Iterable<JpaPlatformDescription> validPlatformDescs = super.buildValidPlatformDescriptions();
- if (! CollectionTools.contains(validPlatformDescs, getDefaultPlatform())) {
- validPlatformDescs = new CompositeIterable<JpaPlatformDescription>(getDefaultPlatform(), validPlatformDescs);
+ if (! CollectionTools.contains(validPlatformDescs, getDefaultPlatformDescription())) {
+ validPlatformDescs = new CompositeIterable<JpaPlatformDescription>(getDefaultPlatformDescription(), validPlatformDescs);
}
return validPlatformDescs;
}
@@ -126,7 +123,7 @@ public class JpaFacetVersionChangeDataModelProvider
if (status.isOK()) {
if (! getPlatform().supportsJpaFacetVersion(getProjectFacetVersion())) {
- status = PLATFORM_DOES_NOT_SUPPORT_FACET_VERSION_STATUS;
+ status = JptJpaCorePlugin.instance().buildErrorStatus(JptCoreMessages.VALIDATE_PLATFORM_DOES_NOT_SUPPORT_FACET_VERSION);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetVersionChangeDelegate.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetVersionChangeDelegate.java
index c4a3e907a3..a15dba8220 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetVersionChangeDelegate.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetVersionChangeDelegate.java
@@ -13,10 +13,9 @@ import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.internal.plugin.JptJpaCorePlugin;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
public class JpaFacetVersionChangeDelegate
@@ -39,7 +38,7 @@ public class JpaFacetVersionChangeDelegate
this.rebuildJpaProject_(project);
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
- throw new CoreException(new Status(IStatus.CANCEL, JptJpaCorePlugin.PLUGIN_ID, null, ex));
+ throw new CoreException(JptJpaCorePlugin.instance().buildStatus(IStatus.CANCEL, ex));
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/RuntimeChangedListener.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/RuntimeChangedListener.java
index 21bfef97e2..2ac49588b1 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/RuntimeChangedListener.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/RuntimeChangedListener.java
@@ -14,9 +14,8 @@ import java.util.Map;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jpt.jpa.core.JpaFacet;
import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.internal.plugin.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.libprov.JpaLibraryProviderInstallOperationConfig;
import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
import org.eclipse.jst.common.project.facet.core.libprov.LibraryInstallDelegate;
@@ -34,7 +33,7 @@ public class RuntimeChangedListener
if (fpb == null) {
fpb = facetedProjectEvent.getProject();
}
- IProjectFacetVersion pfv = fpb.getProjectFacetVersion(JpaFacet.FACET);
+ IProjectFacetVersion pfv = fpb.getProjectFacetVersion(JpaProject.FACET);
if (pfv != null) {
Map<String, Object> enablementVariables = new HashMap<String, Object>();
enablementVariables.put(JpaLibraryProviderInstallOperationConfig.JPA_PLATFORM_ENABLEMENT_EXP, getJpaPlatformId(fpb.getProject()));
@@ -44,7 +43,7 @@ public class RuntimeChangedListener
lp.execute(new NullProgressMonitor());
}
catch (CoreException ce) {
- JptJpaCorePlugin.log(ce);
+ JptJpaCorePlugin.instance().logError(ce);
}
finally {
lp.dispose();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/GenericJpaDataSource.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/GenericJpaDataSource.java
index a35e675b89..cbf2d31ce3 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/GenericJpaDataSource.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/GenericJpaDataSource.java
@@ -10,9 +10,10 @@
package org.eclipse.jpt.jpa.core.internal.jpa1;
import org.eclipse.jpt.jpa.core.JpaDataSource;
+import org.eclipse.jpt.jpa.core.JpaPreferences;
import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.internal.AbstractJpaNode;
+import org.eclipse.jpt.jpa.core.internal.plugin.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.db.ConnectionAdapter;
import org.eclipse.jpt.jpa.db.ConnectionListener;
import org.eclipse.jpt.jpa.db.ConnectionProfile;
@@ -95,7 +96,7 @@ public class GenericJpaDataSource
if (this.firePropertyChanged(CONNECTION_PROFILE_NAME_PROPERTY, old, name)) {
// sync the connection profile when the name changes
this.setConnectionProfile(this.buildConnectionProfile(name));
- JptJpaCorePlugin.setConnectionProfileName(this.getJpaProject().getProject(), name);
+ JpaPreferences.setConnectionProfileName(this.getJpaProject().getProject(), name);
}
}
@@ -121,6 +122,7 @@ public class GenericJpaDataSource
}
public void dispose() {
+ this.setConnectionProfileName(null);
if (this.connectionProfile != null) {
this.connectionProfile.removeConnectionListener(this.connectionListener);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericRootContextNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericRootContextNode.java
index 0632f7460c..b838bce793 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericRootContextNode.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericRootContextNode.java
@@ -21,8 +21,7 @@ import org.eclipse.jpt.common.core.resource.java.JavaResourceAbstractType;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.HashBag;
import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.context.MappingFileRoot;
+import org.eclipse.jpt.jpa.core.context.MappingFile;
import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
@@ -32,6 +31,7 @@ import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
import org.eclipse.jpt.jpa.core.jpa2.MetamodelSynchronizer;
import org.eclipse.jpt.jpa.core.jpa2.context.JpaRootContextNode2_0;
import org.eclipse.jpt.jpa.core.jpa2.context.persistence.PersistenceXml2_0;
+import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistence;
import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
import org.eclipse.jst.j2ee.model.internal.validation.ValidationCancelledException;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
@@ -195,7 +195,7 @@ public class GenericRootContextNode
}
@Override
- public MappingFileRoot getMappingFileRoot() {
+ public MappingFile.Root getMappingFileRoot() {
return null;
}
@@ -267,11 +267,11 @@ public class GenericRootContextNode
}
protected IFile getPlatformFile() {
- return this.jpaProject.getPlatformFile(JptJpaCorePlugin.DEFAULT_PERSISTENCE_XML_RUNTIME_PATH);
+ return this.jpaProject.getPlatformFile(XmlPersistence.DEFAULT_RUNTIME_PATH);
}
protected void validateOrphanClasses(List<IMessage> messages) {
- Persistence persistence = this.persistenceXml.getPersistence();
+ Persistence persistence = this.persistenceXml.getRoot();
if (persistence == null) {
return; // handled with other validation
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJarFile.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJarFile.java
index 1b9a7609a5..e761fcca68 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJarFile.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJarFile.java
@@ -12,8 +12,8 @@ package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
import java.util.List;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
import org.eclipse.jpt.common.core.JptResourceType;
+import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
import org.eclipse.jpt.common.core.resource.java.JavaResourceAbstractType;
import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement.Kind;
import org.eclipse.jpt.common.core.resource.java.JavaResourcePackageFragmentRoot;
@@ -98,7 +98,7 @@ public class GenericJarFile
@Override
public JptResourceType getResourceType() {
- return JptCommonCorePlugin.JAR_RESOURCE_TYPE;
+ return PlatformTools.getResourceType(JavaResourcePackageFragmentRoot.JAR_CONTENT_TYPE);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmXml.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmXml.java
index 860afb83dc..35f61e1944 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmXml.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmXml.java
@@ -21,15 +21,17 @@ import org.eclipse.jpt.common.utility.internal.Tools;
import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
import org.eclipse.jpt.jpa.core.JpaFile;
import org.eclipse.jpt.jpa.core.JpaStructureNode;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.Generator;
+import org.eclipse.jpt.jpa.core.context.MappingFile;
import org.eclipse.jpt.jpa.core.context.Query;
+import org.eclipse.jpt.jpa.core.context.XmlFile;
import org.eclipse.jpt.jpa.core.context.orm.EntityMappings;
import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
import org.eclipse.jpt.jpa.core.context.orm.OrmXml;
import org.eclipse.jpt.jpa.core.context.orm.OrmXmlDefinition;
import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef;
import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
+import org.eclipse.jpt.jpa.core.resource.ResourceMappingFile;
import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
import org.eclipse.text.edits.DeleteEdit;
@@ -168,8 +170,7 @@ public class GenericOrmXml
return this.resourceType;
}
- @Override
- public OrmXmlDefinition getMappingFileDefinition() {
+ public OrmXmlDefinition getDefinition() {
return this.definition;
}
@@ -187,7 +188,9 @@ public class GenericOrmXml
protected void setRoot(EntityMappings root) {
EntityMappings old = this.root;
this.root = root;
- this.firePropertyChanged(ROOT_PROPERTY, old, root);
+ // dual-purpose state!
+ this.firePropertyChanged(XmlFile.ROOT_PROPERTY, old, root);
+ this.firePropertyChanged(MappingFile.ROOT_PROPERTY, old, root);
}
protected EntityMappings buildRoot(XmlEntityMappings xmlEntityMappings) {
@@ -212,7 +215,7 @@ public class GenericOrmXml
if (resource == null) {
throw new NullPointerException();
}
- if ( ! resource.getContentType().isKindOf(JptJpaCorePlugin.MAPPING_FILE_CONTENT_TYPE)) {
+ if ( ! resource.getContentType().isKindOf(ResourceMappingFile.Root.CONTENT_TYPE)) {
throw new IllegalArgumentException("Content type is not 'mapping file': " + resource); //$NON-NLS-1$
}
}
@@ -231,6 +234,20 @@ public class GenericOrmXml
return this.getJpaFile(this.xmlResource.getFile());
}
+ /**
+ * All the the <code>orm.xml</code> objects go up through the containment
+ * hierarchy to the mapping file root (entity mappings);
+ * but we are "above" the entity mappings here, so simply return itself.
+ */
+ @Override
+ protected OrmXml getOrmXml() {
+ return this;
+ }
+
+ public JpaXmlResource getXmlResource() {
+ return this.xmlResource;
+ }
+
public boolean isLatestSupportedVersion() {
return XmlFile_.isLatestSupportedVersion(this);
}
@@ -286,7 +303,7 @@ public class GenericOrmXml
// ********** MappingFile implementation **********
- public JpaXmlResource getXmlResource() {
+ public Object getResourceMappingFile() {
return this.xmlResource;
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmXmlDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmXmlDefinition.java
index af8d7cc6c7..ce7af75ea8 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmXmlDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmXmlDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2012 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.
@@ -13,7 +13,6 @@ import java.util.ArrayList;
import org.eclipse.emf.ecore.EFactory;
import org.eclipse.jpt.common.core.JptResourceType;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.orm.NullOrmAttributeMappingDefinition;
import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition;
import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
@@ -31,7 +30,9 @@ import org.eclipse.jpt.jpa.core.internal.context.orm.OrmOneToManyMappingDefiniti
import org.eclipse.jpt.jpa.core.internal.context.orm.OrmOneToOneMappingDefinition;
import org.eclipse.jpt.jpa.core.internal.context.orm.OrmTransientMappingDefinition;
import org.eclipse.jpt.jpa.core.internal.context.orm.OrmVersionMappingDefinition;
+import org.eclipse.jpt.jpa.core.resource.orm.JPA;
import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
public class GenericOrmXmlDefinition
extends AbstractOrmXmlDefinition
@@ -55,7 +56,7 @@ public class GenericOrmXmlDefinition
}
public JptResourceType getResourceType() {
- return JptJpaCorePlugin.ORM_XML_1_0_RESOURCE_TYPE;
+ return this.getResourceType(XmlEntityMappings.CONTENT_TYPE, JPA.SCHEMA_VERSION);
}
public EFactory getResourceNodeFactory() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericClassRef.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericClassRef.java
index 2114da89c9..dcfcf414f0 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericClassRef.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericClassRef.java
@@ -20,13 +20,13 @@ import org.eclipse.jpt.common.utility.internal.Tools;
import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable;
import org.eclipse.jpt.jpa.core.JpaStructureNode;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.AccessType;
import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
import org.eclipse.jpt.jpa.core.context.persistence.ClassRef;
import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceXmlContextNode;
+import org.eclipse.jpt.jpa.core.internal.plugin.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlJavaClassRef;
@@ -375,7 +375,7 @@ public class GenericClassRef
try {
this.javaPersistentType.validate(messages, reporter);
} catch (Throwable t) {
- JptJpaCorePlugin.log(t);
+ JptJpaCorePlugin.instance().logError(t);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericMappingFileRef.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericOrmXmlRef.java
index 5d5b555a53..d771a87dcc 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericMappingFileRef.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericOrmXmlRef.java
@@ -18,7 +18,7 @@ import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractMappingFileRef;
+import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractOrmXmlRef;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
import org.eclipse.text.edits.DeleteEdit;
import org.eclipse.text.edits.ReplaceEdit;
@@ -28,13 +28,13 @@ import org.eclipse.text.edits.ReplaceEdit;
* <br>
* <code>mapping-file</code> element
*/
-public class GenericMappingFileRef
- extends AbstractMappingFileRef
+public class GenericOrmXmlRef
+ extends AbstractOrmXmlRef
{
protected final XmlMappingFileRef xmlMappingFileRef;
- public GenericMappingFileRef(PersistenceUnit parent, XmlMappingFileRef xmlMappingFileRef) {
+ public GenericOrmXmlRef(PersistenceUnit parent, XmlMappingFileRef xmlMappingFileRef) {
super(parent, xmlMappingFileRef.getFileName());
this.xmlMappingFileRef = xmlMappingFileRef;
}
@@ -75,7 +75,7 @@ public class GenericMappingFileRef
return this.xmlMappingFileRef;
}
- public boolean isImplied() {
+ public boolean isDefault() {
return false;
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistence.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistence.java
index 636afafeca..2b1a38b8a8 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistence.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistence.java
@@ -18,7 +18,6 @@ import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
import org.eclipse.jpt.jpa.core.JpaStructureNode;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
@@ -285,7 +284,7 @@ public class GenericPersistence
protected String getLatestDocumentVersion() {
return this.getJpaPlatform().getMostRecentSupportedResourceType(
- JptJpaCorePlugin.PERSISTENCE_XML_CONTENT_TYPE).getVersion();
+ XmlPersistence.CONTENT_TYPE).getVersion();
}
/**
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceXml.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceXml.java
index a721ea88e6..c63ec9fe0f 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceXml.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceXml.java
@@ -18,7 +18,6 @@ import org.eclipse.jpt.common.core.JptResourceType;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.jpa.core.JpaFile;
import org.eclipse.jpt.jpa.core.JpaStructureNode;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.JpaRootContextNode;
import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
@@ -54,7 +53,7 @@ public class GenericPersistenceXml
/**
* The root element of the <code>persistence.xml</code> file.
*/
- protected Persistence persistence;
+ protected Persistence root;
public GenericPersistenceXml(JpaRootContextNode parent, JpaXmlResource xmlResource) {
@@ -65,7 +64,7 @@ public class GenericPersistenceXml
XmlPersistence xmlPersistence = (XmlPersistence) xmlResource.getRootObject();
if (xmlPersistence != null) {
- this.persistence = this.buildPersistence(xmlPersistence);
+ this.root = this.buildRoot(xmlPersistence);
}
}
@@ -108,7 +107,7 @@ public class GenericPersistenceXml
* when resource contents replaced from history EMF unloads the resource.
*/
protected void syncPersistence(boolean sync) {
- XmlPersistence oldXmlPersistence = (this.persistence == null) ? null : this.persistence.getXmlPersistence();
+ XmlPersistence oldXmlPersistence = (this.root == null) ? null : this.root.getXmlPersistence();
XmlPersistence newXmlPersistence = (XmlPersistence) this.xmlResource.getRootObject();
JptResourceType newResourceType = this.xmlResource.getResourceType();
@@ -120,25 +119,25 @@ public class GenericPersistenceXml
(newXmlPersistence == null) ||
this.valuesAreDifferent(this.resourceType, newResourceType)
) {
- if (this.persistence != null) {
+ if (this.root != null) {
this.unregisterRootStructureNode();
- this.persistence.dispose();
- this.setPersistence(null);
+ this.root.dispose();
+ this.setRoot(null);
}
}
this.resourceType = newResourceType;
if (newXmlPersistence != null) {
- if (this.persistence == null) {
- this.setPersistence(this.buildPersistence(newXmlPersistence));
+ if (this.root == null) {
+ this.setRoot(this.buildRoot(newXmlPersistence));
} else {
// the context persistence already holds the XML persistence
if (sync) {
- this.persistence.synchronizeWithResourceModel();
+ this.root.synchronizeWithResourceModel();
}
else {
- this.persistence.update();
+ this.root.update();
// this will happen redundantly - need to hold JpaFile?
this.registerRootStructureNode();
}
@@ -149,17 +148,17 @@ public class GenericPersistenceXml
// ********** persistence **********
- public Persistence getPersistence() {
- return this.persistence;
+ public Persistence getRoot() {
+ return this.root;
}
- protected void setPersistence(Persistence persistence) {
- Persistence old = this.persistence;
- this.persistence = persistence;
- this.firePropertyChanged(PERSISTENCE_PROPERTY, old, persistence);
+ protected void setRoot(Persistence persistence) {
+ Persistence old = this.root;
+ this.root = persistence;
+ this.firePropertyChanged(ROOT_PROPERTY, old, persistence);
}
- protected Persistence buildPersistence(XmlPersistence xmlPersistence) {
+ protected Persistence buildRoot(XmlPersistence xmlPersistence) {
return this.getContextNodeFactory().buildPersistence(this, xmlPersistence);
}
@@ -170,7 +169,7 @@ public class GenericPersistenceXml
if (resource == null) {
throw new NullPointerException();
}
- if ( ! resource.getContentType().isKindOf(JptJpaCorePlugin.PERSISTENCE_XML_CONTENT_TYPE)) {
+ if ( ! resource.getContentType().isKindOf(XmlPersistence.CONTENT_TYPE)) {
throw new IllegalArgumentException("Content type is not 'persistence': " + resource); //$NON-NLS-1$
}
}
@@ -201,20 +200,20 @@ public class GenericPersistenceXml
// ********** metamodel **********
public void initializeMetamodel() {
- if (this.persistence != null) {
- ((Persistence2_0) this.persistence).initializeMetamodel();
+ if (this.root != null) {
+ ((Persistence2_0) this.root).initializeMetamodel();
}
}
public IStatus synchronizeMetamodel(IProgressMonitor monitor) {
- return (this.persistence != null) ?
- ((Persistence2_0) this.persistence).synchronizeMetamodel(monitor) :
+ return (this.root != null) ?
+ ((Persistence2_0) this.root).synchronizeMetamodel(monitor) :
Status.OK_STATUS;
}
public void disposeMetamodel() {
- if (this.persistence != null) {
- ((Persistence2_0) this.persistence).disposeMetamodel();
+ if (this.root != null) {
+ ((Persistence2_0) this.root).disposeMetamodel();
}
}
@@ -230,8 +229,8 @@ public class GenericPersistenceXml
}
public JpaStructureNode getStructureNode(int textOffset) {
- if (this.persistence.containsOffset(textOffset)) {
- return this.persistence.getStructureNode(textOffset);
+ if (this.root.containsOffset(textOffset)) {
+ return this.root.getStructureNode(textOffset);
}
return this;
}
@@ -242,22 +241,22 @@ public class GenericPersistenceXml
}
public void dispose() {
- if (this.persistence != null) {
+ if (this.root != null) {
JpaFile jpaFile = this.getJpaFile();
if (jpaFile != null) {
this.unregisterRootStructureNode();
}
- this.persistence.dispose();
+ this.root.dispose();
}
}
// TODO hold the JpaFile?
protected void registerRootStructureNode() {
- this.getJpaFile().addRootStructureNode(this.xmlResource, this.persistence);
+ this.getJpaFile().addRootStructureNode(this.xmlResource, this.root);
}
protected void unregisterRootStructureNode() {
- this.getJpaFile().removeRootStructureNode(this.xmlResource, this.persistence);
+ this.getJpaFile().removeRootStructureNode(this.xmlResource, this.root);
}
@@ -267,7 +266,7 @@ public class GenericPersistenceXml
public void validate(List<IMessage> messages, IReporter reporter) {
super.validate(messages, reporter);
- if (this.persistence == null) {
+ if (this.root == null) {
messages.add(
DefaultJpaValidationMessages.buildMessage(
IMessage.HIGH_SEVERITY,
@@ -278,7 +277,7 @@ public class GenericPersistenceXml
return;
}
- this.persistence.validate(messages, reporter);
+ this.root.validate(messages, reporter);
}
public TextRange getValidationTextRange() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceXmlDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceXmlDefinition.java
index 57d9a22b6e..f32e320aaa 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceXmlDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceXmlDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2012 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.
@@ -11,12 +11,13 @@ package org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence;
import org.eclipse.emf.ecore.EFactory;
import org.eclipse.jpt.common.core.JptResourceType;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXmlContextNodeFactory;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXmlDefinition;
import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceXmlDefinition;
import org.eclipse.jpt.jpa.core.internal.context.persistence.GenericPersistenceXmlContextNodeFactory;
+import org.eclipse.jpt.jpa.core.resource.persistence.JPA;
import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
+import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistence;
public class GenericPersistenceXmlDefinition
extends AbstractPersistenceXmlDefinition
@@ -40,7 +41,7 @@ public class GenericPersistenceXmlDefinition
}
public JptResourceType getResourceType() {
- return JptJpaCorePlugin.PERSISTENCE_XML_1_0_RESOURCE_TYPE;
+ return this.getResourceType(XmlPersistence.CONTENT_TYPE, JPA.SCHEMA_VERSION);
}
public EFactory getResourceNodeFactory() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/ImpliedMappingFileRef.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/VirtualOrmXmlRef.java
index dca36559d9..76103f3770 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/ImpliedMappingFileRef.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/VirtualOrmXmlRef.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 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.
@@ -15,7 +15,7 @@ import org.eclipse.core.runtime.IPath;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractMappingFileRef;
+import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractOrmXmlRef;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
import org.eclipse.text.edits.DeleteEdit;
import org.eclipse.text.edits.ReplaceEdit;
@@ -25,13 +25,13 @@ import org.eclipse.text.edits.ReplaceEdit;
* <code>META-INF/orm.xml</code> file when it is not explicitly listed
* in the <code>persistence.xml</code> file.
*/
-public class ImpliedMappingFileRef
- extends AbstractMappingFileRef
+public class VirtualOrmXmlRef
+ extends AbstractOrmXmlRef
{
// ********** construction/initialization **********
- public ImpliedMappingFileRef(PersistenceUnit parent, String fileName) {
+ public VirtualOrmXmlRef(PersistenceUnit parent, String fileName) {
super(parent, fileName);
}
@@ -42,7 +42,7 @@ public class ImpliedMappingFileRef
throw new UnsupportedOperationException();
}
- public boolean isImplied() {
+ public boolean isDefault() {
return true;
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaPlatformFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaPlatformFactory.java
index e647b07bd5..3d60c81881 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaPlatformFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaPlatformFactory.java
@@ -10,14 +10,14 @@
package org.eclipse.jpt.jpa.core.internal.jpa2;
import org.eclipse.jpt.common.core.JptResourceType;
-import org.eclipse.jpt.jpa.core.JpaFacet;
import org.eclipse.jpt.jpa.core.JpaPlatform;
import org.eclipse.jpt.jpa.core.JpaPlatformFactory;
import org.eclipse.jpt.jpa.core.JpaPlatformVariation;
import org.eclipse.jpt.jpa.core.context.AccessType;
import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatform;
-import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatformFactory.SimpleVersion;
+import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatformFactory.GenericJpaPlatformVersion;
import org.eclipse.jpt.jpa.core.internal.JpaAnnotationProvider;
+import org.eclipse.jpt.jpa.core.jpa2.JpaProject2_0;
import org.eclipse.persistence.jpa.jpql.parser.JPQLGrammar2_0;
/**
@@ -27,6 +27,8 @@ import org.eclipse.persistence.jpa.jpql.parser.JPQLGrammar2_0;
public class Generic2_0JpaPlatformFactory
implements JpaPlatformFactory
{
+ public static final String ID = "generic2_0"; //$NON-NLS-1$
+
/**
* zero-argument constructor
*/
@@ -46,7 +48,7 @@ public class Generic2_0JpaPlatformFactory
}
private JpaPlatform.Version buildJpaVersion() {
- return new SimpleVersion(JpaFacet.VERSION_2_0.getVersionString());
+ return new GenericJpaPlatformVersion(JpaProject2_0.FACET_VERSION_STRING);
}
protected JpaPlatformVariation buildJpaPlatformVariation() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaPlatformProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaPlatformProvider.java
index 6e3847bb5a..03f0a8684f 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaPlatformProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaPlatformProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2012 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.
@@ -10,13 +10,10 @@
package org.eclipse.jpt.jpa.core.internal.jpa2;
import java.util.ArrayList;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
import org.eclipse.jpt.common.core.JptResourceType;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.jpa.core.JpaPlatformProvider;
import org.eclipse.jpt.jpa.core.JpaResourceModelProvider;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.ResourceDefinition;
import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition;
import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
@@ -26,6 +23,8 @@ import org.eclipse.jpt.jpa.core.internal.JarResourceModelProvider;
import org.eclipse.jpt.jpa.core.internal.JavaResourceModelProvider;
import org.eclipse.jpt.jpa.core.internal.OrmResourceModelProvider;
import org.eclipse.jpt.jpa.core.internal.PersistenceResourceModelProvider;
+import org.eclipse.jpt.jpa.core.internal.context.java.JarDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.java.JavaSourceFileDefinition;
import org.eclipse.jpt.jpa.core.internal.context.java.JavaTransientMappingDefinition;
import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmXmlDefinition;
import org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.GenericPersistenceXmlDefinition;
@@ -43,7 +42,7 @@ import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.JavaOneToManyMappingD
import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.JavaOneToOneMappingDefinition2_0;
import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.JavaVersionMappingDefinition2_0;
import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.GenericOrmXml2_0Definition;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence.Generic2_0PersistenceXmlDefinition;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence.GenericPersistenceXml2_0Definition;
/**
* All the state in the JPA platform should be "static" (i.e. unchanging once
@@ -62,7 +61,6 @@ public class Generic2_0JpaPlatformProvider
return INSTANCE;
}
-
/**
* Enforce singleton usage
*/
@@ -73,24 +71,19 @@ public class Generic2_0JpaPlatformProvider
// ********** resource models **********
- public JptResourceType getMostRecentSupportedResourceType(IContentType contentType) {
- if (contentType.equals(JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE)) {
- return JptCommonCorePlugin.JAVA_SOURCE_RESOURCE_TYPE;
- }
- else if (contentType.equals(JptCommonCorePlugin.JAR_CONTENT_TYPE)) {
- return JptCommonCorePlugin.JAR_RESOURCE_TYPE;
- }
- else if (contentType.equals(JptJpaCorePlugin.PERSISTENCE_XML_CONTENT_TYPE)) {
- return JptJpaCorePlugin.PERSISTENCE_XML_2_0_RESOURCE_TYPE;
- }
- else if (contentType.equals(JptJpaCorePlugin.ORM_XML_CONTENT_TYPE)) {
- return JptJpaCorePlugin.ORM_XML_2_0_RESOURCE_TYPE;
- }
- else {
- throw new IllegalArgumentException(contentType.toString());
- }
+ @Override
+ protected void addMostRecentSupportedResourceTypesTo(ArrayList<JptResourceType> types) {
+ CollectionTools.addAll(types, MOST_RECENT_SUPPORTED_RESOURCE_TYPES);
}
+ // order should not be important here
+ protected static final JptResourceType[] MOST_RECENT_SUPPORTED_RESOURCE_TYPES = new JptResourceType[] {
+ JavaSourceFileDefinition.instance().getResourceType(),
+ JarDefinition.instance().getResourceType(),
+ GenericPersistenceXml2_0Definition.instance().getResourceType(),
+ GenericOrmXml2_0Definition.instance().getResourceType()
+ };
+
@Override
protected void addResourceModelProvidersTo(ArrayList<JpaResourceModelProvider> providers) {
CollectionTools.addAll(providers, RESOURCE_MODEL_PROVIDERS);
@@ -162,8 +155,10 @@ public class Generic2_0JpaPlatformProvider
}
protected static final ResourceDefinition[] RESOURCE_DEFINITIONS = new ResourceDefinition[] {
+ JavaSourceFileDefinition.instance(),
+ JarDefinition.instance(),
GenericPersistenceXmlDefinition.instance(),
- Generic2_0PersistenceXmlDefinition.instance(),
+ GenericPersistenceXml2_0Definition.instance(),
GenericOrmXmlDefinition.instance(),
GenericOrmXml2_0Definition.instance()
};
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericJpaDatabaseIdentifierAdapter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericJpaDatabaseIdentifierAdapter.java
index ba5dcfefa7..4576e42d05 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericJpaDatabaseIdentifierAdapter.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericJpaDatabaseIdentifierAdapter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2012 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.
@@ -59,7 +59,7 @@ public class GenericJpaDatabaseIdentifierAdapter
protected Persistence getPersistence() {
PersistenceXml pxml = this.getPersistenceXml();
- return (pxml == null) ? null : pxml.getPersistence();
+ return (pxml == null) ? null : pxml.getRoot();
}
protected PersistenceXml getPersistenceXml() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericMetamodelSynchronizer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericMetamodelSynchronizer.java
index ecd2df254e..20a160fbd4 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericMetamodelSynchronizer.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericMetamodelSynchronizer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2012 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.
@@ -26,10 +26,10 @@ import org.eclipse.jpt.common.core.utility.BodySourceWriter;
import org.eclipse.jpt.common.utility.internal.ClassName;
import org.eclipse.jpt.common.utility.internal.SimpleStack;
import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.AttributeMapping;
import org.eclipse.jpt.jpa.core.context.PersistentType;
import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
+import org.eclipse.jpt.jpa.core.internal.plugin.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.jpa2.JpaProject2_0;
import org.eclipse.jpt.jpa.core.jpa2.MetamodelSynchronizer;
import org.eclipse.jpt.jpa.core.jpa2.context.AttributeMapping2_0;
@@ -70,7 +70,7 @@ public class GenericMetamodelSynchronizer
try {
this.synchronize_(memberTypeTree);
} catch (JavaModelException ex) {
- JptJpaCorePlugin.log(ex);
+ JptJpaCorePlugin.instance().logError(ex);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmXml2_0Definition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmXml2_0Definition.java
index 9bc31297fc..eda279e0fa 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmXml2_0Definition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmXml2_0Definition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2012 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.
@@ -13,7 +13,6 @@ import java.util.ArrayList;
import org.eclipse.emf.ecore.EFactory;
import org.eclipse.jpt.common.core.JptResourceType;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.orm.NullOrmAttributeMappingDefinition;
import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition;
import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
@@ -31,6 +30,8 @@ import org.eclipse.jpt.jpa.core.internal.context.orm.OrmTransientMappingDefiniti
import org.eclipse.jpt.jpa.core.internal.context.orm.OrmVersionMappingDefinition;
import org.eclipse.jpt.jpa.core.internal.jpa2.Generic2_0JpaPlatformProvider;
import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
+import org.eclipse.jpt.jpa.core.resource.orm.v2_0.JPA2_0;
public class GenericOrmXml2_0Definition
extends AbstractOrmXmlDefinition
@@ -54,7 +55,7 @@ public class GenericOrmXml2_0Definition
}
public JptResourceType getResourceType() {
- return JptJpaCorePlugin.ORM_XML_2_0_RESOURCE_TYPE;
+ return this.getResourceType(XmlEntityMappings.CONTENT_TYPE, JPA2_0.SCHEMA_VERSION);
}
public EFactory getResourceNodeFactory() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/Generic2_0PersistenceXmlDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/GenericPersistenceXml2_0Definition.java
index c2ea049fd9..f0f4111a9d 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/Generic2_0PersistenceXmlDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/GenericPersistenceXml2_0Definition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2012 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.
@@ -11,17 +11,18 @@ package org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence;
import org.eclipse.emf.ecore.EFactory;
import org.eclipse.jpt.common.core.JptResourceType;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXmlContextNodeFactory;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXmlDefinition;
import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceXmlDefinition;
+import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistence;
+import org.eclipse.jpt.jpa.core.resource.persistence.v2_0.JPA2_0;
import org.eclipse.jpt.jpa.core.resource.persistence.v2_0.PersistenceV2_0Factory;
-public class Generic2_0PersistenceXmlDefinition
+public class GenericPersistenceXml2_0Definition
extends AbstractPersistenceXmlDefinition
{
// singleton
- private static final PersistenceXmlDefinition INSTANCE = new Generic2_0PersistenceXmlDefinition();
+ private static final PersistenceXmlDefinition INSTANCE = new GenericPersistenceXml2_0Definition();
/**
* Return the singleton
@@ -34,12 +35,12 @@ public class Generic2_0PersistenceXmlDefinition
/**
* Enforce singleton usage
*/
- private Generic2_0PersistenceXmlDefinition() {
+ private GenericPersistenceXml2_0Definition() {
super();
}
public JptResourceType getResourceType() {
- return JptJpaCorePlugin.PERSISTENCE_XML_2_0_RESOURCE_TYPE;
+ return this.getResourceType(XmlPersistence.CONTENT_TYPE, JPA2_0.SCHEMA_VERSION);
}
public EFactory getResourceNodeFactory() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libprov/JpaLibraryProviderInstallOperationConfigAdapterFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libprov/JpaLibraryProviderInstallOperationConfigAdapterFactory.java
index 8d8a1b22da..f7b86100a8 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libprov/JpaLibraryProviderInstallOperationConfigAdapterFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libprov/JpaLibraryProviderInstallOperationConfigAdapterFactory.java
@@ -17,7 +17,7 @@ import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
* Factory to build Dali adapters for an {@link JpaLibraryProviderInstallOperationConfig}:<ul>
* <li>{@link JpaPlatformDescription}
* </ul>
- * See <code>org.eclipse.jpt.jpa.core/plugin.xml</code>.
+ * See <code>org.eclipse.jpt.jpa.core/plugin.xml:org.eclipse.core.runtime.adapters</code>.
*/
public class JpaLibraryProviderInstallOperationConfigAdapterFactory
implements IAdapterFactory
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libprov/LegacyJpaLibraryProviderDetector.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libprov/LegacyJpaLibraryProviderDetector.java
index 1a7c1eca30..2dd83a7017 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libprov/LegacyJpaLibraryProviderDetector.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libprov/LegacyJpaLibraryProviderDetector.java
@@ -1,17 +1,16 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 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
- *******************************************************************************/
+ * Copyright (c) 2009, 2012 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.jpa.core.internal.libprov;
import org.eclipse.core.resources.IProject;
-import org.eclipse.jpt.jpa.core.JpaFacet;
+import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jst.common.project.facet.core.libprov.ILibraryProvider;
import org.eclipse.jst.common.project.facet.core.libprov.LegacyLibraryProviderDetector;
import org.eclipse.jst.common.project.facet.core.libprov.LibraryProviderFramework;
@@ -27,7 +26,7 @@ public class LegacyJpaLibraryProviderDetector
@Override
public ILibraryProvider detect(
final IProject project, final IProjectFacet facet) {
- if (facet.equals(JpaFacet.FACET)) {
+ if (facet.equals(JpaProject.FACET)) {
return LibraryProviderFramework.getProvider(LEGACY_JPA_LIBRARY_PROVIDER_ID);
}
return null;
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libval/AbstractOsgiBundlesLibraryValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libval/AbstractOsgiBundlesLibraryValidator.java
index 71e7bf352b..a233a8cb53 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libval/AbstractOsgiBundlesLibraryValidator.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libval/AbstractOsgiBundlesLibraryValidator.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2010 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
- *******************************************************************************/
+ * Copyright (c) 2010, 2012 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.jpa.core.internal.libval;
import java.util.HashMap;
@@ -14,12 +14,11 @@ import java.util.Map;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jpt.common.core.libval.LibraryValidator;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.internal.JptCoreMessages;
import org.eclipse.jpt.jpa.core.internal.libprov.JpaOsgiBundlesLibraryProviderInstallOperationConfig;
+import org.eclipse.jpt.jpa.core.internal.plugin.JptJpaCorePlugin;
import org.eclipse.jst.common.project.facet.core.libprov.osgi.BundleReference;
import org.eclipse.osgi.service.resolver.VersionRange;
-import org.eclipse.osgi.util.NLS;
import org.osgi.framework.Bundle;
public abstract class AbstractOsgiBundlesLibraryValidator
@@ -42,9 +41,7 @@ public abstract class AbstractOsgiBundlesLibraryValidator
for (String bundleName : bundleVersionRanges.keySet()) {
if (bundles.get(bundleName) == null) {
- String message
- = NLS.bind(JptCoreMessages.OSGI_BUNDLES_LIBRARY_VALIDATOR__BUNDLE_NOT_FOUND, bundleName);
- return new Status(IStatus.ERROR, JptJpaCorePlugin.PLUGIN_ID, message);
+ return JptJpaCorePlugin.instance().buildErrorStatus(JptCoreMessages.OSGI_BUNDLES_LIBRARY_VALIDATOR__BUNDLE_NOT_FOUND, bundleName);
}
}
@@ -52,9 +49,7 @@ public abstract class AbstractOsgiBundlesLibraryValidator
Bundle bundle = bundles.get(bundleName);
for (VersionRange versionRange : bundleVersionRanges.get(bundleName)) {
if (! versionRange.isIncluded(bundle.getVersion())) {
- String message
- = NLS.bind(JptCoreMessages.OSGI_BUNDLES_LIBRARY_VALIDATOR__IMPROPER_BUNDLE_VERSION, bundleName);
- return new Status(IStatus.ERROR, JptJpaCorePlugin.PLUGIN_ID, message);
+ return JptJpaCorePlugin.instance().buildErrorStatus(JptCoreMessages.OSGI_BUNDLES_LIBRARY_VALIDATOR__IMPROPER_BUNDLE_VERSION, bundleName);
}
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libval/GenericEclipseLinkBundlesLibraryValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libval/GenericEclipseLinkBundlesLibraryValidator.java
index 93e8012aab..9f424d7af8 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libval/GenericEclipseLinkBundlesLibraryValidator.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libval/GenericEclipseLinkBundlesLibraryValidator.java
@@ -1,20 +1,21 @@
/*******************************************************************************
- * Copyright (c) 2010, 2011 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
- *******************************************************************************/
+ * Copyright (c) 2010, 2012 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.jpa.core.internal.libval;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jpt.common.core.libprov.JptLibraryProviderInstallOperationConfig;
-import org.eclipse.jpt.jpa.core.JpaFacet;
+import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.internal.libprov.JpaOsgiBundlesLibraryProviderInstallOperationConfig;
+import org.eclipse.jpt.jpa.core.jpa2.JpaProject2_0;
import org.eclipse.osgi.service.resolver.VersionRange;
public class GenericEclipseLinkBundlesLibraryValidator
@@ -26,10 +27,10 @@ public class GenericEclipseLinkBundlesLibraryValidator
Map<String, VersionRange[]> bundleVersionRanges = new HashMap<String, VersionRange[]>();
String bundleName = "javax.persistence"; //$NON-NLS-1$
VersionRange[] versionRanges = new VersionRange[0];
- if (config.getProjectFacetVersion().equals(JpaFacet.VERSION_1_0)) {
+ if (config.getProjectFacetVersion().equals(JpaProject.FACET_VERSION)) {
versionRanges = new VersionRange[] {new VersionRange("[1.0, 3.0)")}; //$NON-NLS-1$
}
- else if (config.getProjectFacetVersion().equals(JpaFacet.VERSION_2_0)) {
+ else if (config.getProjectFacetVersion().equals(JpaProject2_0.FACET_VERSION)) {
versionRanges = new VersionRange[] {new VersionRange("[2.0, 3.0)")}; //$NON-NLS-1$
}
bundleVersionRanges.put(bundleName, versionRanges);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libval/GenericJpaUserLibraryValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libval/GenericJpaUserLibraryValidator.java
index 6c7c9de652..49f394a710 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libval/GenericJpaUserLibraryValidator.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libval/GenericJpaUserLibraryValidator.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2010, 2011 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
- *******************************************************************************/
+ * Copyright (c) 2010, 2012 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.jpa.core.internal.libval;
import java.util.HashSet;
@@ -18,8 +18,8 @@ import org.eclipse.jpt.common.core.internal.libval.LibValUtil;
import org.eclipse.jpt.common.core.libprov.JptLibraryProviderInstallOperationConfig;
import org.eclipse.jpt.common.core.libval.LibraryValidator;
import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.jpa.core.JpaFacet;
import org.eclipse.jpt.jpa.core.internal.libprov.JpaUserLibraryProviderInstallOperationConfig;
+import org.eclipse.jpt.jpa.core.jpa2.JpaProject2_0;
public class GenericJpaUserLibraryValidator
implements LibraryValidator {
@@ -29,7 +29,7 @@ public class GenericJpaUserLibraryValidator
= (JpaUserLibraryProviderInstallOperationConfig) config;
Set<String> classNames = new HashSet<String>();
classNames.add("javax.persistence.Entity"); //$NON-NLS-1$
- if (config.getProjectFacetVersion().compareTo(JpaFacet.VERSION_2_0) >= 0) {
+ if (config.getProjectFacetVersion().compareTo(JpaProject2_0.FACET_VERSION) >= 0) {
classNames.add("javax.persistence.ElementCollection"); //$NON-NLS-1$
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/AbstractJpaFileCreationDataModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/AbstractJpaFileCreationDataModelProvider.java
index 843f652d24..56363b9543 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/AbstractJpaFileCreationDataModelProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/AbstractJpaFileCreationDataModelProvider.java
@@ -12,15 +12,21 @@ package org.eclipse.jpt.jpa.core.internal.operations;
import java.util.Set;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.jpt.common.core.internal.operations.AbstractJptFileCreationDataModelProvider;
+import org.eclipse.jpt.common.core.internal.utility.ProjectTools;
import org.eclipse.jpt.common.core.resource.ProjectResourceLocator;
-import org.eclipse.jpt.jpa.core.JpaFacet;
+import org.eclipse.jpt.jpa.core.JpaPlatform;
+import org.eclipse.jpt.jpa.core.JpaPreferences;
import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.JpaWorkspace;
import org.eclipse.jpt.jpa.core.internal.JptCoreMessages;
+import org.eclipse.jpt.jpa.core.internal.plugin.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.platform.JpaPlatformManager;
import org.eclipse.wst.common.project.facet.core.IFacetedProject;
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
@@ -48,7 +54,35 @@ public abstract class AbstractJpaFileCreationDataModelProvider
return super.getDefaultProperty(propertyName);
}
- protected abstract String getDefaultVersion();
+ protected final String getDefaultVersion() {
+ IProject project = this.getProject();
+ if (project == null) {
+ return null;
+ }
+ JpaProject jpaProject = this.getJpaProject_(project);
+ JpaPlatform jpaPlatform = (jpaProject != null) ? jpaProject.getJpaPlatform() : this.getJpaPlatform();
+ return jpaPlatform.getMostRecentSupportedResourceType(this.getContentType()).getVersion();
+ }
+
+ protected abstract IContentType getContentType();
+
+ protected JpaPlatform getJpaPlatform() {
+ IProject project = this.getProject();
+ if (project == null) {
+ return null;
+ }
+ String jpaPlatformID = JpaPreferences.getJpaPlatformID(project);
+ return this.getJpaPlatformManager().getJpaPlatform(jpaPlatformID);
+ }
+
+ protected JpaPlatformManager getJpaPlatformManager() {
+ return this.getJpaWorkspace().getJpaPlatformManager();
+ }
+
+ protected JpaWorkspace getJpaWorkspace() {
+ return (JpaWorkspace) ResourcesPlugin.getWorkspace().getAdapter(JpaWorkspace.class);
+ }
+
// **************** validation *********************************************
@@ -77,24 +111,18 @@ public abstract class AbstractJpaFileCreationDataModelProvider
return status;
}
IContainer container = getContainer();
- IProject project = getProject(container);
- if (! JpaFacet.isInstalled(project)) {
+ IProject project = (container == null) ? null : container.getProject();
+ if ( ! ProjectTools.hasFacet(project, JpaProject.FACET)) {
// verifies project has jpa facet
- return new Status(
- IStatus.ERROR, JptJpaCorePlugin.PLUGIN_ID,
- JptCoreMessages.VALIDATE_PROJECT_NOT_JPA);
+ return JptJpaCorePlugin.instance().buildErrorStatus(JptCoreMessages.VALIDATE_PROJECT_NOT_JPA);
}
if (! hasSupportedPlatform(project)) {
// verifies project has platform that supports this file type
- return new Status(
- IStatus.ERROR, JptJpaCorePlugin.PLUGIN_ID,
- JptCoreMessages.VALIDATE_PROJECT_IMPROPER_PLATFORM);
+ return JptJpaCorePlugin.instance().buildErrorStatus(JptCoreMessages.VALIDATE_PROJECT_IMPROPER_PLATFORM);
}
ProjectResourceLocator resourceLocator = (ProjectResourceLocator) project.getAdapter(ProjectResourceLocator.class);
if ( ! resourceLocator.resourceLocationIsValid(container)) {
- return new Status(
- IStatus.WARNING, JptJpaCorePlugin.PLUGIN_ID,
- JptCoreMessages.VALIDATE_CONTAINER_QUESTIONABLE);
+ return JptJpaCorePlugin.instance().buildWarningStatus(JptCoreMessages.VALIDATE_CONTAINER_QUESTIONABLE);
}
return Status.OK_STATUS;
}
@@ -105,16 +133,12 @@ public abstract class AbstractJpaFileCreationDataModelProvider
}
String fileVersion = getStringProperty(VERSION);
if (! fileVersionSupported(fileVersion)) {
- return new Status(
- IStatus.ERROR, JptJpaCorePlugin.PLUGIN_ID,
- JptCoreMessages.VALIDATE_FILE_VERSION_NOT_SUPPORTED);
+ return JptJpaCorePlugin.instance().buildErrorStatus(JptCoreMessages.VALIDATE_FILE_VERSION_NOT_SUPPORTED);
}
try {
String jpaFacetVersion = getJpaFacetVersion(getProject());
if (! fileVersionSupportedForFacetVersion(fileVersion, jpaFacetVersion)) {
- return new Status(
- IStatus.ERROR, JptJpaCorePlugin.PLUGIN_ID,
- JptCoreMessages.VALIDATE_FILE_VERSION_NOT_SUPPORTED_FOR_FACET_VERSION);
+ return JptJpaCorePlugin.instance().buildErrorStatus(JptCoreMessages.VALIDATE_FILE_VERSION_NOT_SUPPORTED_FOR_FACET_VERSION);
}
}
catch (CoreException ce) {
@@ -132,7 +156,7 @@ public abstract class AbstractJpaFileCreationDataModelProvider
// **************** helper methods *****************************************
protected JpaProject getJpaProject() {
- return getJpaProject(getProject());
+ return this.getJpaProject(this.getProject());
}
protected JpaProject getJpaProject(IProject project) {
@@ -149,20 +173,18 @@ public abstract class AbstractJpaFileCreationDataModelProvider
}
protected JpaProject.Reference getJpaProjectReference(IProject project) {
- return ((JpaProject.Reference) project.getAdapter(JpaProject.Reference.class));
+ return (JpaProject.Reference) project.getAdapter(JpaProject.Reference.class);
}
protected String getJpaFacetVersion(IProject project) throws CoreException {
IFacetedProject fproj = ProjectFacetsManager.create(project);
- return fproj.getProjectFacetVersion(JpaFacet.FACET).getVersionString();
+ return fproj.getProjectFacetVersion(JpaProject.FACET).getVersionString();
}
protected boolean hasSupportedPlatform(IProject project) {
JpaProject jpaProject = this.getJpaProject(project);
- return (jpaProject != null) && isSupportedPlatformId(jpaProject.getJpaPlatform().getId());
+ return (jpaProject != null) && this.platformIsSupported(jpaProject.getJpaPlatform());
}
- protected boolean isSupportedPlatformId(@SuppressWarnings("unused") String id) {
- return true;
- }
+ protected abstract boolean platformIsSupported(JpaPlatform jpaPlatform);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/AbstractJpaFileCreationOperation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/AbstractJpaFileCreationOperation.java
index f2a551d710..bb87485034 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/AbstractJpaFileCreationOperation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/AbstractJpaFileCreationOperation.java
@@ -27,7 +27,8 @@ import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.resource.AbstractXmlResourceProvider;
+import org.eclipse.jpt.jpa.core.internal.resource.xml.AbstractJpaXmlResourceProvider;
+import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResourceProvider;
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
@@ -126,7 +127,7 @@ public abstract class AbstractJpaFileCreationOperation
protected void createFile(IProgressMonitor monitor) throws ExecutionException {
String fileName = getDataModel().getStringProperty(FILE_NAME);
IFile newFile = this.container.getFile(new Path(fileName));
- AbstractXmlResourceProvider resourceProvider = getXmlResourceProvider(newFile);
+ JpaXmlResourceProvider resourceProvider = getXmlResourceProvider(newFile);
try {
resourceProvider.createFileAndResource(getDataModel(), monitor);
}
@@ -145,5 +146,5 @@ public abstract class AbstractJpaFileCreationOperation
}
}
- protected abstract AbstractXmlResourceProvider getXmlResourceProvider(IFile file);
+ protected abstract JpaXmlResourceProvider getXmlResourceProvider(IFile file);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/OrmFileCreationDataModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/OrmFileCreationDataModelProvider.java
index 473d491cac..7832df09de 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/OrmFileCreationDataModelProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/OrmFileCreationDataModelProvider.java
@@ -1,35 +1,34 @@
/*******************************************************************************
- * Copyright (c) 2008, 2012 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
- *******************************************************************************/
+ * Copyright (c) 2008, 2012 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.jpa.core.internal.operations;
import java.util.Set;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.jpt.common.utility.internal.ArrayTools;
import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.jpa.core.JpaFacet;
import org.eclipse.jpt.jpa.core.JpaPlatform;
import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
import org.eclipse.jpt.jpa.core.internal.JptCoreMessages;
+import org.eclipse.jpt.jpa.core.internal.plugin.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.resource.orm.AccessType;
import org.eclipse.jpt.jpa.core.resource.orm.JPA;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.orm.v2_0.JPA2_0;
-import org.eclipse.osgi.util.NLS;
import org.eclipse.wst.common.frameworks.datamodel.DataModelPropertyDescriptor;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
@@ -87,20 +86,12 @@ public class OrmFileCreationDataModelProvider
@Override
protected String getDefaultFileName() {
- return JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.lastSegment();
+ return XmlEntityMappings.DEFAULT_RUNTIME_PATH.lastSegment();
}
@Override
- protected String getDefaultVersion() {
- if (getProject() == null) {
- return null;
- }
- JpaPlatform jpaPlatform;
- JpaProject jpaProject = getJpaProject();
- jpaPlatform = (jpaProject == null)
- ? JptJpaCorePlugin.getJpaPlatformManager().buildJpaPlatformImplementation(getProject())
- : jpaProject.getJpaPlatform();
- return jpaPlatform.getMostRecentSupportedResourceType(JptJpaCorePlugin.ORM_XML_CONTENT_TYPE).getVersion();
+ protected IContentType getContentType() {
+ return XmlEntityMappings.CONTENT_TYPE;
}
protected PersistenceUnit getDefaultPersistenceUnit() {
@@ -112,7 +103,7 @@ public class OrmFileCreationDataModelProvider
if (persistenceXml == null) {
return null;
}
- Persistence persistence = persistenceXml.getPersistence();
+ Persistence persistence = persistenceXml.getRoot();
if (persistence == null) {
return null;
}
@@ -211,7 +202,7 @@ public class OrmFileCreationDataModelProvider
@Override
protected boolean fileVersionSupportedForFacetVersion(String fileVersion, String jpaFacetVersion) {
- if (jpaFacetVersion.equals(JpaFacet.VERSION_1_0.getVersionString())
+ if (jpaFacetVersion.equals(JpaProject.FACET_VERSION_STRING)
&& fileVersion.equals(JPA2_0.SCHEMA_VERSION)) {
return false;
}
@@ -224,14 +215,10 @@ public class OrmFileCreationDataModelProvider
String pUnitName = getStringProperty(PERSISTENCE_UNIT);
if (addToPUnit) {
if (StringTools.stringIsEmpty(pUnitName)) {
- return new Status(
- IStatus.ERROR, JptJpaCorePlugin.PLUGIN_ID,
- NLS.bind(JptCoreMessages.VALIDATE_PERSISTENCE_UNIT_DOES_NOT_SPECIFIED, pUnitName));
+ return JptJpaCorePlugin.instance().buildErrorStatus(JptCoreMessages.VALIDATE_PERSISTENCE_UNIT_DOES_NOT_SPECIFIED, pUnitName);
}
if (getPersistenceUnit() == null) {
- return new Status(
- IStatus.ERROR, JptJpaCorePlugin.PLUGIN_ID,
- NLS.bind(JptCoreMessages.VALIDATE_PERSISTENCE_UNIT_NOT_IN_PROJECT, pUnitName, projectName));
+ return JptJpaCorePlugin.instance().buildErrorStatus(JptCoreMessages.VALIDATE_PERSISTENCE_UNIT_NOT_IN_PROJECT, pUnitName, projectName);
}
}
return Status.OK_STATUS;
@@ -247,7 +234,7 @@ public class OrmFileCreationDataModelProvider
PersistenceXml persistenceXml =
(jpaProject == null) ? null : jpaProject.getRootContextNode().getPersistenceXml();
Persistence persistence =
- (persistenceXml == null) ? null : persistenceXml.getPersistence();
+ (persistenceXml == null) ? null : persistenceXml.getRoot();
if (persistence != null) {
for (PersistenceUnit next : persistence.getPersistenceUnits()) {
if (pUnitName.equals(next.getName())) {
@@ -263,7 +250,7 @@ public class OrmFileCreationDataModelProvider
//if no jpa project is selected, then no persistence units will be listed in the combo
JpaProject jpaProject = getJpaProject();
PersistenceXml persistenceXml = (jpaProject == null) ? null : jpaProject.getRootContextNode().getPersistenceXml();
- Persistence persistence = (persistenceXml == null) ? null : persistenceXml.getPersistence();
+ Persistence persistence = (persistenceXml == null) ? null : persistenceXml.getRoot();
return (persistence == null) ? EmptyIterable.<PersistenceUnit>instance() : persistence.getPersistenceUnits();
}
@@ -275,4 +262,9 @@ public class OrmFileCreationDataModelProvider
}
};
}
+
+ @Override
+ protected boolean platformIsSupported(JpaPlatform jpaPlatform) {
+ return true;
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/OrmFileCreationOperation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/OrmFileCreationOperation.java
index 3244c83a38..65184949ba 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/OrmFileCreationOperation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/OrmFileCreationOperation.java
@@ -26,7 +26,7 @@ import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
import org.eclipse.jpt.jpa.core.internal.resource.orm.OrmXmlResourceProvider;
-import org.eclipse.jpt.jpa.core.resource.AbstractXmlResourceProvider;
+import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResourceProvider;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
public class OrmFileCreationOperation
@@ -58,7 +58,7 @@ public class OrmFileCreationOperation
if (persistenceXml == null) {
throw new ExecutionException("Project does not have a persistence.xml file"); //$NON-NLS-1$
}
- Persistence persistence = persistenceXml.getPersistence();
+ Persistence persistence = persistenceXml.getRoot();
if (persistence == null) {
throw new ExecutionException("persistence.xml does not have a persistence node."); //$NON-NLS-1$
}
@@ -100,7 +100,7 @@ public class OrmFileCreationOperation
}
@Override
- protected AbstractXmlResourceProvider getXmlResourceProvider(IFile file) {
+ protected JpaXmlResourceProvider getXmlResourceProvider(IFile file) {
return OrmXmlResourceProvider.getXmlResourceProvider(file);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/PersistenceFileCreationDataModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/PersistenceFileCreationDataModelProvider.java
index 506f97545a..b6fa490043 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/PersistenceFileCreationDataModelProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/PersistenceFileCreationDataModelProvider.java
@@ -1,20 +1,19 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 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
- *******************************************************************************/
+ * Copyright (c) 2009, 2012 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.jpa.core.internal.operations;
-import org.eclipse.jpt.jpa.core.JpaFacet;
+import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.jpt.jpa.core.JpaPlatform;
import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.resource.persistence.JPA;
+import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistence;
import org.eclipse.jpt.jpa.core.resource.persistence.v2_0.JPA2_0;
import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
@@ -37,20 +36,12 @@ public class PersistenceFileCreationDataModelProvider
@Override
protected String getDefaultFileName() {
- return JptJpaCorePlugin.DEFAULT_PERSISTENCE_XML_RUNTIME_PATH.lastSegment();
+ return XmlPersistence.DEFAULT_RUNTIME_PATH.lastSegment();
}
@Override
- protected String getDefaultVersion() {
- if (getProject() == null) {
- return null;
- }
- JpaPlatform jpaPlatform;
- JpaProject jpaProject = getJpaProject();
- jpaPlatform = (jpaProject == null)
- ? JptJpaCorePlugin.getJpaPlatformManager().buildJpaPlatformImplementation(getProject())
- : jpaProject.getJpaPlatform();
- return jpaPlatform.getMostRecentSupportedResourceType(JptJpaCorePlugin.PERSISTENCE_XML_CONTENT_TYPE).getVersion();
+ protected IContentType getContentType() {
+ return XmlPersistence.CONTENT_TYPE;
}
@@ -64,10 +55,15 @@ public class PersistenceFileCreationDataModelProvider
@Override
protected boolean fileVersionSupportedForFacetVersion(String fileVersion, String jpaFacetVersion) {
- if (jpaFacetVersion.equals(JpaFacet.VERSION_1_0.getVersionString())
+ if (jpaFacetVersion.equals(JpaProject.FACET_VERSION_STRING)
&& fileVersion.equals(JPA2_0.SCHEMA_VERSION)) {
return false;
}
return true;
}
+
+ @Override
+ protected boolean platformIsSupported(JpaPlatform jpaPlatform) {
+ return true;
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/PersistenceFileCreationOperation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/PersistenceFileCreationOperation.java
index 996b0454b3..fb8f0020c8 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/PersistenceFileCreationOperation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/PersistenceFileCreationOperation.java
@@ -1,18 +1,17 @@
/*******************************************************************************
- * Copyright (c) 2009 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
- *******************************************************************************/
+ * Copyright (c) 2009, 2012 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.jpa.core.internal.operations;
import org.eclipse.core.resources.IFile;
import org.eclipse.jpt.jpa.core.internal.resource.persistence.PersistenceXmlResourceProvider;
-import org.eclipse.jpt.jpa.core.resource.AbstractXmlResourceProvider;
+import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResourceProvider;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
public class PersistenceFileCreationOperation
@@ -25,7 +24,7 @@ public class PersistenceFileCreationOperation
@Override
- protected AbstractXmlResourceProvider getXmlResourceProvider(IFile file) {
+ protected JpaXmlResourceProvider getXmlResourceProvider(IFile file) {
return PersistenceXmlResourceProvider.getXmlResourceProvider(file);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/InternalJpaPlatformDescription.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/InternalJpaPlatformDescription.java
new file mode 100644
index 0000000000..48f2b85509
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/InternalJpaPlatformDescription.java
@@ -0,0 +1,115 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2012 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.jpa.core.internal.platform;
+
+import org.eclipse.jpt.common.core.internal.utility.XPointTools;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.jpa.core.JpaPlatform;
+import org.eclipse.jpt.jpa.core.JpaPlatformFactory;
+import org.eclipse.jpt.jpa.core.JpaProject;
+import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
+import org.eclipse.jpt.jpa.core.platform.JpaPlatformManager;
+import org.eclipse.jpt.jpa.core.platform.JpaPlatformGroupDescription;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+
+class InternalJpaPlatformDescription
+ implements JpaPlatformDescription
+{
+ private final InternalJpaPlatformManager jpaPlatformManager;
+ private final String id;
+ private final String label;
+ private final String factoryClassName;
+ private /* final */ IProjectFacetVersion jpaFacetVersion;
+ private /* final */ boolean default_ = false;
+ private /* final */ InternalJpaPlatformGroupDescription group;
+ private /* final */ String pluginId;
+ private JpaPlatform jpaPlatform;
+
+
+ InternalJpaPlatformDescription(InternalJpaPlatformManager jpaPlatformManager, String id, String label, String factoryClassName) {
+ super();
+ this.jpaPlatformManager = jpaPlatformManager;
+ this.id = id;
+ this.label = label;
+ this.factoryClassName = factoryClassName;
+ }
+
+ public JpaPlatformManager getJpaPlatformManager() {
+ return this.jpaPlatformManager;
+ }
+
+ public String getId() {
+ return this.id;
+ }
+
+ public String getLabel() {
+ return this.label;
+ }
+
+ public String getFactoryClassName() {
+ return this.factoryClassName;
+ }
+
+ void setJpaFacetVersion(IProjectFacetVersion jpaFacetVersion) {
+ this.jpaFacetVersion = jpaFacetVersion;
+ }
+
+ public boolean supportsJpaFacetVersion(IProjectFacetVersion version) {
+ if ( ! version.getProjectFacet().equals(JpaProject.FACET)) {
+ throw new IllegalArgumentException(version.toString());
+ }
+ return (this.jpaFacetVersion == null) || this.jpaFacetVersion.equals(version);
+ }
+
+ public boolean isDefault() {
+ return this.default_;
+ }
+
+ void setDefault(boolean default_) {
+ this.default_ = default_;
+ }
+
+ public JpaPlatformGroupDescription getGroupDescription() {
+ return this.group;
+ }
+
+ void setGroup(InternalJpaPlatformGroupDescription group) {
+ this.group = group;
+ }
+
+ public String getPluginId() {
+ return this.pluginId;
+ }
+
+ void setPluginId(String pluginId) {
+ this.pluginId = pluginId;
+ }
+
+ synchronized JpaPlatform getJpaPlatform() {
+ if (this.jpaPlatform == null) {
+ this.jpaPlatform = this.buildJpaPlatform();
+ }
+ return this.jpaPlatform;
+ }
+
+ private JpaPlatform buildJpaPlatform() {
+ JpaPlatformFactory factory = this.buildJpaPlatformFactory();
+ return (factory == null) ? null : factory.buildJpaPlatform(this.id);
+ }
+
+ private JpaPlatformFactory buildJpaPlatformFactory() {
+ return XPointTools.instantiate(this.pluginId, this.jpaPlatformManager.getExtensionPointName(), this.factoryClassName, JpaPlatformFactory.class);
+ }
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this, this.label);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/InternalJpaPlatformGroupDescription.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/InternalJpaPlatformGroupDescription.java
new file mode 100644
index 0000000000..ca48adebd6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/InternalJpaPlatformGroupDescription.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2012 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.jpa.core.internal.platform;
+
+import java.util.ArrayList;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.iterables.SuperIterableWrapper;
+import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
+import org.eclipse.jpt.jpa.core.platform.JpaPlatformManager;
+import org.eclipse.jpt.jpa.core.platform.JpaPlatformGroupDescription;
+
+class InternalJpaPlatformGroupDescription
+ implements JpaPlatformGroupDescription
+{
+ private final InternalJpaPlatformManager jpaPlatformManager;
+ private final String id;
+ private final String label;
+ private String pluginId;
+
+ // not sure why we hold these...
+ private ArrayList<InternalJpaPlatformDescription> platformDescriptions = new ArrayList<InternalJpaPlatformDescription>();
+
+
+ InternalJpaPlatformGroupDescription(InternalJpaPlatformManager jpaPlatformManager, String id, String label) {
+ super();
+ this.jpaPlatformManager = jpaPlatformManager;
+ this.id = id;
+ this.label = label;
+ }
+
+ public JpaPlatformManager getJpaPlatformManager() {
+ return this.jpaPlatformManager;
+ }
+
+ public String getId() {
+ return this.id;
+ }
+
+ public String getLabel() {
+ return this.label;
+ }
+
+ void setPluginId(String pluginId) {
+ this.pluginId = pluginId;
+ }
+
+ public String getPluginId() {
+ return this.pluginId;
+ }
+
+ void addPlatform(InternalJpaPlatformDescription platform) {
+ this.platformDescriptions.add(platform);
+ }
+
+ public Iterable<JpaPlatformDescription> getJpaPlatformDescriptions() {
+ return new SuperIterableWrapper<JpaPlatformDescription>(this.platformDescriptions);
+ }
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this, this.label);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/InternalJpaPlatformManager.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/InternalJpaPlatformManager.java
new file mode 100644
index 0000000000..c47a64e174
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/InternalJpaPlatformManager.java
@@ -0,0 +1,458 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2012 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.jpa.core.internal.platform;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Set;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.RegistryFactory;
+import org.eclipse.jpt.common.core.internal.JptCommonCoreMessages;
+import org.eclipse.jpt.common.core.internal.utility.XPointTools;
+import org.eclipse.jpt.common.utility.Filter;
+import org.eclipse.jpt.common.utility.internal.FilterAdapter;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.SuperIterableWrapper;
+import org.eclipse.jpt.jpa.core.JpaPlatform;
+import org.eclipse.jpt.jpa.core.JpaProject;
+import org.eclipse.jpt.jpa.core.JpaWorkspace;
+import org.eclipse.jpt.jpa.core.internal.InternalJpaWorkspace;
+import org.eclipse.jpt.jpa.core.internal.JptCoreMessages;
+import org.eclipse.jpt.jpa.core.internal.plugin.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
+import org.eclipse.jpt.jpa.core.platform.JpaPlatformGroupDescription;
+import org.eclipse.jpt.jpa.core.platform.JpaPlatformManager;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+
+/**
+ * JPA platform manager.
+ */
+public class InternalJpaPlatformManager
+ implements JpaPlatformManager
+{
+ /**
+ * The JPA platform description manager's JPA workspace.
+ */
+ private final InternalJpaWorkspace jpaWorkspace;
+
+ /**
+ * The JPA platform group descriptions, keyed by ID.
+ * Initialized during construction.
+ */
+ private final HashMap<String, InternalJpaPlatformGroupDescription> jpaPlatformGroupDescriptions = new HashMap<String, InternalJpaPlatformGroupDescription>();
+
+ /**
+ * The JPA platform descriptions, keyed by ID.
+ * Initialized during construction.
+ */
+ private final HashMap<String, InternalJpaPlatformDescription> jpaPlatformDescriptions = new HashMap<String, InternalJpaPlatformDescription>();
+
+
+ // ********** extension point element and attribute names **********
+
+ private static final String SIMPLE_EXTENSION_POINT_NAME = "jpaPlatforms"; //$NON-NLS-1$
+ private static final String JPA_PLATFORM_GROUP_ELEMENT = "jpaPlatformGroup"; //$NON-NLS-1$
+ private static final String JPA_PLATFORM_ELEMENT = "jpaPlatform"; //$NON-NLS-1$
+ private static final String ID_ATTRIBUTE = "id"; //$NON-NLS-1$
+ private static final String LABEL_ATTRIBUTE = "label"; //$NON-NLS-1$
+ private static final String FACTORY_CLASS_ATTRIBUTE = "factoryClass"; //$NON-NLS-1$
+ private static final String JPA_FACET_VERSION_ATTRIBUTE = "jpaFacetVersion"; //$NON-NLS-1$
+ private static final String DEFAULT_ATTRIBUTE = "default"; //$NON-NLS-1$
+ private static final String GROUP_ATTRIBUTE = "group"; //$NON-NLS-1$
+
+
+ /**
+ * Internal - called from only
+ * {@link InternalJpaWorkspace#buildJpaPlatformManager()}.
+ */
+ public InternalJpaPlatformManager(InternalJpaWorkspace jpaWorkspace) {
+ super();
+ this.jpaWorkspace = jpaWorkspace;
+ this.initialize();
+ }
+
+
+ // ********** initialization **********
+
+ private void initialize() {
+ IExtensionPoint extensionPoint = this.getExtensionPoint();
+ if (extensionPoint == null) {
+ throw new IllegalStateException();
+ }
+
+ ArrayList<IConfigurationElement> jpaPlatformGroupElements = new ArrayList<IConfigurationElement>();
+ ArrayList<IConfigurationElement> jpaPlatformElements = new ArrayList<IConfigurationElement>();
+
+ for (IExtension extension : extensionPoint.getExtensions()) {
+ for (IConfigurationElement element : extension.getConfigurationElements()) {
+ String elementName = element.getName(); // probably cannot be null
+ if (elementName.equals(JPA_PLATFORM_GROUP_ELEMENT)) {
+ jpaPlatformGroupElements.add(element);
+ }
+ else if (elementName.equals(JPA_PLATFORM_ELEMENT)) {
+ jpaPlatformElements.add(element);
+ }
+ }
+ }
+
+ // build the groups first so the platforms can be added as they are built
+ for (IConfigurationElement element : jpaPlatformGroupElements) {
+ InternalJpaPlatformGroupDescription desc = this.buildPlatformGroupDescription(element);
+ if (desc != null) {
+ this.jpaPlatformGroupDescriptions.put(desc.getId(), desc);
+ }
+ }
+
+ for (IConfigurationElement element : jpaPlatformElements) {
+ InternalJpaPlatformDescription desc = this.buildPlatformDescription(element);
+ if (desc != null) {
+ this.jpaPlatformDescriptions.put(desc.getId(), desc);
+ }
+ }
+ }
+
+ /**
+ * Return <code>null</code> if there is any sort of problem building a
+ * group description from the specified configuration element.
+ */
+ private InternalJpaPlatformGroupDescription buildPlatformGroupDescription(IConfigurationElement element) {
+ String contributor = element.getContributor().getName();
+ // id
+ String id = element.getAttribute(ID_ATTRIBUTE);
+ if (id == null) {
+ this.logMissingAttribute(element, ID_ATTRIBUTE);
+ return null;
+ }
+ if (this.jpaPlatformGroupDescriptions.containsKey(id)) {
+ this.logError(JptCommonCoreMessages.REGISTRY_DUPLICATE, this.getExtensionPointName(), contributor, ID_ATTRIBUTE, id);
+ return null; // drop any duplicate platform groups
+ }
+
+ // label
+ String label = element.getAttribute(LABEL_ATTRIBUTE);
+ if (label == null) {
+ this.logMissingAttribute(element, LABEL_ATTRIBUTE);
+ return null;
+ }
+
+ InternalJpaPlatformGroupDescription desc = new InternalJpaPlatformGroupDescription(this, id, label);
+ desc.setPluginId(contributor);
+ return desc;
+ }
+
+ /**
+ * Return <code>null</code> if there is any sort of problem building a
+ * platform description from the specified configuration element.
+ */
+ private InternalJpaPlatformDescription buildPlatformDescription(IConfigurationElement element) {
+ String contributor = element.getContributor().getName();
+ // id
+ String id = element.getAttribute(ID_ATTRIBUTE);
+ if (id == null) {
+ this.logMissingAttribute(element, ID_ATTRIBUTE);
+ return null;
+ }
+ if (this.jpaPlatformDescriptions.containsKey(id)) {
+ this.logError(JptCommonCoreMessages.REGISTRY_DUPLICATE, this.getExtensionPointName(), contributor, ID_ATTRIBUTE, id);
+ return null; // drop any duplicate platforms
+ }
+
+ // label
+ String label = element.getAttribute(LABEL_ATTRIBUTE);
+ if (label == null) {
+ this.logMissingAttribute(element, LABEL_ATTRIBUTE);
+ return null;
+ }
+
+ // factory class name
+ String factoryClassName = element.getAttribute(FACTORY_CLASS_ATTRIBUTE);
+ if (factoryClassName == null) {
+ this.logMissingAttribute(element, FACTORY_CLASS_ATTRIBUTE);
+ return null;
+ }
+
+ InternalJpaPlatformDescription desc = new InternalJpaPlatformDescription(this, id, label, factoryClassName);
+
+ // JPA facet version
+ String jpaFacetVersionString = element.getAttribute(JPA_FACET_VERSION_ATTRIBUTE);
+ if (jpaFacetVersionString != null) {
+ IProjectFacetVersion jpaFacetVersion = JpaProject.FACET.getVersion(jpaFacetVersionString);
+ if (jpaFacetVersion == null) {
+ this.logInvalidValue(element, JPA_FACET_VERSION_ATTRIBUTE, jpaFacetVersionString);
+ return null;
+ }
+ desc.setJpaFacetVersion(jpaFacetVersion);
+ }
+
+ // default
+ String defaultString = element.getAttribute(DEFAULT_ATTRIBUTE);
+ if (defaultString != null) {
+ Boolean default_ = defaultString.equals("true") ? Boolean.TRUE : defaultString.equals("false") ? Boolean.FALSE : null; //$NON-NLS-1$ //$NON-NLS-2$
+ if (default_ == null) {
+ this.logInvalidValue(element, DEFAULT_ATTRIBUTE, defaultString);
+ return null;
+ }
+ desc.setDefault(default_.booleanValue());
+ }
+
+ // group
+ String groupID = element.getAttribute(GROUP_ATTRIBUTE);
+ if (groupID != null) {
+ InternalJpaPlatformGroupDescription group = this.jpaPlatformGroupDescriptions.get(groupID);
+ if (group == null) {
+ this.logInvalidValue(element, GROUP_ATTRIBUTE, groupID);
+ return null; // drop any platform with an invalid group(?)
+ }
+ desc.setGroup(group);
+ group.addPlatform(desc);
+ }
+
+ desc.setPluginId(contributor);
+ return desc;
+ }
+
+
+ // ********** initialize default preferences **********
+
+ /**
+ * Internal: Called <em>only</em> by the
+ * {@link InternalJpaWorkspace#initializeDefaultPreferences()
+ * JPA workspace}.
+ */
+ public void initializeDefaultPreferences() {
+ for (IProjectFacetVersion jpaFacetVersion : this.getJpaFacetVersions()) {
+ this.initializeDefaultPreference(jpaFacetVersion);
+ }
+ }
+
+ private Set<IProjectFacetVersion> getJpaFacetVersions() {
+ return JpaProject.FACET.getVersions();
+ }
+
+ private void initializeDefaultPreference(IProjectFacetVersion jpaFacetVersion) {
+ JpaPlatformDescription description = this.buildDefaultJpaPlatformDescription(jpaFacetVersion);
+ if (description != null) {
+ this.getPlugin().setDefaultPreference(this.buildDefaultJpaPlatformPreferenceKey(jpaFacetVersion), description.getId());
+ }
+ }
+
+ /**
+ * Return the first JPA platform description registered as a default for the
+ * specified JPA facet version. Return an <em>internal</em> platform
+ * description if none are registered. Log an error and return
+ * <code>null</code> if the specified JPA facet version is invalid.
+ */
+ private JpaPlatformDescription buildDefaultJpaPlatformDescription(IProjectFacetVersion jpaFacetVersion) {
+ JpaPlatformDescription description = this.selectJpaPlatformDescription(this.getDefaultJpaPlatformDescriptions(), jpaFacetVersion);
+ if (description != null) {
+ return description;
+ }
+
+ description = this.selectJpaPlatformDescription(this.getInternalJpaPlatformDescriptions(), jpaFacetVersion);
+ if (description != null) {
+ return description;
+ }
+
+ this.logError(JptCoreMessages.INVALID_FACET, jpaFacetVersion);
+ return null;
+ }
+
+ private String buildDefaultJpaPlatformPreferenceKey(IProjectFacetVersion jpaFacetVersion) {
+ return DEFAULT_JPA_PLATFORM_PREF_KEY_BASE + jpaFacetVersion.getVersionString();
+ }
+
+ /**
+ * The base of the keys for the default JPA platform IDs stored in the
+ * workspace preferences. The keys can calculated by appending the
+ * {@link IProjectFacetVersion#getVersionString() JPA facet version}
+ * to this base.
+ * @see #getDefaultJpaPlatformDescription(IProjectFacetVersion)
+ * @see org.eclipse.jpt.common.core.internal.utility.JptPlugin#getPreference(String)
+ */
+ private static final String DEFAULT_JPA_PLATFORM_PREF_KEY_BASE = "defaultJpaPlatform_"; //$NON-NLS-1$
+
+
+ // ********** JPA platforms **********
+
+ public JpaPlatform getJpaPlatform(String jpaPlatformID) {
+ InternalJpaPlatformDescription desc = this.jpaPlatformDescriptions.get(jpaPlatformID);
+ return (desc == null) ? null : desc.getJpaPlatform();
+ }
+
+
+ // ********** JPA platform group descriptions **********
+
+ public Iterable<JpaPlatformGroupDescription> getJpaPlatformGroupDescriptions() {
+ return new SuperIterableWrapper<JpaPlatformGroupDescription>(this.jpaPlatformGroupDescriptions.values());
+ }
+
+ public JpaPlatformGroupDescription getJpaPlatformGroupDescription(String groupID) {
+ return this.jpaPlatformGroupDescriptions.get(groupID);
+ }
+
+
+ // ********** JPA platform descriptions **********
+
+ public Iterable<JpaPlatformDescription> getJpaPlatformDescriptions() {
+ return new SuperIterableWrapper<JpaPlatformDescription>(this.jpaPlatformDescriptions.values());
+ }
+
+ public JpaPlatformDescription getJpaPlatformDescription(String jpaPlatformID) {
+ return this.jpaPlatformDescriptions.get(jpaPlatformID);
+ }
+
+ public Iterable<JpaPlatformDescription> getJpaPlatformDescriptions(IProjectFacetVersion jpaFacetVersion) {
+ return this.selectJpaPlatformDescriptions(this.getJpaPlatformDescriptions(), jpaFacetVersion);
+ }
+
+ /**
+ * Return the first description among those specified that supports the
+ * specified JPA facet version.
+ */
+ private JpaPlatformDescription selectJpaPlatformDescription(Iterable<JpaPlatformDescription> descriptions, IProjectFacetVersion jpaFacetVersion) {
+ Iterator<JpaPlatformDescription> stream = this.selectJpaPlatformDescriptions(descriptions, jpaFacetVersion).iterator();
+ return stream.hasNext() ? stream.next() : null;
+ }
+
+ /**
+ * Return the JPA platform descriptions among those specified that support
+ * the specified facet version.
+ */
+ private Iterable<JpaPlatformDescription> selectJpaPlatformDescriptions(Iterable<JpaPlatformDescription> descriptions, IProjectFacetVersion jpaFacetVersion) {
+ return new FilteringIterable<JpaPlatformDescription>(descriptions, this.buildJpaPlatformDescriptionFilter(jpaFacetVersion));
+ }
+
+ private Filter<JpaPlatformDescription> buildJpaPlatformDescriptionFilter(IProjectFacetVersion jpaFacetVersion) {
+ return new FacetVersionJpaPlatformDescriptionFilter(jpaFacetVersion);
+ }
+
+ /* CU private */ static class FacetVersionJpaPlatformDescriptionFilter
+ extends FilterAdapter<JpaPlatformDescription>
+ {
+ private final IProjectFacetVersion jpaFacetVersion;
+ FacetVersionJpaPlatformDescriptionFilter(IProjectFacetVersion jpaFacetVersion) {
+ super();
+ this.jpaFacetVersion = jpaFacetVersion;
+ }
+ @Override
+ public boolean accept(JpaPlatformDescription description) {
+ return description.supportsJpaFacetVersion(this.jpaFacetVersion);
+ }
+ }
+
+ /**
+ * "Default" platforms (i.e. third-party platforms flagged as "default").
+ */
+ private Iterable<JpaPlatformDescription> getDefaultJpaPlatformDescriptions() {
+ return new FilteringIterable<JpaPlatformDescription>(this.getJpaPlatformDescriptions(), DEFAULT_JPA_PLATFORM_DESCRIPTION_FILTER);
+ }
+
+ private static final Filter<JpaPlatformDescription> DEFAULT_JPA_PLATFORM_DESCRIPTION_FILTER = new DefaultJpaPlatformDescriptionFilter();
+
+ /* CU private */ static class DefaultJpaPlatformDescriptionFilter
+ extends FilterAdapter<JpaPlatformDescription>
+ {
+ @Override
+ public boolean accept(JpaPlatformDescription desc) {
+ return desc.isDefault();
+ }
+ }
+
+ /**
+ * "Internal" (i.e. Dali-defined generic) platforms.
+ */
+ private Iterable<JpaPlatformDescription> getInternalJpaPlatformDescriptions() {
+ return new FilteringIterable<JpaPlatformDescription>(this.getJpaPlatformDescriptions(), this.buildInternalJpaPlatformDescriptionFilter());
+ }
+
+ private Filter<JpaPlatformDescription> buildInternalJpaPlatformDescriptionFilter() {
+ return new InternalJpaPlatformDescriptionFilter(this.getPluginID());
+ }
+
+ /* CU private */ static class InternalJpaPlatformDescriptionFilter
+ extends FilterAdapter<JpaPlatformDescription>
+ {
+ private final String prefix;
+ InternalJpaPlatformDescriptionFilter(String prefix) {
+ super();
+ this.prefix = prefix;
+ }
+ @Override
+ public boolean accept(JpaPlatformDescription desc) {
+ return desc.getFactoryClassName().startsWith(this.prefix);
+ }
+ }
+
+
+ // ********** default JPA platform description **********
+
+ public JpaPlatformDescription getDefaultJpaPlatformDescription(IProjectFacetVersion jpaFacetVersion) {
+ String key = this.buildDefaultJpaPlatformPreferenceKey(jpaFacetVersion);
+ String platformID = this.getPlugin().getPreference(key);
+ return (platformID == null) ? null : this.getJpaPlatformDescription(platformID);
+ }
+
+ public void setDefaultJpaPlatformDescription(IProjectFacetVersion jpaFacetVersion, JpaPlatformDescription description) {
+ String key = this.buildDefaultJpaPlatformPreferenceKey(jpaFacetVersion);
+ this.getPlugin().setPreference(key, description.getId());
+ }
+
+
+ // ********** logging **********
+
+ private void logError(String msg, Object... args) {
+ this.getPlugin().logError(msg, args);
+ }
+
+ private void logMissingAttribute(IConfigurationElement element, String attributeName) {
+ this.getPlugin().logError(XPointTools.buildMissingAttributeMessage(element, attributeName));
+ }
+
+ private void logInvalidValue(IConfigurationElement element, String nodeName, String invalidValue) {
+ this.getPlugin().logError(XPointTools.buildInvalidValueMessage(element, nodeName, invalidValue));
+ }
+
+
+ // ********** misc **********
+
+ public JpaWorkspace getJpaWorkspace() {
+ return this.jpaWorkspace;
+ }
+
+ String getExtensionPointName() {
+ return this.getPluginID() + '.' + SIMPLE_EXTENSION_POINT_NAME;
+ }
+
+ private IExtensionPoint getExtensionPoint() {
+ return this.getExtensionRegistry().getExtensionPoint(this.getPluginID(), SIMPLE_EXTENSION_POINT_NAME);
+ }
+
+ private IExtensionRegistry getExtensionRegistry() {
+ return RegistryFactory.getRegistry();
+ }
+
+ private String getPluginID() {
+ return this.getPlugin().getPluginID();
+ }
+
+ private JptJpaCorePlugin getPlugin() {
+ return JptJpaCorePlugin.instance();
+ }
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JavaElementAdapterFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JavaElementAdapterFactory.java
index 4e695c9a13..49baf5fe73 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JavaElementAdapterFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JavaElementAdapterFactory.java
@@ -17,7 +17,7 @@ import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
* Factory to build Dali adapters for an {@link IJavaElement}:<ul>
* <li>{@link JpaPlatformDescription}
* </ul>
- * See <code>org.eclipse.jpt.jpa.core/plugin.xml</code>.
+ * See <code>org.eclipse.jpt.jpa.core/plugin.xml:org.eclipse.core.runtime.adapters</code>.
*/
public class JavaElementAdapterFactory
implements IAdapterFactory
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JpaPlatformDescriptionImpl.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JpaPlatformDescriptionImpl.java
deleted file mode 100644
index c8198fa4f8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JpaPlatformDescriptionImpl.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010, 2012 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.jpa.core.internal.platform;
-
-import org.eclipse.jpt.common.core.internal.utility.XPointTools;
-import org.eclipse.jpt.jpa.core.JpaFacet;
-import org.eclipse.jpt.jpa.core.JpaPlatform;
-import org.eclipse.jpt.jpa.core.JpaPlatformFactory;
-import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
-import org.eclipse.jpt.jpa.core.platform.JpaPlatformGroupDescription;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-
-public class JpaPlatformDescriptionImpl
- implements JpaPlatformDescription {
-
- private String id;
- private String pluginId;
- private String label;
- private String factoryClassName;
- private IProjectFacetVersion jpaFacetVersion;
- private boolean default_ = false;
- private JpaPlatformGroupDescriptionImpl group;
-
-
- public String getId() {
- return this.id;
- }
-
- void setId(String id) {
- this.id = id;
- }
-
- public String getPluginId() {
- return this.pluginId;
- }
-
- void setPluginId(String pluginId) {
- this.pluginId = pluginId;
- }
-
- public String getLabel() {
- return this.label;
- }
-
- void setLabel(String label) {
- this.label = label;
- }
-
- public String getFactoryClassName() {
- return this.factoryClassName;
- }
-
- void setFactoryClassName(String className) {
- this.factoryClassName = className;
- }
-
- public IProjectFacetVersion getJpaFacetVersion() {
- return this.jpaFacetVersion;
- }
-
- void setJpaFacetVersion(IProjectFacetVersion jpaFacetVersion) {
- if (! jpaFacetVersion.getProjectFacet().equals(JpaFacet.FACET)) {
- throw new IllegalArgumentException(jpaFacetVersion.toString());
- }
- this.jpaFacetVersion = jpaFacetVersion;
- }
-
- public boolean supportsJpaFacetVersion(IProjectFacetVersion jpaFacetVersion) {
- if (! jpaFacetVersion.getProjectFacet().equals(JpaFacet.FACET)) {
- throw new IllegalArgumentException(jpaFacetVersion.toString());
- }
- return (this.jpaFacetVersion != null) ? this.jpaFacetVersion.equals(jpaFacetVersion) : true;
- }
-
- public boolean isDefault() {
- return this.default_;
- }
-
- void setDefault(boolean default_) {
- this.default_ = default_;
- }
-
- public JpaPlatformGroupDescription getGroup() {
- return this.group;
- }
-
- void setGroup(JpaPlatformGroupDescriptionImpl group) {
- this.group = group;
- }
-
- public JpaPlatform buildJpaPlatform() {
- JpaPlatformFactory factory = XPointTools.instantiate(
- this.pluginId, JpaPlatformManagerImpl.QUALIFIED_EXTENSION_POINT_ID,
- this.factoryClassName, JpaPlatformFactory.class);
- return factory.buildJpaPlatform(getId());
- }
-
- @Override
- public String toString() {
- return this.label;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JpaPlatformTester.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JpaPlatformDescriptionPropertyTester.java
index 8626d5f465..660926dd92 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JpaPlatformTester.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JpaPlatformDescriptionPropertyTester.java
@@ -9,16 +9,18 @@
package org.eclipse.jpt.jpa.core.internal.platform;
import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.jpt.common.utility.internal.Tools;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.JpaWorkspace;
import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
import org.eclipse.jpt.jpa.core.platform.JpaPlatformGroupDescription;
+import org.eclipse.jpt.jpa.core.platform.JpaPlatformManager;
/**
* Property tester for {@link JpaPlatformDescription}.
- * See <code>org.eclipse.jpt.jpa.core/plugin.xml</code>
+ * See <code>org.eclipse.jpt.jpa.core/plugin.xml:org.eclipse.core.expressions.propertyTesters</code>
*/
-public class JpaPlatformTester
+public class JpaPlatformDescriptionPropertyTester
extends PropertyTester
{
public static final String JPA_PLATFORM = "jpaPlatform"; //$NON-NLS-1$
@@ -38,16 +40,24 @@ public class JpaPlatformTester
}
if (property.equals(JPA_PLATFORM_GROUP)) {
JpaPlatformGroupDescription expected = this.getJpaPlatformGroupDescription((String) expectedValue);
- return Tools.valuesAreEqual(platformDescription.getGroup(), expected);
+ return Tools.valuesAreEqual(platformDescription.getGroupDescription(), expected);
}
return false;
}
private JpaPlatformDescription getJpaPlatformDescription(String id) {
- return JptJpaCorePlugin.getJpaPlatformManager().getJpaPlatform(id);
+ return this.getJpaPlatformManager().getJpaPlatformDescription(id);
}
private JpaPlatformGroupDescription getJpaPlatformGroupDescription(String id) {
- return JptJpaCorePlugin.getJpaPlatformManager().getJpaPlatformGroup(id);
+ return this.getJpaPlatformManager().getJpaPlatformGroupDescription(id);
+ }
+
+ private JpaPlatformManager getJpaPlatformManager() {
+ return this.getJpaWorkspace().getJpaPlatformManager();
+ }
+
+ private JpaWorkspace getJpaWorkspace() {
+ return (JpaWorkspace) ResourcesPlugin.getWorkspace().getAdapter(JpaWorkspace.class);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JpaPlatformGroupDescriptionImpl.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JpaPlatformGroupDescriptionImpl.java
deleted file mode 100644
index 2ca9afe58c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JpaPlatformGroupDescriptionImpl.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 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.jpa.core.internal.platform;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.iterables.SuperIterableWrapper;
-import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
-import org.eclipse.jpt.jpa.core.platform.JpaPlatformGroupDescription;
-
-public class JpaPlatformGroupDescriptionImpl
- implements JpaPlatformGroupDescription {
-
- private String id;
- private String pluginId;
- private String label;
- private Map<String, JpaPlatformDescriptionImpl> platforms;
-
-
- JpaPlatformGroupDescriptionImpl() {
- this.platforms = new HashMap<String, JpaPlatformDescriptionImpl>();
- }
-
- public String getId() {
- return this.id;
- }
-
- void setId(String id) {
- this.id = id;
- }
-
- public String getPluginId() {
- return this.pluginId;
- }
-
- void setPluginId(String pluginId) {
- this.pluginId = pluginId;
- }
-
- public String getLabel() {
- return this.label;
- }
-
- void setLabel(String label) {
- this.label = label;
- }
-
- void addPlatform(JpaPlatformDescriptionImpl platform) {
- this.platforms.put(platform.getId(), platform);
- }
-
- public Iterable<JpaPlatformDescription> getPlatforms() {
- return new SuperIterableWrapper<JpaPlatformDescription>(CollectionTools.collection(this.platforms.values()));
- }
-
- @Override
- public String toString() {
- return this.label;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JpaPlatformManagerImpl.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JpaPlatformManagerImpl.java
deleted file mode 100644
index 0f2e32e616..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JpaPlatformManagerImpl.java
+++ /dev/null
@@ -1,243 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2012 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.jpa.core.internal.platform;
-
-import static org.eclipse.jpt.common.core.internal.utility.XPointTools.*;
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jpt.common.core.internal.utility.XPointTools.XPointException;
-import org.eclipse.jpt.common.utility.internal.KeyedSet;
-import org.eclipse.jpt.common.utility.internal.iterables.SuperIterableWrapper;
-import org.eclipse.jpt.jpa.core.JpaFacet;
-import org.eclipse.jpt.jpa.core.JpaPlatform;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
-import org.eclipse.jpt.jpa.core.platform.JpaPlatformGroupDescription;
-import org.eclipse.jpt.jpa.core.platform.JpaPlatformManager;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-
-/**
- * Singleton registry for storing all the registered JPA platform configuration
- * elements and instantiating JPA platforms from them.
- */
-public class JpaPlatformManagerImpl
- implements JpaPlatformManager {
-
- static final String EXTENSION_POINT_ID = "jpaPlatforms"; //$NON-NLS-1$
- static final String QUALIFIED_EXTENSION_POINT_ID = JptJpaCorePlugin.PLUGIN_ID_ + EXTENSION_POINT_ID;
- static final String PLATFORM_GROUP_ELEMENT = "jpaPlatformGroup"; //$NON-NLS-1$
- static final String PLATFORM_ELEMENT = "jpaPlatform"; //$NON-NLS-1$
- static final String ID_ATTRIBUTE = "id"; //$NON-NLS-1$
- static final String LABEL_ATTRIBUTE = "label"; //$NON-NLS-1$
- static final String FACTORY_CLASS_ATTRIBUTE = "factoryClass"; //$NON-NLS-1$
- static final String JPA_FACET_VERSION_ATTRIBUTE = "jpaFacetVersion"; //$NON-NLS-1$
- static final String DEFAULT_ATTRIBUTE = "default"; //$NON-NLS-1$
- static final String GROUP_ELEMENT = "group"; //$NON-NLS-1$
-
-
- private static final JpaPlatformManagerImpl INSTANCE = new JpaPlatformManagerImpl();
-
-
- public static JpaPlatformManagerImpl instance() {
- return INSTANCE;
- }
-
-
- private KeyedSet<String, JpaPlatformGroupDescriptionImpl> jpaPlatformGroupDescriptions;
- private KeyedSet<String, JpaPlatformDescriptionImpl> jpaPlatformDescriptions;
-
-
- // ********** constructor/initialization **********
-
- private JpaPlatformManagerImpl() {
- super();
- this.jpaPlatformGroupDescriptions = new KeyedSet<String, JpaPlatformGroupDescriptionImpl>();
- this.jpaPlatformDescriptions = new KeyedSet<String, JpaPlatformDescriptionImpl>();
- readExtensions();
- }
-
-
- private void readExtensions() {
- final IExtensionRegistry registry = Platform.getExtensionRegistry();
-
- final IExtensionPoint xpoint
- = registry.getExtensionPoint(JptJpaCorePlugin.PLUGIN_ID, EXTENSION_POINT_ID);
-
- if (xpoint == null) {
- throw new IllegalStateException();
- }
-
- List<IConfigurationElement> platformGroupConfigs = new ArrayList<IConfigurationElement>();
- List<IConfigurationElement> platformConfigs = new ArrayList<IConfigurationElement>();
-
- for (IExtension extension : xpoint.getExtensions()) {
- for (IConfigurationElement element : extension.getConfigurationElements()) {
- if (element.getName().equals(PLATFORM_GROUP_ELEMENT)) {
- platformGroupConfigs.add(element);
- }
- else if (element.getName().equals(PLATFORM_ELEMENT)) {
- platformConfigs.add(element);
- }
- }
- }
-
- for (IConfigurationElement element : platformGroupConfigs) {
- readPlatformGroupExtension(element);
- }
-
- for (IConfigurationElement element : platformConfigs) {
- readPlatformExtension(element);
- }
- }
-
- private void readPlatformGroupExtension(IConfigurationElement element) {
- try {
- final JpaPlatformGroupDescriptionImpl desc = new JpaPlatformGroupDescriptionImpl();
-
- // plug-in id
- desc.setPluginId(element.getContributor().getName());
-
- // id
- desc.setId(findRequiredAttribute(element, ID_ATTRIBUTE));
-
- if (this.jpaPlatformGroupDescriptions.containsKey(desc.getId())) {
- logDuplicateExtension(QUALIFIED_EXTENSION_POINT_ID, ID_ATTRIBUTE, desc.getId());
- throw new XPointException();
- }
-
- // label
- desc.setLabel(findRequiredAttribute(element, LABEL_ATTRIBUTE));
-
- this.jpaPlatformGroupDescriptions.addItem(desc.getId(), desc);
- }
- catch (XPointException e) {
- // Ignore and continue. The problem has already been reported to the user
- // in the log.
- }
- }
-
- private void readPlatformExtension(IConfigurationElement element) {
- try {
- final JpaPlatformDescriptionImpl desc = new JpaPlatformDescriptionImpl();
-
- // plug-in id
- desc.setPluginId(element.getContributor().getName());
-
- // id
- desc.setId(findRequiredAttribute(element, ID_ATTRIBUTE));
-
- if (this.jpaPlatformDescriptions.containsKey(desc.getId())) {
- logDuplicateExtension(QUALIFIED_EXTENSION_POINT_ID, ID_ATTRIBUTE, desc.getId());
- throw new XPointException();
- }
-
- // label
- desc.setLabel(findRequiredAttribute(element, LABEL_ATTRIBUTE));
-
- // factory class
- desc.setFactoryClassName(findRequiredAttribute(element, FACTORY_CLASS_ATTRIBUTE));
-
- // JPA facet version
- String jpaFacetVersionString = element.getAttribute(JPA_FACET_VERSION_ATTRIBUTE);
- if (jpaFacetVersionString != null) {
- IProjectFacetVersion jpaFacetVersion = JpaFacet.FACET.getVersion(jpaFacetVersionString);
- if (jpaFacetVersion != null) {
- desc.setJpaFacetVersion(jpaFacetVersion);
- }
- else {
- logInvalidValue(element, JPA_FACET_VERSION_ATTRIBUTE, jpaFacetVersionString);
- throw new XPointException();
- }
- }
-
- // default
- String defaultString = element.getAttribute(DEFAULT_ATTRIBUTE);
- if (defaultString != null) {
- if (defaultString.equals("true")) {
- desc.setDefault(true);
- }
- else if (defaultString.equals("false")) {
- desc.setDefault(false);
- }
- else {
- logInvalidValue(element, DEFAULT_ATTRIBUTE, defaultString);
- throw new XPointException();
- }
- }
-
- // group
- String groupId = element.getAttribute(GROUP_ELEMENT);
- if (groupId != null) {
- JpaPlatformGroupDescriptionImpl group = this.jpaPlatformGroupDescriptions.getItem(groupId);
- if (group != null) {
- desc.setGroup(group);
- group.addPlatform(desc);
- }
- else {
- logInvalidValue(element, GROUP_ELEMENT, groupId);
- throw new XPointException();
- }
- }
-
- this.jpaPlatformDescriptions.addItem(desc.getId(), desc);
- }
- catch (XPointException e) {
- // Ignore and continue. The problem has already been reported to the user
- // in the log.
- }
- }
-
-
- // ********** public methods **********
-
- public Iterable<JpaPlatformGroupDescription> getJpaPlatformGroups() {
- return new SuperIterableWrapper<JpaPlatformGroupDescription>(this.jpaPlatformGroupDescriptions.getItemSet());
- }
-
- public JpaPlatformGroupDescription getJpaPlatformGroup(String groupId) {
- return this.jpaPlatformGroupDescriptions.getItem(groupId);
- }
-
- public Iterable<JpaPlatformDescription> getJpaPlatforms() {
- return new SuperIterableWrapper<JpaPlatformDescription>(this.jpaPlatformDescriptions.getItemSet());
- }
-
- public JpaPlatformDescription getJpaPlatform(String platformId) {
- return this.jpaPlatformDescriptions.getItem(platformId);
- }
-
- public JpaPlatformDescription getDefaultJpaPlatform(IProjectFacetVersion jpaFacetVersion) {
- for (JpaPlatformDescription platform : getJpaPlatforms()) {
- if (platform.isDefault() && platform.supportsJpaFacetVersion(jpaFacetVersion)) {
- return platform;
- }
- }
- return null;
- }
- public JpaPlatform buildJpaPlatformImplementation(IProject project) {
- String jpaPlatformId = JptJpaCorePlugin.getJpaPlatformId(project);
- JpaPlatformDescriptionImpl platformDesc = this.jpaPlatformDescriptions.getItem(jpaPlatformId);
- if (platformDesc == null) {
- throw new IllegalArgumentException("Project does not have a recognized JPA platform: " + jpaPlatformId); //$NON-NLS-1$
- }
- return platformDesc.buildJpaPlatform();
- }
-
- @Override
- public String toString() {
- return this.getClass().getSimpleName();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/ResourceAdapterFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/ResourceAdapterFactory.java
index 5c5dda6863..1ac6678fa6 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/ResourceAdapterFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/ResourceAdapterFactory.java
@@ -10,15 +10,18 @@
package org.eclipse.jpt.jpa.core.internal.platform;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.JpaPreferences;
+import org.eclipse.jpt.jpa.core.JpaWorkspace;
import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
+import org.eclipse.jpt.jpa.core.platform.JpaPlatformManager;
/**
* Factory to build Dali adapters for an {@link IResource}:<ul>
* <li>{@link JpaPlatformDescription}
* </ul>
- * See <code>org.eclipse.jpt.jpa.core/plugin.xml</code>.
+ * See <code>org.eclipse.jpt.jpa.core/plugin.xml:org.eclipse.core.runtime.adapters</code>.
*/
public class ResourceAdapterFactory
implements IAdapterFactory
@@ -46,7 +49,14 @@ public class ResourceAdapterFactory
}
private JpaPlatformDescription getJpaPlatformDescription(IResource resource) {
- // TODO go directly to the JpaPlatformManager
- return JptJpaCorePlugin.getJpaPlatformManager().getJpaPlatform(JptJpaCorePlugin.getJpaPlatformId(resource.getProject()));
+ return this.getJpaPlatformManager().getJpaPlatformDescription(JpaPreferences.getJpaPlatformID(resource.getProject()));
+ }
+
+ private JpaPlatformManager getJpaPlatformManager() {
+ return this.getJpaWorkspace().getJpaPlatformManager();
+ }
+
+ private JpaWorkspace getJpaWorkspace() {
+ return (JpaWorkspace) ResourcesPlugin.getWorkspace().getAdapter(JpaWorkspace.class);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/plugin/JptJpaCorePlugin.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/plugin/JptJpaCorePlugin.java
new file mode 100644
index 0000000000..dbec6c49f8
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/plugin/JptJpaCorePlugin.java
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2012 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.jpa.core.internal.plugin;
+
+import java.util.HashMap;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.jpt.common.core.internal.utility.JptPlugin;
+import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.jpa.core.internal.InternalJpaWorkspace;
+
+public class JptJpaCorePlugin
+ extends JptPlugin
+{
+ // NB: the plug-in must be synchronized whenever accessing any of this state
+ private final HashMap<IWorkspace, InternalJpaWorkspace> jpaWorkspaces = new HashMap<IWorkspace, InternalJpaWorkspace>();
+
+
+ // ********** singleton **********
+
+ private static volatile JptJpaCorePlugin INSTANCE;
+
+ /**
+ * Return the Dali JPA core plug-in.
+ */
+ public static JptJpaCorePlugin instance() {
+ return INSTANCE;
+ }
+
+
+ // ********** Dali plug-in **********
+
+ public JptJpaCorePlugin() {
+ super();
+ }
+
+ @Override
+ protected void setInstance(JptPlugin plugin) {
+ INSTANCE = (JptJpaCorePlugin) plugin;
+ }
+
+ @Override
+ protected void stop_() throws Exception {
+ try {
+ for (InternalJpaWorkspace jpaWorkspace : this.jpaWorkspaces.values()) {
+ try {
+ jpaWorkspace.stop();
+ } catch (Throwable ex) {
+ this.logError(ex); // keep going
+ }
+ }
+ this.jpaWorkspaces.clear();
+ } finally {
+ super.stop_();
+ }
+ }
+
+ /**
+ * The qualification for persistent properties was mistakenly changed
+ * when the plug-in ID changed; so keep it that way.
+ */
+ @Override
+ protected String getPersistentPropertyPluginID() {
+ return this.getPluginID();
+ }
+
+ /**
+ * With the addition of JAXB support to Dali, an additional JPA scope was
+ * added to the original plug-in ID; so use the old plug-in ID for prefs.
+ */
+ @Override
+ protected String getOriginalPluginID_() {
+ String pluginID = this.getPluginID();
+ return (pluginID == null) ? null : pluginID.replace(".jpa", StringTools.EMPTY_STRING); //$NON-NLS-1$
+ }
+
+
+ // ********** JPA workspaces **********
+
+ /**
+ * Return the JPA workspace corresponding to the specified Eclipse workspace.
+ * <p>
+ * The preferred way to retrieve a JPA workspace is via the Eclipse
+ * adapter framework:
+ * <pre>
+ * JpaWorkspace jpaWorkspace = (JpaWorkspace) ResourcesPlugin.getWorkspace().getAdapter(JpaWorkspace.class)
+ * </pre>
+ * @see org.eclipse.jpt.jpa.core.internal.WorkspaceAdapterFactory#getJpaWorkspace(IWorkspace)
+ */
+ public synchronized InternalJpaWorkspace getJpaWorkspace(IWorkspace workspace) {
+ InternalJpaWorkspace jpaWorkspace = this.jpaWorkspaces.get(workspace);
+ if ((jpaWorkspace == null) && this.isActive()) {
+ jpaWorkspace = this.buildJpaWorkspace(workspace);
+ this.jpaWorkspaces.put(workspace, jpaWorkspace);
+ }
+ return jpaWorkspace;
+ }
+
+ private InternalJpaWorkspace buildJpaWorkspace(IWorkspace workspace) {
+ return new InternalJpaWorkspace(workspace);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/prefs/JpaPreferencesManager.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/prefs/JpaPreferencesManager.java
deleted file mode 100644
index ef089ba576..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/prefs/JpaPreferencesManager.java
+++ /dev/null
@@ -1,402 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2012 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.jpa.core.internal.prefs;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ProjectScope;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.core.runtime.preferences.DefaultScope;
-import org.eclipse.core.runtime.preferences.IEclipsePreferences;
-import org.eclipse.core.runtime.preferences.IScopeContext;
-import org.eclipse.core.runtime.preferences.InstanceScope;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.jpa.core.JpaFacet;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.internal.JptCoreMessages;
-import org.eclipse.jpt.jpa.core.internal.platform.JpaPlatformManagerImpl;
-import org.eclipse.jpt.jpa.core.platform.GenericPlatform;
-import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
-import org.eclipse.osgi.util.NLS;
-import org.osgi.service.prefs.BackingStoreException;
-
-/**
- * JptPreferencesManager
- */
-public class JpaPreferencesManager
-{
- private final IProject project;
-
- private static volatile boolean flushPreferences = true;
-
- // ********** public constants **********
-
- /**
- * The key for storing a JPA project's platform ID in the Eclipse
- * project's preferences.
- */
- protected static final String JPA_PLATFORM_PREF_KEY = JptJpaCorePlugin.LEGACY_PLUGIN_ID_ + "platform"; //$NON-NLS-1$
-
- /**
- * The old key for storing the default JPA platform ID in the workspace preferences.
- * @deprecated As of version 2.3. Instead use {@link #DEFAULT_JPA_PLATFORM_1_0_PREF_KEY} or
- * {@link #DEFAULT_JPA_PLATFORM_2_0_PREF_KEY}
- */
- @Deprecated
- public static final String DEFAULT_JPA_PLATFORM_PREF_KEY = "defaultJpaPlatform"; //$NON-NLS-1$
-
- /**
- * The key for storing the default JPA platform ID for JPA 1.0 in the workspace preferences.
- */
- public static final String DEFAULT_JPA_PLATFORM_1_0_PREF_KEY =
- DEFAULT_JPA_PLATFORM_PREF_KEY + "_" + JpaFacet.VERSION_1_0.getVersionString(); //$NON-NLS-1$
-
- /**
- * The key for storing the default JPA platform ID for JPA 2.0 in the workspace preferences.
- */
- public static final String DEFAULT_JPA_PLATFORM_2_0_PREF_KEY =
- DEFAULT_JPA_PLATFORM_PREF_KEY + "_" + JpaFacet.VERSION_2_0.getVersionString(); //$NON-NLS-1$
-
- /**
- * The key for storing a JPA project's "discover" flag in the Eclipse
- * project's preferences.
- */
- public static final String DISCOVER_ANNOTATED_CLASSES = JptJpaCorePlugin.PLUGIN_ID_ + "discoverAnnotatedClasses"; //$NON-NLS-1$
-
- //bug 354780 - made the mistake of changing the project metadata in the 3.0 release
- protected static final String LEGACY_DISCOVER_ANNOTATED_CLASSES = JptJpaCorePlugin.LEGACY_PLUGIN_ID_ + "discoverAnnotatedClasses"; //$NON-NLS-1$
-
- /**
- * The key for storing the name of a JPA project's metamodel source folder
- * in the Eclipse project's preferences.
- */
- public static final String METAMODEL_SOURCE_FOLDER_NAME = JptJpaCorePlugin.PLUGIN_ID_ + "metamodelSourceFolderName"; //$NON-NLS-1$
-
- //bug 354780 - made the mistake of changing the project metadata in the 3.0 release
- protected static final String LEGACY_METAMODEL_SOURCE_FOLDER_NAME = JptJpaCorePlugin.LEGACY_PLUGIN_ID_ + "metamodelSourceFolderName"; //$NON-NLS-1$
-
-
- // ********** static methods **************************************************
-
- public static void clearWorkspacePreferences() throws BackingStoreException {
- getLegacyWorkspacePreferences().clear();
- }
-
- // ********** preferences **********
-
- /**
- * Return the legacy Dali (org.eclipse.jpt.core) preferences for the specified context.
- */
- private static IEclipsePreferences getLegacyPreferences(IScopeContext context) {
- return context.getNode(JptJpaCorePlugin.LEGACY_PLUGIN_ID);
- }
-
- /**
- * Return the Dali (org.eclipse.jpt.jpa.core) preferences for the specified context.
- */
- private static IEclipsePreferences getPreferences(IScopeContext context) {
- return context.getNode(JptJpaCorePlugin.PLUGIN_ID);
- }
-
- /**
- * Return the legacy Dali (org.eclipse.jpt.core) preferences for the current workspace instance.
- */
- public static IEclipsePreferences getLegacyWorkspacePreferences() {
- return getLegacyPreferences(InstanceScope.INSTANCE);
- }
-
- /**
- * Return the legacy Dali (org.eclipse.jpt.core) default preferences
- */
- public static IEclipsePreferences getLegacyDefaultPreferences() {
- return getLegacyPreferences(DefaultScope.INSTANCE);
- }
-
- /**
- * Return the Dali (org.eclipse.jpt.jpa.core) default preferences
- * @see JpaPreferenceInitializer
- */
- public static IEclipsePreferences getDefaultPreferences() {
- return getPreferences(DefaultScope.INSTANCE);
- }
-
- public static void initializeDefaultPreferences() {
- IEclipsePreferences node = getDefaultPreferences();
-
- // default JPA platforms
- JpaPlatformDescription defaultPlatform_1_0 =
- JpaPlatformManagerImpl.instance().getDefaultJpaPlatform(JpaFacet.VERSION_1_0);
- if (defaultPlatform_1_0 == null) {
- defaultPlatform_1_0 = GenericPlatform.VERSION_1_0;
- }
- node.put(DEFAULT_JPA_PLATFORM_1_0_PREF_KEY, defaultPlatform_1_0.getId());
-
- JpaPlatformDescription defaultPlatform_2_0 =
- JpaPlatformManagerImpl.instance().getDefaultJpaPlatform(JpaFacet.VERSION_2_0);
- if (defaultPlatform_2_0 == null) {
- defaultPlatform_2_0 = GenericPlatform.VERSION_2_0;
- }
- node.put(DEFAULT_JPA_PLATFORM_2_0_PREF_KEY, defaultPlatform_2_0.getId());
- }
-
- // ********** workspace preference **********
-
- protected static String getLegacyWorkspacePreference(String key, String defaultValue) {
- String value = getLegacyWorkspacePreferences().get(key, defaultValue);
- return (StringTools.stringIsEmpty(value)) ? defaultValue : value;
- }
-
- protected static String getLegacyWorkspacePreference(String key) {
- return getLegacyWorkspacePreferences().get(key, null);
- }
-
- public static void setLegacyWorkspacePreference(String key, String value) {
- IEclipsePreferences wkspPrefs = getLegacyWorkspacePreferences();
- if(value == null) {
- wkspPrefs.remove(key);
- }
- else {
- wkspPrefs.put(key, value);
- }
- flush(wkspPrefs);
- }
-
- protected static boolean getLegacyWorkspacePreference(String key, boolean defaultBooleanValue) {
- return getLegacyWorkspacePreferences().getBoolean(key, defaultBooleanValue);
- }
-
- public static void setLegacyWorkspacePreference(String key, boolean booleanValue) {
- IEclipsePreferences wkspPrefs = getLegacyWorkspacePreferences();
- wkspPrefs.putBoolean(key, booleanValue);
- flush(wkspPrefs);
- }
-
- public static void removeLegacyWorkspacePreference(String key) {
- IEclipsePreferences wkspPrefs = getLegacyWorkspacePreferences();
- wkspPrefs.remove(key);
- flush(wkspPrefs);
- }
-
- // ********** private static methods **********
-
- /**
- * This method is called (via reflection) when the test plug-in is loaded.
- * The preferences end up getting flushed after the test case has deleted
- * its project, resulting in resource exceptions in the log, e.g.
- * <pre>
- * Resource '/JpaProjectManagerTests' is not open.
- * </pre>
- * See <code>JptJpaCoreTestsPlugin.start(BundleContext)</code>
- */
- @SuppressWarnings("unused")
- private static void doNotFlushPreferences() {
- flushPreferences = false;
- }
-
- /**
- * Flush preferences in an asynchronous Job because the flush request will
- * trigger a lock on the project, which can cause us some deadlocks (e.g.
- * when deleting the metamodel source folder).
- * Note: the flush will also remove the prefs node if it is empty
- */
- private static void flush(IEclipsePreferences prefs) {
- if (flushPreferences) {
- new PreferencesFlushJob(prefs).schedule();
- }
- }
-
- private static class PreferencesFlushJob extends Job {
- private final IEclipsePreferences prefs;
- PreferencesFlushJob(IEclipsePreferences prefs) {
- super(NLS.bind(JptCoreMessages.PREFERENCES_FLUSH_JOB_NAME, prefs.absolutePath()));
- this.prefs = prefs;
- }
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- try {
- this.prefs.flush();
- }
- catch(BackingStoreException ex) {
- JptJpaCorePlugin.log(ex);
- }
- return Status.OK_STATUS;
- }
- }
-
- // ********** implementation **************************************************
-
- public JpaPreferencesManager(IProject project) {
- if(project == null) {
- throw new RuntimeException("Project is null"); //$NON-NLS-1$
- }
- this.project = project;
- }
-
- // ********** query **********
-
- protected String getLegacyPreference(String key) {
- String preferenceValue = this.getLegacyProjectPreference(key);
-
- // check workspace preferences if not a project preference
- if(preferenceValue == null) {
- preferenceValue = getLegacyWorkspacePreference(key);
- }
- return preferenceValue;
- }
-
- protected String getLegacyPreference(String key, String defaultValue) {
- String preferenceValue = this.getLegacyPreference(key);
- if(StringTools.stringIsEmpty(preferenceValue)) {
- return defaultValue;
- }
- return preferenceValue;
- }
-
- // ********** preferences **********
-
- /**
- * Return the legacy Dali (org.eclipse.jpt.core) preferences for the specified Eclipse project.
- */
- public IEclipsePreferences getLegacyProjectPreferences() {
- return getLegacyPreferences(new ProjectScope(this.project));
- }
-
- /**
- * Clears the project of JPA-specific preferences
- */
- public void clearProjectPreferences() {
- this.clearLegacyProjectPreferences(
- JPA_PLATFORM_PREF_KEY,
- DISCOVER_ANNOTATED_CLASSES,
- METAMODEL_SOURCE_FOLDER_NAME,
- LEGACY_DISCOVER_ANNOTATED_CLASSES,
- LEGACY_METAMODEL_SOURCE_FOLDER_NAME);
- }
-
- /**
- * Clears the specified legacy Dali (org.eclipse.jpt.core) preferences
- */
- public void clearLegacyProjectPreferences(String ... preferenceKeys) {
- IEclipsePreferences projectPrefs = this.getLegacyProjectPreferences();
- for(String preferenceKey : preferenceKeys) {
- projectPrefs.remove(preferenceKey);
- }
- flush(projectPrefs);
- }
-
- // ********** project preference **********
-
- protected String getLegacyProjectPreference(String key, String defaultValue) {
- String value = this.getLegacyProjectPreferences().get(key, defaultValue);
- return (StringTools.stringIsEmpty(value)) ? defaultValue : value;
- }
-
- protected String getLegacyProjectPreference(String key) {
- return this.getLegacyProjectPreferences().get(key, null);
- }
-
- protected void setLegacyProjectPreference(String key, String value) {
- IEclipsePreferences projectPrefs = this.getLegacyProjectPreferences();
- if(value == null) {
- projectPrefs.remove(key);
- }
- else {
- projectPrefs.put(key, value);
- }
- flush(projectPrefs);
- }
-
- protected boolean getLegacyProjectPreference(String key, boolean defaultBooleanValue) {
- return this.getLegacyProjectPreferences().getBoolean(key, defaultBooleanValue);
- }
-
- protected void setLegacyProjectPreference(String key, boolean booleanValue) {
- IEclipsePreferences projectPrefs = this.getLegacyProjectPreferences();
- projectPrefs.putBoolean(key, booleanValue);
- flush(projectPrefs);
- }
-
- protected void removeLegacyProjectPreference(String key) {
- IEclipsePreferences projectPrefs = this.getLegacyProjectPreferences();
- projectPrefs.remove(key);
- flush(projectPrefs);
- }
-
- // ********** getters/setters *********
-
- /**
- * Return the JPA platform ID associated with the specified Eclipse project.
- */
- public String getJpaPlatformId() {
- return this.getLegacyProjectPreference(JPA_PLATFORM_PREF_KEY, GenericPlatform.VERSION_1_0.getId());
- }
-
- /**
- * Set the JPA platform ID associated with the specified Eclipse project.
- */
- public void setJpaPlatformId(String jpaPlatformId) {
- this.setLegacyProjectPreference(JPA_PLATFORM_PREF_KEY, jpaPlatformId);
- }
-
- /**
- * Return the JPA "discover" flag associated with the specified
- * Eclipse project.
- */
- public boolean getDiscoverAnnotatedClasses() {
- if (this.getLegacyProjectPreference(DISCOVER_ANNOTATED_CLASSES, null) != null) {
- return this.getLegacyProjectPreference(DISCOVER_ANNOTATED_CLASSES, false);
- }
- //bug 354780 - made the mistake of changing the project metadata in the 3.0 release
- return this.getLegacyProjectPreference(LEGACY_DISCOVER_ANNOTATED_CLASSES, false);
- }
-
- /**
- * Set the JPA "discover" flag associated with the specified
- * Eclipse project.
- */
- public void setDiscoverAnnotatedClasses(boolean discoverAnnotatedClasses) {
- this.setLegacyProjectPreference(DISCOVER_ANNOTATED_CLASSES, discoverAnnotatedClasses);
- }
-
- /**
- * Return the name of the metamodel source folder associated with the
- * specified Eclipse project.
- */
- public String getMetamodelSourceFolderName() {
- String metamodelSourceFolderName = this.getLegacyProjectPreference(METAMODEL_SOURCE_FOLDER_NAME, null);
- if (metamodelSourceFolderName != null) {
- return metamodelSourceFolderName;
- }
- //bug 354780 - made the mistake of changing the project metadata in the 3.0 release
- return this.getLegacyProjectPreference(LEGACY_METAMODEL_SOURCE_FOLDER_NAME, null);
- }
-
- /**
- * Set the name of the metamodel source folder associated with the
- * specified Eclipse project.
- */
- public void setMetamodelSourceFolderName(String metamodelSourceFolderName) {
- this.setLegacyProjectPreference(METAMODEL_SOURCE_FOLDER_NAME, metamodelSourceFolderName);
- //bug 354780 - made the mistake of changing the project metadata in the 3.0 release.
- //make sure legacy setting is removed when turning off metamodel gen, if we don't then
- //there will be no way to turn off meatamodel gen without sacrificing backwards compatibility
- if(metamodelSourceFolderName == null) {
- this.setLegacyProjectPreference(LEGACY_METAMODEL_SOURCE_FOLDER_NAME, null);
- }
- }
-
- // ********** protected methods **********
-
- protected IProject getProject() {
- return this.project;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaDeleteTypeParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaDeleteTypeParticipant.java
index 11771b2e9d..d4dba75423 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaDeleteTypeParticipant.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaDeleteTypeParticipant.java
@@ -29,11 +29,11 @@ import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.JpaProjectManager;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef;
import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
+import org.eclipse.jpt.jpa.core.internal.plugin.JptJpaCorePlugin;
import org.eclipse.ltk.core.refactoring.Change;
import org.eclipse.ltk.core.refactoring.CompositeChange;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
@@ -91,7 +91,7 @@ public abstract class AbstractJpaDeleteTypeParticipant
nestedTypes = type.getTypes();
}
catch (JavaModelException ex) {
- JptJpaCorePlugin.log(ex);
+ JptJpaCorePlugin.instance().logError(ex);
return;
}
@@ -278,7 +278,7 @@ public abstract class AbstractJpaDeleteTypeParticipant
if (persistenceXml == null) {
return null;
}
- Persistence persistence = persistenceXml.getPersistence();
+ Persistence persistence = persistenceXml.getRoot();
if (persistence == null) {
return null;
}
@@ -295,7 +295,7 @@ public abstract class AbstractJpaDeleteTypeParticipant
}
catch (MalformedTreeException ex) {
//log exception and don't add this persistence.xml type deletion to the conflicting change object
- JptJpaCorePlugin.log(ex);
+ JptJpaCorePlugin.instance().logError(ex);
}
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaMoveJavaElementParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaMoveJavaElementParticipant.java
index 3360d65d13..9218176a47 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaMoveJavaElementParticipant.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaMoveJavaElementParticipant.java
@@ -26,11 +26,11 @@ import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.JpaProjectManager;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef;
import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
+import org.eclipse.jpt.jpa.core.internal.plugin.JptJpaCorePlugin;
import org.eclipse.ltk.core.refactoring.Change;
import org.eclipse.ltk.core.refactoring.CompositeChange;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
@@ -284,7 +284,7 @@ public abstract class AbstractJpaMoveJavaElementParticipant
if (persistenceXml == null) {
return null;
}
- Persistence persistence = persistenceXml.getPersistence();
+ Persistence persistence = persistenceXml.getRoot();
if (persistence == null) {
return null;
}
@@ -301,7 +301,7 @@ public abstract class AbstractJpaMoveJavaElementParticipant
}
catch (MalformedTreeException ex) {
//log exception and don't add this persistence.xml type deletion to the conflicting change object
- JptJpaCorePlugin.log(ex);
+ JptJpaCorePlugin.instance().logError(ex);
}
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaRenameJavaElementParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaRenameJavaElementParticipant.java
index 7d653279f2..c0c359d164 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaRenameJavaElementParticipant.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaRenameJavaElementParticipant.java
@@ -23,11 +23,11 @@ import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.JpaProjectManager;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef;
import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
+import org.eclipse.jpt.jpa.core.internal.plugin.JptJpaCorePlugin;
import org.eclipse.ltk.core.refactoring.Change;
import org.eclipse.ltk.core.refactoring.CompositeChange;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
@@ -247,7 +247,7 @@ public abstract class AbstractJpaRenameJavaElementParticipant
if (persistenceXml == null) {
return null;
}
- Persistence persistence = persistenceXml.getPersistence();
+ Persistence persistence = persistenceXml.getRoot();
if (persistence == null) {
return null;
}
@@ -264,7 +264,7 @@ public abstract class AbstractJpaRenameJavaElementParticipant
}
catch (MalformedTreeException ex) {
//log exception and don't add this persistence.xml type deletion to the conflicting change object
- JptJpaCorePlugin.log(ex);
+ JptJpaCorePlugin.instance().logError(ex);
}
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaDeleteMappingFileParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaDeleteMappingFileParticipant.java
index cebebbcca4..e74c0a9f66 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaDeleteMappingFileParticipant.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaDeleteMappingFileParticipant.java
@@ -23,10 +23,10 @@ import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.JpaProjectManager;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
+import org.eclipse.jpt.jpa.core.internal.plugin.JptJpaCorePlugin;
import org.eclipse.ltk.core.refactoring.Change;
import org.eclipse.ltk.core.refactoring.CompositeChange;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
@@ -44,7 +44,8 @@ import org.eclipse.text.edits.MultiTextEdit;
import org.eclipse.text.edits.TextEdit;
/**
- * Participant in the delete refactoring of {@link IFile}s with content type {@link JptJpaCorePlugin#MAPPING_FILE_CONTENT_TYPE}.
+ * Participant in the delete refactoring of {@link IFile}s with content type
+ * {@link org.eclipse.jpt.jpa.core.resource.ResourceMappingFile.Root#CONTENT_TYPE}.
* If the deleted mapping file is listed in a persistence.xml file of any JpaProject
* then a Change object is created that will delete that reference from the file.
*/
@@ -54,7 +55,8 @@ public class JpaDeleteMappingFileParticipant
{
/**
- * Store the {@link IFile}s to be deleted with content type {@link JptJpaCorePlugin#MAPPING_FILE_CONTENT_TYPE}
+ * Store the {@link IFile}s to be deleted with content type
+ * {@link org.eclipse.jpt.jpa.core.resource.ResourceMappingFile.Root#CONTENT_TYPE}
* and their corresponding {@link DeleteArguments}
*/
protected final Map<IFile, DeleteArguments> mappingFiles;
@@ -200,7 +202,7 @@ public class JpaDeleteMappingFileParticipant
if (persistenceXml == null) {
return null;
}
- Persistence persistence = persistenceXml.getPersistence();
+ Persistence persistence = persistenceXml.getRoot();
if (persistence == null) {
return null;
}
@@ -217,7 +219,7 @@ public class JpaDeleteMappingFileParticipant
}
catch (MalformedTreeException e) {
//log exception and don't add this persistence.xml type deletion to the conflicting change object
- JptJpaCorePlugin.log(e);
+ JptJpaCorePlugin.instance().logError(e);
}
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaDeletePackageOrFolderParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaDeletePackageOrFolderParticipant.java
index a3ada7d411..afacdc127e 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaDeletePackageOrFolderParticipant.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaDeletePackageOrFolderParticipant.java
@@ -28,13 +28,15 @@ import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jpt.common.core.internal.utility.JDTTools;
+import org.eclipse.jpt.common.utility.internal.Tools;
import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatform;
+import org.eclipse.jpt.jpa.core.internal.plugin.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.resource.ResourceMappingFile;
import org.eclipse.ltk.core.refactoring.participants.ISharableParticipant;
import org.eclipse.ltk.core.refactoring.participants.RefactoringArguments;
import org.eclipse.ltk.core.refactoring.participants.RenameProcessor;
@@ -144,7 +146,7 @@ public class JpaDeletePackageOrFolderParticipant
}
}
catch (JavaModelException ex) {
- JptJpaCorePlugin.log(ex);
+ JptJpaCorePlugin.instance().logError(ex);
}
}
@@ -179,7 +181,7 @@ public class JpaDeletePackageOrFolderParticipant
protected boolean accept(IFile file) {
if (javaProject.isOnClasspath(file)) {
IContentType contentType = GenericJpaPlatform.getContentType(file);
- return contentType != null && contentType.isKindOf(JptJpaCorePlugin.MAPPING_FILE_CONTENT_TYPE);
+ return contentType != null && contentType.isKindOf(ResourceMappingFile.Root.CONTENT_TYPE);
}
return false;
}
@@ -222,13 +224,11 @@ public class JpaDeletePackageOrFolderParticipant
return packageFragment.getNonJavaResources();
}
catch (JavaModelException e) {
- JptJpaCorePlugin.log(e);
- return EMPTY_OBJECT_ARRAY;
+ JptJpaCorePlugin.instance().logError(e);
+ return Tools.EMPTY_OBJECT_ARRAY;
}
}
- private static final Object[] EMPTY_OBJECT_ARRAY = new Object[0];
-
protected class FolderResourceProxyVisitor implements IResourceProxyVisitor {
private Collection<IFile> files;
protected FolderResourceProxyVisitor(Collection<IFile> files) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveFolderParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveFolderParticipant.java
index 6ed5de1958..b12bafd9dc 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveFolderParticipant.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveFolderParticipant.java
@@ -30,10 +30,10 @@ import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.JpaProjectManager;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
+import org.eclipse.jpt.jpa.core.internal.plugin.JptJpaCorePlugin;
import org.eclipse.ltk.core.refactoring.Change;
import org.eclipse.ltk.core.refactoring.CompositeChange;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
@@ -230,7 +230,7 @@ public class JpaMoveFolderParticipant
if (persistenceXml == null) {
return null;
}
- Persistence persistence = persistenceXml.getPersistence();
+ Persistence persistence = persistenceXml.getRoot();
if (persistence == null) {
return null;
}
@@ -247,7 +247,7 @@ public class JpaMoveFolderParticipant
}
catch (MalformedTreeException e) {
//log exception and don't add this persistence.xml type deletion to the conflicting change object
- JptJpaCorePlugin.log(e);
+ JptJpaCorePlugin.instance().logError(e);
}
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveMappingFileParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveMappingFileParticipant.java
index df9441cdc6..1ec0fba4b9 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveMappingFileParticipant.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveMappingFileParticipant.java
@@ -29,10 +29,10 @@ import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.JpaProjectManager;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
+import org.eclipse.jpt.jpa.core.internal.plugin.JptJpaCorePlugin;
import org.eclipse.ltk.core.refactoring.Change;
import org.eclipse.ltk.core.refactoring.CompositeChange;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
@@ -50,7 +50,8 @@ import org.eclipse.text.edits.ReplaceEdit;
import org.eclipse.text.edits.TextEdit;
/**
- * Participant in the rename refactoring of {@link IFile}s with content type {@link JptJpaCorePlugin#MAPPING_FILE_CONTENT_TYPE}.
+ * Participant in the rename refactoring of {@link IFile}s with content type
+ * {@link org.eclipse.jpt.jpa.core.resource.ResourceMappingFile.Root#CONTENT_TYPE}.
* If the renamed mapping file is listed in a persistence.xml file of any JpaProject
* then a Change object is created that will rename that reference from the file.
* If the renamed mapping file is an implied mapping file, then an actual reference to the mapping file will be specified.
@@ -61,7 +62,8 @@ public class JpaMoveMappingFileParticipant
{
/**
- * Store the {@link IFile}s to be renamed with content type {@link JptJpaCorePlugin#MAPPING_FILE_CONTENT_TYPE}
+ * Store the {@link IFile}s to be renamed with content type
+ * {@link org.eclipse.jpt.jpa.core.resource.ResourceMappingFile.Root#CONTENT_TYPE}
* and their corresponding {@link MoveArguments}
*/
protected final Map<IFile, MoveArguments> originalMappingFiles;
@@ -233,7 +235,7 @@ public class JpaMoveMappingFileParticipant
if (persistenceXml == null) {
return null;
}
- Persistence persistence = persistenceXml.getPersistence();
+ Persistence persistence = persistenceXml.getRoot();
if (persistence == null) {
return null;
}
@@ -250,7 +252,7 @@ public class JpaMoveMappingFileParticipant
}
catch (MalformedTreeException e) {
//log exception and don't add this persistence.xml type deletion to the conflicting change object
- JptJpaCorePlugin.log(e);
+ JptJpaCorePlugin.instance().logError(e);
}
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveTypeParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveTypeParticipant.java
index 969ad22c60..08789266c2 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveTypeParticipant.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveTypeParticipant.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2012 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.
@@ -13,9 +13,9 @@ import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
+import org.eclipse.jpt.jpa.core.internal.plugin.JptJpaCorePlugin;
import org.eclipse.ltk.core.refactoring.participants.RefactoringArguments;
import org.eclipse.text.edits.ReplaceEdit;
@@ -48,7 +48,7 @@ public class JpaMoveTypeParticipant
nestedTypes = renamedType.getTypes();
}
catch (JavaModelException ex) {
- JptJpaCorePlugin.log(ex);
+ JptJpaCorePlugin.instance().logError(ex);
return;
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameFolderParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameFolderParticipant.java
index f9b5e29a52..e918e390fc 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameFolderParticipant.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameFolderParticipant.java
@@ -23,10 +23,10 @@ import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.JpaProjectManager;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
+import org.eclipse.jpt.jpa.core.internal.plugin.JptJpaCorePlugin;
import org.eclipse.ltk.core.refactoring.Change;
import org.eclipse.ltk.core.refactoring.CompositeChange;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
@@ -184,7 +184,7 @@ public class JpaRenameFolderParticipant
if (persistenceXml == null) {
return null;
}
- Persistence persistence = persistenceXml.getPersistence();
+ Persistence persistence = persistenceXml.getRoot();
if (persistence == null) {
return null;
}
@@ -201,7 +201,7 @@ public class JpaRenameFolderParticipant
}
catch (MalformedTreeException e) {
//log exception and don't add this persistence.xml type deletion to the conflicting change object
- JptJpaCorePlugin.log(e);
+ JptJpaCorePlugin.instance().logError(e);
}
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameMappingFileParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameMappingFileParticipant.java
index 6ee1373e46..2a113f54b7 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameMappingFileParticipant.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameMappingFileParticipant.java
@@ -21,10 +21,11 @@ import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.JpaProjectManager;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
+import org.eclipse.jpt.jpa.core.internal.plugin.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.resource.ResourceMappingFile.Root;
import org.eclipse.ltk.core.refactoring.Change;
import org.eclipse.ltk.core.refactoring.CompositeChange;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
@@ -39,7 +40,8 @@ import org.eclipse.text.edits.ReplaceEdit;
import org.eclipse.text.edits.TextEdit;
/**
- * Participant in the rename refactoring of {@link IFile}s with content type {@link JptJpaCorePlugin#MAPPING_FILE_CONTENT_TYPE}.
+ * Participant in the rename refactoring of {@link IFile}s with content type
+ * {@link org.eclipse.jpt.jpa.core.resource.ResourceMappingFile.Root#CONTENT_TYPE}.
* If the renamed mapping file is listed in a persistence.xml file of any JpaProject
* then a Change object is created that will rename that reference from the file.
* If the renamed mapping file is an implied mapping file, then an actual reference to the mapping file will be specified.
@@ -49,7 +51,8 @@ public class JpaRenameMappingFileParticipant
{
/**
- * Store the {@link IFile}s to be renamed with content type {@link JptJpaCorePlugin#MAPPING_FILE_CONTENT_TYPE}
+ * Store the {@link IFile}s to be renamed with content type
+ * {@link org.eclipse.jpt.jpa.core.resource.ResourceMappingFile.Root#CONTENT_TYPE}
*/
protected IFile originalMappingFile;
@@ -179,7 +182,7 @@ public class JpaRenameMappingFileParticipant
if (persistenceXml == null) {
return null;
}
- Persistence persistence = persistenceXml.getPersistence();
+ Persistence persistence = persistenceXml.getRoot();
if (persistence == null) {
return null;
}
@@ -196,7 +199,7 @@ public class JpaRenameMappingFileParticipant
}
catch (MalformedTreeException e) {
//log exception and don't add this persistence.xml type deletion to the conflicting change object
- JptJpaCorePlugin.log(e);
+ JptJpaCorePlugin.instance().logError(e);
}
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameTypeParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameTypeParticipant.java
index c72b74c34c..390823f456 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameTypeParticipant.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameTypeParticipant.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2012 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.
@@ -15,9 +15,9 @@ import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
+import org.eclipse.jpt.jpa.core.internal.plugin.JptJpaCorePlugin;
import org.eclipse.text.edits.ReplaceEdit;
//TODO RenameTypeArguments.updateSimilarDeclarations() - http://www.eclipse.org/jdt/ui/r3_2/RenameType.html
@@ -61,7 +61,7 @@ public class JpaRenameTypeParticipant
nestedTypes = renamedType.getTypes();
}
catch (JavaModelException ex) {
- JptJpaCorePlugin.log(ex);
+ JptJpaCorePlugin.instance().logError(ex);
return;
}
@@ -129,7 +129,7 @@ public class JpaRenameTypeParticipant
}
}
catch (JavaModelException e) {
- JptJpaCorePlugin.log(e);
+ JptJpaCorePlugin.instance().logError(e);
}
return newName;
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/contenttypes/IndeterminateContentDescriber.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/contenttypes/IndeterminateContentDescriber.java
deleted file mode 100644
index 7f5320de28..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/contenttypes/IndeterminateContentDescriber.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 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.jpa.core.internal.resource.contenttypes;
-
-import java.io.InputStream;
-import java.io.Reader;
-import org.eclipse.core.runtime.QualifiedName;
-import org.eclipse.core.runtime.content.IContentDescription;
-import org.eclipse.core.runtime.content.ITextContentDescriber;
-
-/**
- * This class simply returns INDETERMINATE for any contents it receives.
- *
- * It is used currently for org.eclipse.jpt.jpa.core.content.baseJpaContent in order
- * to make that content type act as an "abstract" content type.
- *
- * This is in its own package so that it can be excluded from bundle activation in the plugin.xml.
- * Content describers must be self-contained and not trigger auto-activation.
- */
-public class IndeterminateContentDescriber implements ITextContentDescriber
-{
- public int describe(InputStream contents, IContentDescription description) {
- return INDETERMINATE;
- }
-
- public int describe(Reader contents, IContentDescription description) {
- return INDETERMINATE;
- }
-
- public QualifiedName[] getSupportedOptions() {
- return new QualifiedName[0];
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/orm/OrmXmlResourceProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/orm/OrmXmlResourceProvider.java
index e954ba690e..760b9b71cf 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/orm/OrmXmlResourceProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/orm/OrmXmlResourceProvider.java
@@ -12,9 +12,8 @@ package org.eclipse.jpt.jpa.core.internal.resource.orm;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IPath;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.internal.operations.OrmFileCreationDataModelProperties;
-import org.eclipse.jpt.jpa.core.resource.AbstractXmlResourceProvider;
+import org.eclipse.jpt.jpa.core.internal.resource.xml.AbstractJpaXmlResourceProvider;
import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitDefaults;
@@ -22,7 +21,7 @@ import org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitMetadata;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
public class OrmXmlResourceProvider
- extends AbstractXmlResourceProvider
+ extends AbstractJpaXmlResourceProvider
implements OrmFileCreationDataModelProperties
{
/**
@@ -46,7 +45,7 @@ public class OrmXmlResourceProvider
* the given project in the default runtime location
*/
public static OrmXmlResourceProvider getDefaultXmlResourceProvider(IProject project) {
- return getXmlResourceProvider(project, JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH);
+ return getXmlResourceProvider(project, XmlEntityMappings.DEFAULT_RUNTIME_PATH);
}
private static OrmXmlResourceProvider getXmlResourceProvider_(IProject project, IPath fullPath) {
@@ -55,11 +54,11 @@ public class OrmXmlResourceProvider
public OrmXmlResourceProvider(IProject project) {
- this(project, JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH);
+ this(project, XmlEntityMappings.DEFAULT_RUNTIME_PATH);
}
public OrmXmlResourceProvider(IProject project, IPath filePath) {
- super(project, filePath, JptJpaCorePlugin.ORM_XML_CONTENT_TYPE);
+ super(project, filePath, XmlEntityMappings.CONTENT_TYPE);
}
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/persistence/PersistenceXmlResourceProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/persistence/PersistenceXmlResourceProvider.java
index 84ad7a641f..c0637df8a7 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/persistence/PersistenceXmlResourceProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/persistence/PersistenceXmlResourceProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2012 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.
@@ -12,16 +12,15 @@ package org.eclipse.jpt.jpa.core.internal.resource.persistence;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IPath;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.internal.operations.PersistenceFileCreationDataModelProperties;
-import org.eclipse.jpt.jpa.core.resource.AbstractXmlResourceProvider;
+import org.eclipse.jpt.jpa.core.internal.resource.xml.AbstractJpaXmlResourceProvider;
import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistence;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
public class PersistenceXmlResourceProvider
- extends AbstractXmlResourceProvider
+ extends AbstractJpaXmlResourceProvider
implements PersistenceFileCreationDataModelProperties
{
/**
@@ -45,7 +44,7 @@ public class PersistenceXmlResourceProvider
* the given project in the default runtime location
*/
public static PersistenceXmlResourceProvider getDefaultXmlResourceProvider(IProject project) {
- return getXmlResourceProvider(project, JptJpaCorePlugin.DEFAULT_PERSISTENCE_XML_RUNTIME_PATH);
+ return getXmlResourceProvider(project, XmlPersistence.DEFAULT_RUNTIME_PATH);
}
private static PersistenceXmlResourceProvider getXmlResourceProvider_(IProject project, IPath fullPath) {
@@ -54,11 +53,11 @@ public class PersistenceXmlResourceProvider
public PersistenceXmlResourceProvider(IProject project) {
- this(project, JptJpaCorePlugin.DEFAULT_PERSISTENCE_XML_RUNTIME_PATH);
+ this(project, XmlPersistence.DEFAULT_RUNTIME_PATH);
}
public PersistenceXmlResourceProvider(IProject project, IPath filePath) {
- super(project, filePath, JptJpaCorePlugin.PERSISTENCE_XML_CONTENT_TYPE);
+ super(project, filePath, XmlPersistence.CONTENT_TYPE);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/AbstractXmlResourceProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/xml/AbstractJpaXmlResourceProvider.java
index 87ff112514..08662fefd0 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/AbstractXmlResourceProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/xml/AbstractJpaXmlResourceProvider.java
@@ -7,7 +7,7 @@
* Contributors:
* Oracle - initial API and implementation
*******************************************************************************/
-package org.eclipse.jpt.jpa.core.resource;
+package org.eclipse.jpt.jpa.core.internal.resource.xml;
import java.io.IOException;
import java.util.Collections;
@@ -32,9 +32,11 @@ import org.eclipse.jem.util.emf.workbench.EMFWorkbenchContextBase;
import org.eclipse.jem.util.emf.workbench.FlexibleProjectResourceSet;
import org.eclipse.jem.util.emf.workbench.IEMFContextContributor;
import org.eclipse.jem.util.emf.workbench.ProjectResourceSet;
+import org.eclipse.jem.util.emf.workbench.WorkbenchResourceHelperBase;
import org.eclipse.jpt.common.core.resource.ProjectResourceLocator;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.internal.plugin.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
+import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResourceProvider;
import org.eclipse.wst.common.componentcore.internal.impl.WTPResourceFactoryRegistry;
import org.eclipse.wst.common.internal.emfworkbench.WorkbenchResourceHelper;
import org.eclipse.wst.common.internal.emfworkbench.validateedit.ResourceStateInputProvider;
@@ -52,7 +54,7 @@ import org.eclipse.wst.common.internal.emfworkbench.validateedit.ResourceStateVa
* @version 2.3
* @since 2.2
*/
-public abstract class AbstractXmlResourceProvider
+public abstract class AbstractJpaXmlResourceProvider
implements JpaXmlResourceProvider, IEMFContextContributor, ResourceStateInputProvider, ResourceStateValidator
{
protected IProject project;
@@ -74,7 +76,7 @@ public abstract class AbstractXmlResourceProvider
* In either case, {@link #buildFileUri(IPath)} will attempt to build an absolutely pathed
* URI for the given path.
*/
- public AbstractXmlResourceProvider(IProject project, IPath resourcePath, IContentType contentType) {
+ public AbstractJpaXmlResourceProvider(IProject project, IPath resourcePath, IContentType contentType) {
super();
this.project = project;
this.fileUri = buildFileUri(resourcePath);
@@ -141,7 +143,7 @@ public abstract class AbstractXmlResourceProvider
this.resource.load(((ProjectResourceSet) getResourceSet()).getLoadOptions());
}
catch (IOException e) {
- JptJpaCorePlugin.log(e);
+ JptJpaCorePlugin.instance().logError(e);
}
}
@@ -156,7 +158,7 @@ public abstract class AbstractXmlResourceProvider
this.resource.saveIfNecessary(); //this writes out the file
}
catch (Exception e) {
- JptJpaCorePlugin.log(e);
+ JptJpaCorePlugin.instance().logError(e);
}
}
}
@@ -166,22 +168,31 @@ public abstract class AbstractXmlResourceProvider
* It also populates the root of the file.
* @param config - A configuration object used to specify options for creation of the resource
*/
- public JpaXmlResource createFileAndResource(final Object config, IProgressMonitor monitor) throws CoreException {
+ public JpaXmlResource createFileAndResource(Object config, IProgressMonitor monitor) throws CoreException {
IWorkspace workspace = ResourcesPlugin.getWorkspace();
- IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) {
- createResourceAndUnderlyingFile(config);
- }
- };
+ IWorkspaceRunnable runnable = new CreateFileAndResourceWorkspaceRunnable(config);
workspace.run(runnable, this.project, IWorkspace.AVOID_UPDATE, monitor);
return this.resource;
}
+
+ class CreateFileAndResourceWorkspaceRunnable
+ implements IWorkspaceRunnable
+ {
+ private final Object config;
+ CreateFileAndResourceWorkspaceRunnable(Object config) {
+ super();
+ this.config = config;
+ }
+ public void run(IProgressMonitor monitor) {
+ AbstractJpaXmlResourceProvider.this.createResourceAndUnderlyingFile(this.config);
+ }
+ }
/**
* Used to optionally fill in the root information of a resource if it does not
* exist as a file
*/
- protected void populateRoot(Object config) {
+ protected void populateRoot(@SuppressWarnings("unused") Object config) {
//TODO potentially call resource.populateRoot() instead of the resourceProvider doing this
}
@@ -198,7 +209,7 @@ public abstract class AbstractXmlResourceProvider
}
protected EMFWorkbenchContextBase getEmfContext() {
- return WorkbenchResourceHelper.createEMFContext(this.project, this);
+ return WorkbenchResourceHelperBase.createEMFContext(this.project, this);
}
public IProject getProject() {
@@ -257,10 +268,7 @@ public abstract class AbstractXmlResourceProvider
}
public IStatus validateState(ResourceStateValidatorPresenter presenter) throws CoreException {
- if (presenter == null) {
- return Status.OK_STATUS;
- }
- return getStateValidator().validateState(presenter);
+ return (presenter == null) ? Status.OK_STATUS : getStateValidator().validateState(presenter);
}
public boolean checkSave(ResourceStateValidatorPresenter presenter) throws CoreException {
@@ -278,22 +286,22 @@ public abstract class AbstractXmlResourceProvider
return this.resource.isModified();
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("rawtypes")
public List getNonResourceFiles() {
return Collections.emptyList();
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("rawtypes")
public List getNonResourceInconsistentFiles() {
return Collections.emptyList();
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("rawtypes")
public List getResources() {
return Collections.singletonList(getXmlResource());
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("rawtypes")
public void cacheNonResourceValidateState(List roNonResourceFiles) {
// do nothing
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/DefaultJpaValidationMessages.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/DefaultJpaValidationMessages.java
index efe34d70ba..a024860d82 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/DefaultJpaValidationMessages.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/DefaultJpaValidationMessages.java
@@ -14,8 +14,8 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.jpa.core.JpaNode;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.prefs.JpaValidationPreferencesManager;
+import org.eclipse.jpt.jpa.core.JpaPreferences;
+import org.eclipse.jpt.jpa.core.internal.plugin.JptJpaCorePlugin;
import org.eclipse.wst.validation.internal.core.Message;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
@@ -61,7 +61,7 @@ public class DefaultJpaValidationMessages {
if (textRange == null) {
textRange = DEFAULT_TEXT_RANGE;
// log the exception but allow the message to still be used
- JptJpaCorePlugin.log(new NullPointerException("Null text range for message ID: " + messageId)); //$NON-NLS-1$
+ JptJpaCorePlugin.instance().logError(new NullPointerException("Null text range for message ID: " + messageId)); //$NON-NLS-1$
}
int lineNumber = textRange.getLineNumber();
message.setLineNo(lineNumber);
@@ -95,16 +95,31 @@ public class DefaultJpaValidationMessages {
/* CU private */ static class GenericMessageFactory
implements MessageFactory
{
- public IMessage buildMessage(int severity, String messageId, String[] parms, IResource targetObject) {
+ public IMessage buildMessage(int severity, String messageID, String[] parms, IResource targetObject) {
// check for preference override
- int prefSeverity = JpaValidationPreferencesManager.getProblemSeverityPreference(targetObject, messageId);
- if (prefSeverity != JpaValidationPreferencesManager.NO_SEVERITY_PREFERENCE){
- severity = prefSeverity;
- }
- IMessage message = new Message(JpaValidationMessages.BUNDLE_NAME, severity, messageId, parms, targetObject);
- message.setMarkerId(JptJpaCorePlugin.VALIDATION_MARKER_ID);
+ severity = this.getProblemSeverity(targetObject, messageID, severity);
+ IMessage message = new Message(JpaValidationMessages.BUNDLE_NAME, severity, messageID, parms, targetObject);
+ message.setMarkerId(JpaValidator.MARKER_ID);
return message;
}
+
+ private int getProblemSeverity(IResource targetObject, String messageID, int defaultSeverity) {
+ String pref = JpaPreferences.getProblemSeverity(targetObject.getProject(), messageID);
+ if (pref == null) {
+ return defaultSeverity;
+ }
+ if (pref.equals(JpaPreferences.PROBLEM_ERROR)) {
+ return IMessage.HIGH_SEVERITY;
+ }
+ if (pref.equals(JpaPreferences.PROBLEM_WARNING)) {
+ return IMessage.NORMAL_SEVERITY;
+ }
+ if (pref.equals(JpaPreferences.PROBLEM_INFO)) {
+ return IMessage.LOW_SEVERITY;
+ }
+ return defaultSeverity;
+ }
+
@Override
public String toString() {
return StringTools.buildToStringFor(this);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaValidator.java
index 8906e7d6af..eb01ed082f 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaValidator.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaValidator.java
@@ -14,9 +14,10 @@ import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jpt.common.utility.internal.Tools;
+import org.eclipse.jpt.jpa.core.JpaPreferences;
import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.prefs.JpaValidationPreferencesManager;
+import org.eclipse.jpt.jpa.core.internal.plugin.JptJpaCorePlugin;
import org.eclipse.wst.validation.AbstractValidator;
import org.eclipse.wst.validation.ValidationResult;
import org.eclipse.wst.validation.ValidationState;
@@ -31,9 +32,18 @@ import org.eclipse.wst.validation.internal.provisional.core.IValidator;
* WTP validator extension point.
*/
public class JpaValidator
- extends AbstractValidator
- implements IValidator {
-
+ extends AbstractValidator
+ implements IValidator
+{
+
+ public static final String RELATIVE_MARKER_ID = "problemMarker"; //$NON-NLS-1$
+
+ /**
+ * The identifier for the JPA validation marker
+ * (value <code>"org.eclipse.jpt.jpa.core.problemMarker"</code>).
+ */
+ public static final String MARKER_ID = JptJpaCorePlugin.instance().getPluginID() + '.' + RELATIVE_MARKER_ID;
+
public JpaValidator() {
super();
}
@@ -72,12 +82,12 @@ public class JpaValidator
try {
this.clearMarkers_(project);
} catch (CoreException ex) {
- JptJpaCorePlugin.log(ex);
+ JptJpaCorePlugin.instance().logError(ex);
}
}
private void clearMarkers_(IProject project) throws CoreException {
- IMarker[] markers = project.findMarkers(JptJpaCorePlugin.VALIDATION_MARKER_ID, true, IResource.DEPTH_INFINITE);
+ IMarker[] markers = project.findMarkers(MARKER_ID, true, IResource.DEPTH_INFINITE);
for (IMarker marker : markers) {
marker.delete();
}
@@ -91,10 +101,9 @@ public class JpaValidator
// wait until we actually get the new messages before we clear out the old messages
this.clearMarkers(project);
- JpaValidationPreferencesManager prefsManager = new JpaValidationPreferencesManager(project);
for (IMessage message : messages) {
// check preferences for IGNORE
- if (prefsManager.problemIsNotIgnored(message.getId())) {
+ if (Tools.valuesAreDifferent(JpaPreferences.getProblemSeverity(project, message.getId()), JpaPreferences.PROBLEM_IGNORE)) {
reporter.addMessage(this, message);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/JpaProject2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/JpaProject2_0.java
index a9ad79314a..2cdbd731f6 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/JpaProject2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/JpaProject2_0.java
@@ -13,6 +13,7 @@ import org.eclipse.core.resources.IFile;
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jpt.common.core.resource.java.JavaResourceAbstractType;
import org.eclipse.jpt.jpa.core.JpaProject;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
/**
* JPA 2.0 project.
@@ -26,9 +27,24 @@ import org.eclipse.jpt.jpa.core.JpaProject;
* @version 2.3
* @since 2.3
*/
+// TODO no need to extend MetamodelSynchronizer - methods should be internal...
public interface JpaProject2_0
extends JpaProject, MetamodelSynchronizer
{
+ // ********** JPA facet **********
+
+ /**
+ * The JPA 2.0 project facet version string.
+ * <p>
+ * Value: {@value}
+ */
+ String FACET_VERSION_STRING = "2.0"; //$NON-NLS-1$
+
+ /**
+ * The JPA 2.0 project facet version.
+ */
+ IProjectFacetVersion FACET_VERSION = FACET.getVersion(FACET_VERSION_STRING);
+
// ********** Canonical Metamodel **********
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/persistence/Persistence2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/persistence/Persistence2_0.java
index 1a8cf4126e..4f4183a421 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/persistence/Persistence2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/persistence/Persistence2_0.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2012 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.
@@ -27,5 +27,5 @@ import org.eclipse.jpt.jpa.core.jpa2.MetamodelSynchronizer;
public interface Persistence2_0
extends Persistence, MetamodelSynchronizer
{
- // nothing yet...
+ // combine interfaces
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/persistence/PersistenceXml2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/persistence/PersistenceXml2_0.java
index c707a9d6c2..7f8c472061 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/persistence/PersistenceXml2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/persistence/PersistenceXml2_0.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2012 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.
@@ -27,5 +27,5 @@ import org.eclipse.jpt.jpa.core.jpa2.MetamodelSynchronizer;
public interface PersistenceXml2_0
extends PersistenceXml, MetamodelSynchronizer
{
- // nothing yet...
+ // combine interfaces
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/JpaJpqlQueryHelper.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/JpaJpqlQueryHelper.java
index cd13055395..5fdff81ffd 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/JpaJpqlQueryHelper.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/JpaJpqlQueryHelper.java
@@ -14,10 +14,10 @@
package org.eclipse.jpt.jpa.core.jpql;
import java.util.List;
-import org.eclipse.core.resources.IResource;
import org.eclipse.jpt.common.core.internal.utility.SimpleTextRange;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.common.utility.internal.StringTools;
+import org.eclipse.jpt.jpa.core.JpaPreferences;
import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.context.AttributeMapping;
import org.eclipse.jpt.jpa.core.context.NamedQuery;
@@ -27,7 +27,6 @@ import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
import org.eclipse.jpt.jpa.core.jpql.spi.IManagedTypeBuilder;
import org.eclipse.jpt.jpa.core.jpql.spi.JpaManagedTypeProvider;
import org.eclipse.jpt.jpa.core.jpql.spi.JpaQuery;
-import org.eclipse.jpt.jpa.core.prefs.JpaValidationPreferencesManager;
import org.eclipse.persistence.jpa.jpql.AbstractJPQLQueryHelper;
import org.eclipse.persistence.jpa.jpql.ExpressionTools;
import org.eclipse.persistence.jpa.jpql.JPQLQueryProblem;
@@ -173,7 +172,7 @@ public abstract class JpaJpqlQueryHelper extends AbstractJPQLQueryHelper {
// Now create the message
IMessage message = DefaultJpaValidationMessages.buildMessage(
- severity(namedQuery.getResource()),
+ IMessage.HIGH_SEVERITY,
problem.getMessageKey(),
problem.getMessageArguments(),
namedQuery,
@@ -201,8 +200,8 @@ public abstract class JpaJpqlQueryHelper extends AbstractJPQLQueryHelper {
}
protected String getValidationPreference(NamedQuery namedQuery) {
- return JpaValidationPreferencesManager.getProblemPreference(
- namedQuery.getResource(),
+ return JpaPreferences.getProblemSeverity(
+ namedQuery.getResource().getProject(),
JpaValidationMessages.JPQL_QUERY_VALIDATION);
}
@@ -223,27 +222,10 @@ public abstract class JpaJpqlQueryHelper extends AbstractJPQLQueryHelper {
super.setQuery(query);
}
- /**
- * Retrieve the severity that is associated to JPQL query validation, which cannot be retrieved
- * using the JPQL problem message key.
-
- * @param targetObject The object for which a new {@link IMessage} is creating describing the
- * problem
- * @return The global severity for validating JPQL queries. The default is {@link IMessage#HIGH_SEVERITY}.
- */
- protected int severity(IResource targetObject) {
- int severity = JpaValidationPreferencesManager.getProblemSeverityPreference(
- targetObject, JpaValidationMessages.JPQL_QUERY_VALIDATION);
- if (severity == JpaValidationPreferencesManager.NO_SEVERITY_PREFERENCE) {
- return IMessage.HIGH_SEVERITY;
- }
- return severity;
- }
-
protected boolean shouldValidate(NamedQuery namedQuery) {
return ! StringTools.stringsAreEqual(
getValidationPreference(namedQuery),
- JpaValidationPreferencesManager.IGNORE);
+ JpaPreferences.PROBLEM_IGNORE);
}
/**
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaType.java
index b93bb81838..abbcf943fc 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaType.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpql/spi/JpaType.java
@@ -39,7 +39,7 @@ import org.eclipse.jdt.core.dom.ITypeBinding;
import org.eclipse.jdt.core.dom.NodeFinder;
import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools;
import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.internal.plugin.JptJpaCorePlugin;
import org.eclipse.persistence.jpa.jpql.ExpressionTools;
import org.eclipse.persistence.jpa.jpql.spi.IConstructor;
import org.eclipse.persistence.jpa.jpql.spi.ITypeDeclaration;
@@ -160,7 +160,7 @@ public class JpaType implements IJpaType {
}
}
catch (Exception e) {
- JptJpaCorePlugin.log(e);
+ JptJpaCorePlugin.instance().logError(e);
}
return constructors;
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/platform/GenericPlatform.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/platform/GenericPlatform.java
deleted file mode 100644
index 35738d1dd8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/platform/GenericPlatform.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 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.jpa.core.platform;
-
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-
-/**
- * Constants pertaining to the Generic JPA platforms and their group.
- *
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- *
- * @version 3.0
- * @since 3.0
- */
-public class GenericPlatform {
-
- public static final JpaPlatformGroupDescription GROUP
- = JptJpaCorePlugin.getJpaPlatformManager().getJpaPlatformGroup("generic"); //$NON-NLS-1$
-
- public static final JpaPlatformDescription VERSION_1_0
- = JptJpaCorePlugin.getJpaPlatformManager().getJpaPlatform("generic"); //$NON-NLS-1$
-
- public static final JpaPlatformDescription VERSION_2_0
- = JptJpaCorePlugin.getJpaPlatformManager().getJpaPlatform("generic2_0"); //$NON-NLS-1$
-
- /**
- * Not for instantiation
- */
- private GenericPlatform() {}
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/platform/JpaPlatformDescription.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/platform/JpaPlatformDescription.java
index f695f5a549..ef6a5f186d 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/platform/JpaPlatformDescription.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/platform/JpaPlatformDescription.java
@@ -1,19 +1,25 @@
/*******************************************************************************
- * Copyright (c) 2010 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
- *******************************************************************************/
+ * Copyright (c) 2010, 2012 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.jpa.core.platform;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
/**
- * Contains metadata that describes a JPA platform. Not intended to be implemented by clients.
- *
+ * Metadata that describes a JPA platform as defined in an
+ * extension to the <code>org.eclipse.jpt.jpa.core.jpaPlatforms</code>
+ * extension point.
+ * <p>
+ * See <code>org.eclipse.jpt.jpa.core/plugin.xml:jpaPlatforms</code>.
+ * <p>
+ * Not intended to be implemented by clients.
+ * <p>
* Provisional API: This interface is part of an interim API that is still
* under development and expected to change significantly before reaching
* stability. It is available at this early stage to solicit feedback from
@@ -24,18 +30,55 @@ import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
* @since 3.0
*/
public interface JpaPlatformDescription {
-
- public String getId();
-
- public String getPluginId();
-
- public String getLabel();
-
- public String getFactoryClassName();
-
- public boolean supportsJpaFacetVersion(IProjectFacetVersion jpaFacetVersion);
-
- public boolean isDefault();
-
- public JpaPlatformGroupDescription getGroup();
+ /**
+ * Return the description's manager.
+ */
+ JpaPlatformManager getJpaPlatformManager();
+
+ /**
+ * Return the description's extension-supplied ID.
+ * This is unique among all the JPA platform descriptions.
+ */
+ String getId();
+
+ /**
+ * Return the description's extension-supplied label.
+ */
+ String getLabel();
+
+ /**
+ * Return the description's extension-supplied factory class name.
+ * The class must be instantiable and implement the
+ * {@link org.eclipse.jpt.jpa.core.JpaPlatformFactory} interface.
+ */
+ String getFactoryClassName();
+
+ /**
+ * Return whether the description's JPA platform supports the specified
+ * JPA facet version. If the extension specifies a JPA facet version, it
+ * must be the same as the specified JPA facet version. If the extension
+ * does <em>not</em> specify a JPA facet verion, the description's JPA
+ * platform supports all JPA facet versions.
+ * @exception IllegalArgumentException if the specified facet version is
+ * not for a JPA facet
+ */
+ boolean supportsJpaFacetVersion(IProjectFacetVersion jpaFacetVersion);
+
+ /**
+ * Return whether the description's JPA platform can be used as the default
+ * JPA platform for its {@link #supportsJpaFacetVersion(IProjectFacetVersion)
+ * supported JPA facet versions}.
+ */
+ boolean isDefault();
+
+ /**
+ * Return description's group description.
+ */
+ JpaPlatformGroupDescription getGroupDescription();
+
+ /**
+ * Return the ID of the plug-in that contributed the JPA platform
+ * description.
+ */
+ String getPluginId();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/platform/JpaPlatformGroupDescription.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/platform/JpaPlatformGroupDescription.java
index 2da2975284..765437ac9b 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/platform/JpaPlatformGroupDescription.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/platform/JpaPlatformGroupDescription.java
@@ -1,17 +1,23 @@
/*******************************************************************************
- * Copyright (c) 2010 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
- *******************************************************************************/
+ * Copyright (c) 2010, 2012 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.jpa.core.platform;
/**
- * Contains metadata that describes a JPA platform group. Not intended to be implemented by clients.
- *
+ * Metadata that describes a JPA platform group as defined in an
+ * extension to the <code>org.eclipse.jpt.jpa.core.jpaPlatforms</code>
+ * extension point.
+ * <p>
+ * See <code>org.eclipse.jpt.jpa.core/plugin.xml:jpaPlatforms</code>.
+ * <p>
+ * Not intended to be implemented by clients.
+ * <p>
* Provisional API: This interface is part of an interim API that is still
* under development and expected to change significantly before reaching
* stability. It is available at this early stage to solicit feedback from
@@ -22,12 +28,30 @@ package org.eclipse.jpt.jpa.core.platform;
* @since 3.0
*/
public interface JpaPlatformGroupDescription {
-
- public String getId();
-
- public String getPluginId();
-
- public String getLabel();
-
- public Iterable<JpaPlatformDescription> getPlatforms();
+ /**
+ * Return the description's manager.
+ */
+ JpaPlatformManager getJpaPlatformManager();
+
+ /**
+ * Return the JPA platform group description's extension-supplied ID.
+ * This is unique among all the JPA platform group descriptions.
+ */
+ String getId();
+
+ /**
+ * Return the JPA platform group description's extension-supplied label.
+ */
+ String getLabel();
+
+ /**
+ * Return the JPA platform descriptions that belong to the group.
+ */
+ Iterable<JpaPlatformDescription> getJpaPlatformDescriptions();
+
+ /**
+ * Return the ID of the plug-in that contributed the JPA platform group
+ * description.
+ */
+ String getPluginId();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/platform/JpaPlatformManager.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/platform/JpaPlatformManager.java
index 9e510e6295..5173113de6 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/platform/JpaPlatformManager.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/platform/JpaPlatformManager.java
@@ -1,46 +1,96 @@
/*******************************************************************************
- * Copyright (c) 2010 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
- *******************************************************************************/
+ * Copyright (c) 2010, 2012 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.jpa.core.platform;
-import org.eclipse.core.resources.IProject;
import org.eclipse.jpt.jpa.core.JpaPlatform;
+import org.eclipse.jpt.jpa.core.JpaWorkspace;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
/**
- * Entry point to the "jpaPlatforms" extension point
- *
+ * The <code>org.eclipse.jpt.jpa.core.jpaPlatforms</code> extension point
+ * corresponding to a {@link JpaWorkspace JPA workspace}.
+ * <p>
+ * See <code>org.eclipse.jpt.jpa.core/plugin.xml:jpaPlatforms</code>.
+ * <p>
+ * Not intended to be implemented by clients.
+ * <p>
* Provisional API: This interface is part of an interim API that is still
* under development and expected to change significantly before reaching
* stability. It is available at this early stage to solicit feedback from
* pioneering adopters on the understanding that any code that uses this API
* will almost certainly be broken (repeatedly) as the API evolves.
*
+ * @see JpaPlatform
+ * @see JpaPlatformDescription
* @version 3.0
* @since 3.0
*/
public interface JpaPlatformManager {
-
- Iterable<JpaPlatformGroupDescription> getJpaPlatformGroups();
-
- JpaPlatformGroupDescription getJpaPlatformGroup(String groupId);
-
- Iterable<JpaPlatformDescription> getJpaPlatforms();
-
- JpaPlatformDescription getJpaPlatform(String platformId);
-
- /**
- * Returns the first JPA platform registered as a default platform and which supports the given
+ /**
+ * Return the manager's JPA workspace.
+ */
+ JpaWorkspace getJpaWorkspace();
+
+
+ // ********** JPA platforms **********
+
+ /**
+ * Return the JPA platform for the specified ID.
+ */
+ JpaPlatform getJpaPlatform(String jpaPlatformID);
+
+
+ // ********** JPA platform group descriptions **********
+
+ /**
+ * Return all the JPA platform group descriptions.
+ */
+ Iterable<JpaPlatformGroupDescription> getJpaPlatformGroupDescriptions();
+
+ /**
+ * Return the JPA platform group description for the specified ID.
+ */
+ JpaPlatformGroupDescription getJpaPlatformGroupDescription(String groupID);
+
+
+ // ********** JPA platform descriptions **********
+
+ /**
+ * Return all the JPA platform descriptions.
+ */
+ Iterable<JpaPlatformDescription> getJpaPlatformDescriptions();
+
+ /**
+ * Return the JPA platform description for the specified ID.
+ */
+ JpaPlatformDescription getJpaPlatformDescription(String jpaPlatformID);
+
+ /**
+ * Return the JPA platform descriptions that support the specified
+ * JPA facet version.
+ */
+ Iterable<JpaPlatformDescription> getJpaPlatformDescriptions(IProjectFacetVersion jpaFacetVersion);
+
+
+ // ********** default JPA platform description **********
+
+ /**
+ * Return the JPA platform description that is the workspace's default for
+ * the specified JPA facet version.
+ */
+ JpaPlatformDescription getDefaultJpaPlatformDescription(IProjectFacetVersion jpaFacetVersion);
+
+ /**
+ * Set the workspace's default JPA platform description for the specified
* JPA facet version.
- * Returns null if there are no such registered platforms.
+ * @see #getDefaultJpaPlatformDescription(IProjectFacetVersion)
*/
- JpaPlatformDescription getDefaultJpaPlatform(IProjectFacetVersion jpaFacetVersion);
-
- JpaPlatform buildJpaPlatformImplementation(IProject project);
+ void setDefaultJpaPlatformDescription(IProjectFacetVersion jpaFacetVersion, JpaPlatformDescription description);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/prefs/JpaEntityGenPreferencesManager.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/prefs/JpaEntityGenPreferencesManager.java
deleted file mode 100644
index 653874c366..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/prefs/JpaEntityGenPreferencesManager.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2012 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.jpa.core.prefs;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.jpa.core.internal.prefs.JpaPreferencesManager;
-/**
- * JpaEntityGenPreferencesManager
- */
-public class JpaEntityGenPreferencesManager extends JpaPreferencesManager
-{
- // ********** public constants **********
-
- private static final String ENTITY_GEN_PREFIX = "entitygen."; //$NON-NLS-1$
-
- public static final String DEFAULT_PACKAGE = "DEFAULT_PACKAGE"; //$NON-NLS-1$
-
- public static final String DEFAULT_PACKAGE_NAME = "model"; //$NON-NLS-1$
-
- // ********** static methods **************************************************
-
- public static String getDefaultPackageWorkspacePreference() {
- return getLegacyWorkspacePreference(appendPrefix(DEFAULT_PACKAGE), getDefaultDefaultPackage());
- }
-
- public static void setDefaultPackageWorkspacePreference(String value) {
- if(StringTools.stringsAreEqual(value, getDefaultDefaultPackage())) {
- removeLegacyWorkspacePreference(appendPrefix(DEFAULT_PACKAGE));
- }
- else {
- setLegacyWorkspacePreference(appendPrefix(DEFAULT_PACKAGE), value);
- }
- }
-
- public static String getDefaultDefaultPackage() {
- return DEFAULT_PACKAGE_NAME;
- }
-
- private static String appendPrefix(String prefId) {
- return ENTITY_GEN_PREFIX + prefId;
- }
-
- // ********** implementation **************************************************
-
- public JpaEntityGenPreferencesManager(IProject project) {
- super(project);
- }
-
- // ********** project preference **********
-
- public String getDefaultPackagePreference() {
- return this.getLegacyPreference(appendPrefix(DEFAULT_PACKAGE), getDefaultDefaultPackage());
- }
-
- public void setDefaultPackagePreference(String preferenceValue) {
- if(StringTools.stringsAreEqual(preferenceValue, getDefaultPackageWorkspacePreference())) {
- this.removeDefaultPackagePreference();
- }
- else {
- this.setLegacyProjectPreference(appendPrefix(DEFAULT_PACKAGE), preferenceValue);
- }
- }
-
- public void removeDefaultPackagePreference() {
- this.removeLegacyProjectPreference(appendPrefix(DEFAULT_PACKAGE));
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/prefs/JpaJpqlPreferencesManager.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/prefs/JpaJpqlPreferencesManager.java
deleted file mode 100644
index 21abb570d2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/prefs/JpaJpqlPreferencesManager.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2012 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.jpa.core.prefs;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.jpa.core.internal.prefs.JpaPreferencesManager;
-/**
- * JpaEntityGenPreferencesManager
- */
-public class JpaJpqlPreferencesManager extends JpaPreferencesManager
-{
- // ********** public constants **********
-
- private static final String JPQL_IDENTIFIER_PREFIX = "jpqlIdentifier.";
- public static final String JPQL_IDENTIFIER_LOWERCASE_PREF_VALUE = "lowercase"; //$NON-NLS-1$
- public static final String JPQL_IDENTIFIER_UPPERCASE_PREF_VALUE = "uppercase"; //$NON-NLS-1$
-
- public static final String CASE = "CASE"; //$NON-NLS-1$
- public static final String DEFAULT_CASE = JPQL_IDENTIFIER_LOWERCASE_PREF_VALUE; //$NON-NLS-1$
-
- public static final String MATCH_FIRST_CHARACTER_CASE = "MATCH_FIRST_CHARACTER_CASE"; //$NON-NLS-1$
- public static final boolean DEFAULT_MATCH_FIRST_CHARACTER_CASE = true; //$NON-NLS-1$
-
- // ********** workspace preference **********
-
- public static String getIdentifiersCaseWorkspacePreference() {
- return getLegacyWorkspacePreference(appendPrefix(CASE), getDefaultIdentifiersCase());
- }
-
- public static void setIdentifiersCaseWorkspacePreference(String value) {
- if(StringTools.stringsAreEqual(value, getDefaultIdentifiersCase())) {
- removeLegacyWorkspacePreference(appendPrefix(CASE));
- }
- else {
- setLegacyWorkspacePreference(appendPrefix(CASE), value);
- }
- }
-
- public static String getDefaultIdentifiersCase() {
- return DEFAULT_CASE;
- }
-
- public static boolean getMatchFirstCharacterCaseWorkspacePreference() {
- return getLegacyWorkspacePreference(appendPrefix(MATCH_FIRST_CHARACTER_CASE), getDefaultMatchFirstCharacterCase());
- }
-
- public static void setMatchFirstCharacterCaseWorkspacePreference(boolean value) {
- if(value == getDefaultMatchFirstCharacterCase()) {
- removeLegacyWorkspacePreference(appendPrefix(MATCH_FIRST_CHARACTER_CASE));
- }
- else {
- setLegacyWorkspacePreference(appendPrefix(MATCH_FIRST_CHARACTER_CASE), value);
- }
- }
-
- public static boolean getDefaultMatchFirstCharacterCase() {
- return DEFAULT_MATCH_FIRST_CHARACTER_CASE;
- }
-
- private static String appendPrefix(String prefId) {
- return JPQL_IDENTIFIER_PREFIX + prefId;
- }
-
- // ********** constructor **********
-
- public JpaJpqlPreferencesManager(IProject project) {
- super(project);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/prefs/JpaValidationPreferencesManager.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/prefs/JpaValidationPreferencesManager.java
deleted file mode 100644
index d65e4e18e8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/prefs/JpaValidationPreferencesManager.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2012 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.jpa.core.prefs;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jpt.common.utility.internal.Tools;
-import org.eclipse.jpt.jpa.core.internal.prefs.JpaPreferencesManager;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-/**
- * JpaValidationPreferencesManager
- */
-public class JpaValidationPreferencesManager extends JpaPreferencesManager
-{
- /*
- * prefix for all preference strings. This is only used internally.
- * Clients of get*LevelProblemPrefernce() and set*LevelProblemPreference
- * should not include the prefix.
- */
- private static final String PROBLEM_PREFIX = "problem."; //$NON-NLS-1$
-
- public static final String ERROR = "error"; //$NON-NLS-1$
- public static final String WARNING = "warning"; //$NON-NLS-1$
- public static final String INFO = "info"; //$NON-NLS-1$
- public static final String IGNORE = "ignore"; //$NON-NLS-1$
-
- public static final int NO_SEVERITY_PREFERENCE = -1;
-
- public static final String WORKSPACE_PREFERENCES_OVERRIDEN = "workspace_preferences_overriden"; //$NON-NLS-1$
-
- // ********** public static methods **********
-
- public static String getProblemPreference(IResource targetObject, String messageId) {
- return new JpaValidationPreferencesManager(targetObject.getProject()).
- getLegacyPreference(appendProblemPrefix(messageId));
-
- }
-
- /**
- * Returns only the severity level of a given problem preference. This does not
- * include information on whether the problem is ignored. See isProblemIgnored.
- * @return an IMessage severity level
- */
- public static int getProblemSeverityPreference(IResource targetObject, String messageId) {
- String problemPreference = getProblemPreference(targetObject, messageId);
-
- if(problemPreference == null) {
- return NO_SEVERITY_PREFERENCE;
- }
- else if (problemPreference.equals(ERROR)) {
- return IMessage.HIGH_SEVERITY;
- }
- else if (problemPreference.equals(WARNING)) {
- return IMessage.NORMAL_SEVERITY;
- }
- else if (problemPreference.equals(INFO)) {
- return IMessage.LOW_SEVERITY;
- }
- return NO_SEVERITY_PREFERENCE;
- }
-
-
- // ********** workspace preference **********
-
- /**
- * Returns the String value of the problem preference from the workspace preferences
- */
- public static String getWorkspaceLevelProblemPreference(String messageId) {
- return getLegacyWorkspacePreference(appendProblemPrefix(messageId));
- }
-
- public static void setWorkspaceLevelProblemPreference(String messageId, String problemPreference) {
- setLegacyWorkspacePreference(appendProblemPrefix(messageId), problemPreference);
- }
-
- protected static String appendProblemPrefix(String messageId) {
- return PROBLEM_PREFIX + messageId;
- }
-
- // ********** implementation **************************************************
-
- public JpaValidationPreferencesManager(IProject project) {
-
- super(project);
- }
-
- // ********** behavior **********
-
- /**
- * Return whether the specified problem should <em>not</em> be ignored based
- * on project or workspace preferences.
- */
- public boolean problemIsNotIgnored(String messageId) {
- return ! problemIsIgnored(messageId);
- }
-
- /**
- * Return whether the specified problem should be ignored based on project or
- * workspace preferences.
- */
- public boolean problemIsIgnored(String messageId) {
- return Tools.valuesAreEqual(this.getLegacyPreference(appendProblemPrefix(messageId)), IGNORE);
- }
-
- public boolean projectHasSpecificOptions() {
- return this.getLegacyProjectPreference(WORKSPACE_PREFERENCES_OVERRIDEN, false);
- }
-
- public void setProjectHasSpecificOptions(boolean booleanValue) {
- this.setLegacyProjectPreference(WORKSPACE_PREFERENCES_OVERRIDEN, booleanValue);
- }
-
- // ********** project preference **********
-
- /**
- * Returns the String value of the problem preference from the project preferences
- */
- public String getProjectLevelProblemPreference(String messageId) {
- return this.getLegacyProjectPreference(appendProblemPrefix(messageId));
- }
-
- public void setProjectLevelProblemPreference(String messageId, String problemPreference) {
- this.setLegacyProjectPreference(appendProblemPrefix(messageId), problemPreference);
- }
-
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/ResourceMappingFile.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/ResourceMappingFile.java
new file mode 100644
index 0000000000..bae53beb55
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/ResourceMappingFile.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.jpa.core.resource;
+
+import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.jpt.jpa.core.internal.plugin.JptJpaCorePlugin;
+
+/**
+ * Placeholder interface.
+ */
+public interface ResourceMappingFile {
+ /**
+ * The content of a resource mapping file.
+ */
+ interface Root {
+ /**
+ * The base content type for all mapping files.
+ */
+ IContentType CONTENT_TYPE = JptJpaCorePlugin.instance().getContentType("mappingFile"); //$NON-NLS-1$
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/OrmXmlResourceFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/OrmXmlResourceFactory.java
index 9703fbcae1..2ee9e17b21 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/OrmXmlResourceFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/OrmXmlResourceFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 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.
@@ -10,7 +10,6 @@
package org.eclipse.jpt.jpa.core.resource.orm;
import org.eclipse.emf.common.util.URI;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
import org.eclipse.wst.common.internal.emf.resource.Renderer;
import org.eclipse.wst.common.internal.emf.resource.RendererFactory;
@@ -42,6 +41,6 @@ public class OrmXmlResourceFactory
@Override
protected TranslatorResource createResource(URI uri, Renderer renderer) {
- return new JpaXmlResource(uri, renderer, JptJpaCorePlugin.ORM_XML_CONTENT_TYPE, XmlEntityMappings.getRootTranslator());
+ return new JpaXmlResource(uri, renderer, XmlEntityMappings.CONTENT_TYPE, XmlEntityMappings.getRootTranslator());
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlEntityMappings.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlEntityMappings.java
index 03dac0193b..fb3b0044ea 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlEntityMappings.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlEntityMappings.java
@@ -13,7 +13,9 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
-import java.util.Map;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.EList;
@@ -25,6 +27,7 @@ import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.jpt.common.core.internal.utility.translators.SimpleRootTranslator;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.jpa.core.internal.plugin.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.resource.orm.v2_0.JPA2_0;
import org.eclipse.jpt.jpa.core.resource.xml.AbstractJpaRootEObject;
import org.eclipse.text.edits.ReplaceEdit;
@@ -988,8 +991,6 @@ public class XmlEntityMappings extends AbstractJpaRootEObject implements XmlQuer
return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
}
- // **************** overrides **********************************************
-
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -1014,45 +1015,62 @@ public class XmlEntityMappings extends AbstractJpaRootEObject implements XmlQuer
result.append(')');
return result.toString();
}
-
+
+
+ // ********** type mappings **********
+
public List<XmlTypeMapping> getTypeMappings() {
- // convert lists to arrays to avoid ConcurrentModificationException while adding to result list
+ // convert lists to arrays to *reduce* risk of ConcurrentModificationException
ArrayList<XmlTypeMapping> typeMappings = new ArrayList<XmlTypeMapping>();
CollectionTools.addAll(typeMappings, this.getMappedSuperclasses().toArray(EMPTY_XML_TYPE_MAPPING_ARRAY));
CollectionTools.addAll(typeMappings, this.getEntities().toArray(EMPTY_XML_TYPE_MAPPING_ARRAY));
CollectionTools.addAll(typeMappings, this.getEmbeddables().toArray(EMPTY_XML_TYPE_MAPPING_ARRAY));
return typeMappings;
}
-
+
private static final XmlTypeMapping[] EMPTY_XML_TYPE_MAPPING_ARRAY = new XmlTypeMapping[0];
-
-
- // **************** version -> schema location mapping ********************
-
- private static String namespace = JPA.SCHEMA_NAMESPACE;
-
+
+
+ // ********** version -> schema location mapping **********
+
@Override
protected String getNamespace() {
- return namespace;
+ return JPA.SCHEMA_NAMESPACE;
}
-
- private static Map<String, String> versionsToSchemaLocations = buildVersionsToSchemaLocations();
-
- private static Map<String, String> buildVersionsToSchemaLocations() {
- Map<String, String> map = new HashMap<String, String>();
+
+ @Override
+ protected String getSchemaLocationForVersion(String schemaVersion) {
+ return SCHEMA_LOCATIONS.get(schemaVersion);
+ }
+
+ private static final HashMap<String, String> SCHEMA_LOCATIONS = buildSchemaLocations();
+
+ private static HashMap<String, String> buildSchemaLocations() {
+ HashMap<String, String> map = new HashMap<String, String>();
map.put(JPA.SCHEMA_VERSION, JPA.SCHEMA_LOCATION);
map.put(JPA2_0.SCHEMA_VERSION, JPA2_0.SCHEMA_LOCATION);
return map;
}
-
- @Override
- protected String getSchemaLocationForVersion(String version) {
- return versionsToSchemaLocations.get(version);
- }
-
-
- // **************** translators *******************************************
-
+
+
+ // ********** content type **********
+
+ /**
+ * The content type for <code>orm.xml</code> mapping files.
+ * @see org.eclipse.jpt.jpa.core.resource.ResourceMappingFile.Root#CONTENT_TYPE
+ */
+ public static final IContentType CONTENT_TYPE = JptJpaCorePlugin.instance().getContentType("orm"); //$NON-NLS-1$
+
+
+ // ********** default runtime path **********
+
+ public static final String DEFAULT_RUNTIME_PATH_NAME = "META-INF/orm.xml"; //$NON-NLS-1$
+
+ public static final IPath DEFAULT_RUNTIME_PATH = new Path(DEFAULT_RUNTIME_PATH_NAME);
+
+
+ // ********** translators **********
+
public static Translator getRootTranslator() {
return ROOT_TRANSLATOR;
}
@@ -1060,19 +1078,15 @@ public class XmlEntityMappings extends AbstractJpaRootEObject implements XmlQuer
private static final Translator ROOT_TRANSLATOR = buildRootTranslator();
private static Translator buildRootTranslator() {
- return new SimpleRootTranslator(
- JPA.ENTITY_MAPPINGS,
- OrmPackage.eINSTANCE.getXmlEntityMappings(),
- buildTranslatorChildren()
- );
+ return new SimpleRootTranslator(JPA.ENTITY_MAPPINGS, OrmPackage.eINSTANCE.getXmlEntityMappings(), buildTranslatorChildren());
}
-
+
private static Translator[] buildTranslatorChildren() {
return new Translator[] {
- buildVersionTranslator(versionsToSchemaLocations),
- buildNamespaceTranslator(namespace),
+ buildVersionTranslator(SCHEMA_LOCATIONS),
+ buildNamespaceTranslator(JPA.SCHEMA_NAMESPACE),
buildSchemaNamespaceTranslator(),
- buildSchemaLocationTranslator(namespace, versionsToSchemaLocations),
+ buildSchemaLocationTranslator(JPA.SCHEMA_NAMESPACE, SCHEMA_LOCATIONS),
buildDescriptionTranslator(),
XmlPersistenceUnitMetadata.buildTranslator(JPA.PERSISTENCE_UNIT_METADATA, OrmPackage.eINSTANCE.getXmlEntityMappings_PersistenceUnitMetadata()),
buildPackageTranslator(),
@@ -1089,22 +1103,23 @@ public class XmlEntityMappings extends AbstractJpaRootEObject implements XmlQuer
XmlEmbeddable.buildTranslator(JPA.EMBEDDABLE, OrmPackage.eINSTANCE.getXmlEntityMappings_Embeddables()),
};
}
+
protected static Translator buildDescriptionTranslator() {
return new Translator(JPA.DESCRIPTION, OrmPackage.eINSTANCE.getXmlEntityMappings_Description());
}
-
+
protected static Translator buildPackageTranslator() {
return new Translator(JPA.PACKAGE, OrmPackage.eINSTANCE.getXmlEntityMappings_Package());
}
-
+
protected static Translator buildSchemaTranslator() {
return new Translator(JPA.SCHEMA, OrmPackage.eINSTANCE.getXmlEntityMappings_Schema());
}
-
+
protected static Translator buildCatalogTranslator() {
return new Translator(JPA.CATALOG, OrmPackage.eINSTANCE.getXmlEntityMappings_Catalog());
}
-
+
protected static Translator buildAccessTranslator() {
return new Translator(JPA.ACCESS, OrmPackage.eINSTANCE.getXmlAccessHolder_Access());
}
@@ -1117,8 +1132,9 @@ public class XmlEntityMappings extends AbstractJpaRootEObject implements XmlQuer
return new ReplaceEdit(offset, this.package_.length(), newName);
}
+
// *********** content assist *********
-
+
public boolean schemaTouches(int pos) {
TextRange textRange = this.getElementCodeAssistTextRange(JPA.SCHEMA);
return (textRange != null) && (textRange.touches(pos));
@@ -1133,5 +1149,4 @@ public class XmlEntityMappings extends AbstractJpaRootEObject implements XmlQuer
TextRange textRange = this.getElementCodeAssistTextRange(JPA.PACKAGE);
return (textRange != null) && (textRange.touches(pos));
}
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/PersistenceXmlResourceFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/PersistenceXmlResourceFactory.java
index 4d10dbb3dc..f51b3f1c2b 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/PersistenceXmlResourceFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/PersistenceXmlResourceFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2012 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.
@@ -11,7 +11,6 @@
package org.eclipse.jpt.jpa.core.resource.persistence;
import org.eclipse.emf.common.util.URI;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
import org.eclipse.wst.common.internal.emf.resource.Renderer;
import org.eclipse.wst.common.internal.emf.resource.RendererFactory;
@@ -47,6 +46,6 @@ public class PersistenceXmlResourceFactory extends TranslatorResourceFactory
*/
@Override
protected TranslatorResource createResource(URI uri, Renderer renderer) {
- return new JpaXmlResource(uri, renderer, JptJpaCorePlugin.PERSISTENCE_XML_CONTENT_TYPE, XmlPersistence.getRootTranslator());
+ return new JpaXmlResource(uri, renderer, XmlPersistence.CONTENT_TYPE, XmlPersistence.getRootTranslator());
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlPersistence.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlPersistence.java
index 0b1599a171..635ce68ef3 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlPersistence.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlPersistence.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2012 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,12 +7,13 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-
package org.eclipse.jpt.jpa.core.resource.persistence;
import java.util.Collection;
import java.util.HashMap;
-import java.util.Map;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
@@ -21,6 +22,7 @@ import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.jpt.common.core.internal.utility.translators.SimpleRootTranslator;
+import org.eclipse.jpt.jpa.core.internal.plugin.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.resource.persistence.v2_0.JPA2_0;
import org.eclipse.jpt.jpa.core.resource.xml.AbstractJpaRootEObject;
import org.eclipse.wst.common.internal.emf.resource.Translator;
@@ -59,6 +61,7 @@ public class XmlPersistence extends AbstractJpaRootEObject
*/
protected EList<XmlPersistenceUnit> persistenceUnits;
+
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -196,53 +199,63 @@ public class XmlPersistence extends AbstractJpaRootEObject
}
return super.eIsSet(featureID);
}
-
-
- // **************** version -> schema location mapping ********************
-
- private static String namespace = JPA.SCHEMA_NAMESPACE;
-
+
+
+ // ********** version -> schema location mapping **********
+
@Override
protected String getNamespace() {
- return namespace;
+ return JPA.SCHEMA_NAMESPACE;
}
-
- private static Map<String, String> versionsToSchemaLocations = buildVersionsToSchemaLocations();
-
- private static Map<String, String> buildVersionsToSchemaLocations() {
- Map<String, String> map = new HashMap<String, String>();
+
+ @Override
+ protected String getSchemaLocationForVersion(String schemaVersion) {
+ return SCHEMA_LOCATIONS.get(schemaVersion);
+ }
+
+ private static final HashMap<String, String> SCHEMA_LOCATIONS = buildSchemaLocations();
+
+ private static HashMap<String, String> buildSchemaLocations() {
+ HashMap<String, String> map = new HashMap<String, String>();
map.put(JPA.SCHEMA_VERSION, JPA.SCHEMA_LOCATION);
map.put(JPA2_0.SCHEMA_VERSION, JPA2_0.SCHEMA_LOCATION);
return map;
}
-
- @Override
- protected String getSchemaLocationForVersion(String version) {
- return versionsToSchemaLocations.get(version);
- }
-
-
- // **************** translators *******************************************
-
- private static final Translator ROOT_TRANSLATOR = buildRootTranslator();
-
+
+
+ // ********** content/resource type **********
+
+ /**
+ * The content type for <code>persistence.xml</code> files.
+ */
+ public static final IContentType CONTENT_TYPE = JptJpaCorePlugin.instance().getContentType("persistence"); //$NON-NLS-1$
+
+
+ // ********** default runtime path **********
+
+ public static final String DEFAULT_RUNTIME_PATH_NAME = "META-INF/persistence.xml"; //$NON-NLS-1$
+
+ public static final IPath DEFAULT_RUNTIME_PATH = new Path(DEFAULT_RUNTIME_PATH_NAME);
+
+
+ // ********** translators **********
+
public static Translator getRootTranslator() {
return ROOT_TRANSLATOR;
}
+ private static final Translator ROOT_TRANSLATOR = buildRootTranslator();
+
private static Translator buildRootTranslator() {
- return new SimpleRootTranslator(
- JPA.PERSISTENCE,
- PersistencePackage.eINSTANCE.getXmlPersistence(),
- buildTranslatorChildren());
+ return new SimpleRootTranslator(JPA.PERSISTENCE, PersistencePackage.eINSTANCE.getXmlPersistence(), buildTranslatorChildren());
}
private static Translator[] buildTranslatorChildren() {
return new Translator[] {
- buildVersionTranslator(versionsToSchemaLocations),
- buildNamespaceTranslator(namespace),
+ buildVersionTranslator(SCHEMA_LOCATIONS),
+ buildNamespaceTranslator(JPA.SCHEMA_NAMESPACE),
buildSchemaNamespaceTranslator(),
- buildSchemaLocationTranslator(namespace, versionsToSchemaLocations),
+ buildSchemaLocationTranslator(JPA.SCHEMA_NAMESPACE, SCHEMA_LOCATIONS),
XmlPersistenceUnit.buildTranslator(JPA.PERSISTENCE_UNIT, PersistencePackage.eINSTANCE.getXmlPersistence_PersistenceUnits())
};
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/xml/JpaXmlResource.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/xml/JpaXmlResource.java
index fba2afd075..0e50cb3e53 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/xml/JpaXmlResource.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/xml/JpaXmlResource.java
@@ -23,12 +23,14 @@ import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.jem.util.emf.workbench.WorkbenchResourceHelperBase;
import org.eclipse.jem.util.plugin.JEMUtilPlugin;
+import org.eclipse.jpt.common.core.ContentTypeReference;
import org.eclipse.jpt.common.core.JptResourceModel;
import org.eclipse.jpt.common.core.JptResourceModelListener;
import org.eclipse.jpt.common.core.JptResourceType;
+import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
import org.eclipse.jpt.common.utility.internal.ListenerList;
import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.internal.plugin.JptJpaCorePlugin;
import org.eclipse.jst.j2ee.internal.xml.J2EEXmlDtDEntityResolver;
import org.eclipse.wst.common.internal.emf.resource.Renderer;
import org.eclipse.wst.common.internal.emf.resource.Translator;
@@ -44,7 +46,7 @@ import org.xml.sax.EntityResolver;
* This is a non-blocking call; and as a result it will return <code>null</code>
* if the JPA XML resource or its JPA project is currently under construction.
* <p>
- * See <code>org.eclipse.jpt.jpa.core/plugin.xml</code>.
+ * See <code>org.eclipse.jpt.jpa.core/plugin.xml:org.eclipse.core.runtime.adapters</code>.
* <p>
* Provisional API: This interface is part of an interim API that is still
* under development and expected to change significantly before reaching
@@ -57,7 +59,7 @@ import org.xml.sax.EntityResolver;
*/
public class JpaXmlResource
extends TranslatorResourceImpl
- implements JptResourceModel
+ implements JptResourceModel, ContentTypeReference
{
/**
* cache the content type - if the content type changes, the JPA project
@@ -87,16 +89,18 @@ public class JpaXmlResource
}
/**
- * Build a new resource type every time(?).
+ * The XML schema version is required.
*/
public JptResourceType getResourceType() {
String version = this.getVersion();
- return ((this.contentType == null) || (version == null)) ?
- null :
- new JptResourceType(this.contentType, version);
+ return (version == null) ? null : this.getResourceType(version);
}
-
-
+
+ protected JptResourceType getResourceType(String version) {
+ return (this.contentType == null) ? null : PlatformTools.getResourceType(this.contentType, version);
+ }
+
+
// ********** BasicNotifierImpl override **********
/**
@@ -247,7 +251,7 @@ public class JpaXmlResource
try {
this.save(Collections.EMPTY_MAP);
} catch (IOException ex) {
- JptJpaCorePlugin.log(ex);
+ JptJpaCorePlugin.instance().logError(ex);
}
}
@@ -273,19 +277,31 @@ public class JpaXmlResource
protected void resourceModelChanged() {
for (JptResourceModelListener listener : this.resourceModelListenerList.getListeners()) {
- listener.resourceModelChanged(this);
+ try {
+ listener.resourceModelChanged(this);
+ } catch (Exception ex) {
+ JptJpaCorePlugin.instance().logError(ex);
+ }
}
}
protected void resourceModelReverted() {
for (JptResourceModelListener listener : this.resourceModelListenerList.getListeners()) {
- listener.resourceModelReverted(this);
+ try {
+ listener.resourceModelReverted(this);
+ } catch (Exception ex) {
+ JptJpaCorePlugin.instance().logError(ex);
+ }
}
}
protected void resourceModelUnloaded() {
for (JptResourceModelListener listener : this.resourceModelListenerList.getListeners()) {
- listener.resourceModelUnloaded(this);
+ try {
+ listener.resourceModelUnloaded(this);
+ } catch (Exception ex) {
+ JptJpaCorePlugin.instance().logError(ex);
+ }
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/JpaXmlResourceProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/xml/JpaXmlResourceProvider.java
index 5862c01b9a..51c95720d6 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/JpaXmlResourceProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/xml/JpaXmlResourceProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2012 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,10 +7,11 @@
* Contributors:
* Oracle - initial API and implementation
*******************************************************************************/
-package org.eclipse.jpt.jpa.core.resource;
+package org.eclipse.jpt.jpa.core.resource.xml;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
/**
* Provisional API: This interface is part of an interim API that is still
@@ -22,9 +23,11 @@ import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
* @version 2.2
* @since 2.2
*/
-public interface JpaXmlResourceProvider
-{
+public interface JpaXmlResourceProvider {
+
JpaXmlResource getXmlResource();
IStatus validateEdit(Object context);
+
+ JpaXmlResource createFileAndResource(Object config, IProgressMonitor monitor) throws CoreException;
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.db.ui/META-INF/MANIFEST.MF b/jpa/plugins/org.eclipse.jpt.jpa.db.ui/META-INF/MANIFEST.MF
index b3885ff7cb..fc69cdfae6 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.db.ui/META-INF/MANIFEST.MF
+++ b/jpa/plugins/org.eclipse.jpt.jpa.db.ui/META-INF/MANIFEST.MF
@@ -2,8 +2,9 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
-Bundle-SymbolicName: org.eclipse.jpt.jpa.db.ui
+Bundle-SymbolicName: org.eclipse.jpt.jpa.db.ui;singleton:=true
Bundle-Version: 2.0.0.qualifier
+Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.db/META-INF/MANIFEST.MF b/jpa/plugins/org.eclipse.jpt.jpa.db/META-INF/MANIFEST.MF
index ebc36c5a92..2c594870d8 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.db/META-INF/MANIFEST.MF
+++ b/jpa/plugins/org.eclipse.jpt.jpa.db/META-INF/MANIFEST.MF
@@ -2,19 +2,21 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
-Bundle-SymbolicName: org.eclipse.jpt.jpa.db
+Bundle-SymbolicName: org.eclipse.jpt.jpa.db;singleton:=true
Bundle-Version: 2.1.100.qualifier
-Bundle-Activator: org.eclipse.jpt.jpa.db.JptJpaDbPlugin
+Bundle-Activator: org.eclipse.jpt.jpa.db.internal.plugin.JptJpaDbPlugin
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)",
+ org.eclipse.core.resources;bundle-version="[3.4.0,4.0.0)",
org.eclipse.datatools.enablement.jdt.classpath;bundle-version="[1.0.1,2.0.0)",
org.eclipse.datatools.sqltools.editor.core;bundle-version="[1.0.0,2.0.0)",
org.eclipse.jdt.core;bundle-version="[3.4.0,4.0.0)",
+ org.eclipse.jpt.common.core;bundle-version="[1.2.0,2.0.0)",
org.eclipse.jpt.common.utility;bundle-version="[2.0.0,3.0.0)"
+Import-Package: com.ibm.icu.text;version="4.0.1"
Export-Package: org.eclipse.jpt.jpa.db,
org.eclipse.jpt.jpa.db.internal;x-internal:=true,
org.eclipse.jpt.jpa.db.internal.driver;x-internal:=true
-Import-Package: com.ibm.icu.text;version="4.0.1"
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.db/plugin.xml b/jpa/plugins/org.eclipse.jpt.jpa.db/plugin.xml
new file mode 100644
index 0000000000..c2d3622819
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.db/plugin.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<!--
+ Copyright (c) 2012 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
+ -->
+
+<plugin>
+
+ <!-- ***** adapters ***** -->
+
+ <extension
+ point="org.eclipse.core.runtime.adapters">
+
+ <!-- IWorkspace -> ConnectionProfileFactory -->
+ <factory
+ adaptableType="org.eclipse.core.resources.IWorkspace"
+ class="org.eclipse.jpt.jpa.db.internal.WorkspaceAdapterFactory">
+ <adapter type="org.eclipse.jpt.jpa.db.ConnectionProfileFactory"/>
+ </factory>
+
+ </extension>
+
+</plugin>
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/ConnectionProfileFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/ConnectionProfileFactory.java
index e31521820c..d5a3089ad1 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/ConnectionProfileFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/ConnectionProfileFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2012 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.
@@ -9,9 +9,20 @@
******************************************************************************/
package org.eclipse.jpt.jpa.db;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.jdt.core.IClasspathContainer;
+
/**
* Database connection profile factory
* <p>
+ * To retrieve the connection profile factory corresponding to an Eclipse workspace:
+ * <pre>
+ * IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ * ConnectionProfileFactory factory = (ConnectionProfileFactory) workspace.getAdapter(ConnectionProfileFactory.class);
+ * </pre>
+ * <p>
+ * See <code>org.eclipse.jpt.jpa.db/plugin.xml:org.eclipse.core.runtime.adapters</code>.
+ * <p>
* Provisional API: This interface is part of an interim API that is still
* under development and expected to change significantly before reaching
* stability. It is available at this early stage to solicit feedback from
@@ -21,6 +32,11 @@ package org.eclipse.jpt.jpa.db;
public interface ConnectionProfileFactory {
/**
+ * Return the factory's workspace.
+ */
+ IWorkspace getWorkspace();
+
+ /**
* Return the names of the DTP connection profiles the factory can wrap with
* new connection profiles.
*/
@@ -49,6 +65,12 @@ public interface ConnectionProfileFactory {
ConnectionProfile buildConnectionProfile(String name);
/**
+ * Build a Java classpath container for the specified driver.
+ * @see ConnectionProfile#getDriverName()
+ */
+ IClasspathContainer buildDriverClasspathContainer(String driverName);
+
+ /**
* Add a listener that will be notified of changes to the DTP
* connection profiles.
*/
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/JptJpaDbPlugin.java b/jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/JptJpaDbPlugin.java
deleted file mode 100644
index 473ab86097..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/JptJpaDbPlugin.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2011 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.jpa.db;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.datatools.enablement.jdt.classpath.DriverClasspathContainer;
-import org.eclipse.jdt.core.IClasspathContainer;
-import org.eclipse.jpt.jpa.db.internal.DTPConnectionProfileFactory;
-import org.osgi.framework.BundleContext;
-
-/**
- * The Dali JPA DB plug-in lifecycle implementation.
- * Globally available connection profile factory.
- * <p>
- * Provisional API: This class is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- */
-public class JptJpaDbPlugin
- extends Plugin
-{
- // lazy-initialized
- private DTPConnectionProfileFactory connectionProfileFactory;
-
- private static JptJpaDbPlugin INSTANCE; // sorta-final
-
- public static final String PLUGIN_ID = "org.eclipse.jpt.jpa.db"; //$NON-NLS-1$
-
- /**
- * Return the singleton JPT DB plug-in.
- */
- public static JptJpaDbPlugin instance() {
- return INSTANCE;
- }
-
-
- // ********** public static methods **********
-
- public static ConnectionProfileFactory getConnectionProfileFactory() {
- return INSTANCE.getConnectionProfileFactory_();
- }
-
-
- // ********** logging **********
-
- /**
- * Log the specified message.
- */
- public static void log(String msg) {
- log(msg, null);
- }
-
- /**
- * Log the specified exception or error.
- */
- public static void log(Throwable throwable) {
- log(throwable.getLocalizedMessage(), throwable);
- }
-
- /**
- * Log the specified message and exception or error.
- */
- public static void log(String msg, Throwable throwable) {
- log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, msg, throwable));
- }
-
- /**
- * Log the specified status.
- */
- public static void log(IStatus status) {
- INSTANCE.getLog().log(status);
- }
-
-
- // ********** plug-in implementation **********
-
- /**
- * The constructor
- */
- public JptJpaDbPlugin() {
- super();
- if (INSTANCE != null) {
- throw new IllegalStateException();
- }
- // this convention is *wack*... ~bjv
- INSTANCE = this;
- }
-
- /**
- * This method is called upon plug-in activation
- */
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- // the connection profile factory is lazy-initialized...
- }
-
- /**
- * This method is called when the plug-in is stopped
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- if (this.connectionProfileFactory != null) {
- this.connectionProfileFactory.stop();
- this.connectionProfileFactory = null;
- }
- INSTANCE = null;
- super.stop(context);
- }
-
- private synchronized ConnectionProfileFactory getConnectionProfileFactory_() {
- if (this.connectionProfileFactory == null) {
- this.connectionProfileFactory = this.buildConnectionProfileFactory();
- this.connectionProfileFactory.start();
- }
- return this.connectionProfileFactory;
- }
-
- private DTPConnectionProfileFactory buildConnectionProfileFactory() {
- return DTPConnectionProfileFactory.instance();
- }
-
- /**
- * Creates a jar list container for the given DTP driver.
- */
- public IClasspathContainer buildDriverClasspathContainerFor(String driverName) {
- return new DriverClasspathContainer(driverName);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/DTPConnectionProfileFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/DTPConnectionProfileFactory.java
index c59252543b..aa9cf9f6ee 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/DTPConnectionProfileFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/DTPConnectionProfileFactory.java
@@ -9,9 +9,12 @@
******************************************************************************/
package org.eclipse.jpt.jpa.db.internal;
+import org.eclipse.core.resources.IWorkspace;
import org.eclipse.datatools.connectivity.IConnectionProfile;
import org.eclipse.datatools.connectivity.IProfileListener1;
import org.eclipse.datatools.connectivity.ProfileManager;
+import org.eclipse.datatools.enablement.jdt.classpath.DriverClasspathContainer;
+import org.eclipse.jdt.core.IClasspathContainer;
import org.eclipse.jpt.common.utility.internal.ListenerList;
import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
@@ -26,24 +29,16 @@ import org.eclipse.jpt.jpa.db.DatabaseIdentifierAdapter;
public final class DTPConnectionProfileFactory
implements ConnectionProfileFactory
{
+ private final IWorkspace workspace;
+
private ProfileManager dtpProfileManager;
private LocalProfileListener profileListener;
- // ********** singleton **********
-
- private static final DTPConnectionProfileFactory INSTANCE = new DTPConnectionProfileFactory();
-
- public static DTPConnectionProfileFactory instance() {
- return INSTANCE;
- }
-
- /**
- * Access is <code>private</code> to ensure singleton
- */
- private DTPConnectionProfileFactory() {
+ public DTPConnectionProfileFactory(IWorkspace workspace) {
super();
+ this.workspace = workspace;
}
@@ -112,11 +107,22 @@ public final class DTPConnectionProfileFactory
}
+ // ********** misc **********
+
+ public IWorkspace getWorkspace() {
+ return this.workspace;
+ }
+
+ public IClasspathContainer buildDriverClasspathContainer(String driverName) {
+ return new DriverClasspathContainer(driverName);
+ }
+
@Override
public String toString() {
return this.getClass().getSimpleName();
}
+
// ********** listener **********
/**
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/WorkspaceAdapterFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/WorkspaceAdapterFactory.java
new file mode 100644
index 0000000000..dab5fe9b1f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/WorkspaceAdapterFactory.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.jpa.db.internal;
+
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.jpt.jpa.db.ConnectionProfileFactory;
+import org.eclipse.jpt.jpa.db.internal.plugin.JptJpaDbPlugin;
+
+/**
+ * Factory to build Dali database adapters for an {@link IWorkspace}:<ul>
+ * <li>{@link ConnectionProfileFactory}
+ * </ul>
+ * See <code>org.eclipse.jpt.db/plugin.xml:org.eclipse.core.runtime.adapters</code>.
+ */
+public class WorkspaceAdapterFactory
+ implements IAdapterFactory
+{
+ private static final Class<?>[] ADAPTER_LIST = new Class[] {
+ ConnectionProfileFactory.class
+ };
+
+ public Class<?>[] getAdapterList() {
+ return ADAPTER_LIST;
+ }
+
+ public Object getAdapter(Object adaptableObject, @SuppressWarnings("rawtypes") Class adapterType) {
+ if (adaptableObject instanceof IWorkspace) {
+ return this.getAdapter((IWorkspace) adaptableObject, adapterType);
+ }
+ return null;
+ }
+
+ private Object getAdapter(IWorkspace workspace, Class<?> adapterType) {
+ if (adapterType == ConnectionProfileFactory.class) {
+ return this.getConnectionProfileFactory(workspace);
+ }
+ return null;
+ }
+
+ private ConnectionProfileFactory getConnectionProfileFactory(IWorkspace workspace) {
+ return JptJpaDbPlugin.instance().getConnectionProfileFactory(workspace);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/driver/AbstractDTPDriverAdapter.java b/jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/driver/AbstractDTPDriverAdapter.java
index 6a3e845164..cb6afcc30e 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/driver/AbstractDTPDriverAdapter.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/driver/AbstractDTPDriverAdapter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2012 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.
@@ -30,10 +30,10 @@ import org.eclipse.jpt.jpa.db.Column;
import org.eclipse.jpt.jpa.db.ConnectionProfile;
import org.eclipse.jpt.jpa.db.Database;
import org.eclipse.jpt.jpa.db.DatabaseObject;
-import org.eclipse.jpt.jpa.db.JptJpaDbPlugin;
import org.eclipse.jpt.jpa.db.Schema;
import org.eclipse.jpt.jpa.db.Sequence;
import org.eclipse.jpt.jpa.db.Table;
+import org.eclipse.jpt.jpa.db.internal.plugin.JptJpaDbPlugin;
/**
* Consolidate the behavior common to the typical DTP drivers.
@@ -400,7 +400,7 @@ abstract class AbstractDTPDriverAdapter
try {
return this.execute_(sql);
} catch (SQLException ex) {
- JptJpaDbPlugin.log("SQL: " + sql, ex); //$NON-NLS-1$
+ JptJpaDbPlugin.instance().logError(ex, "SQL: {0}", sql); //$NON-NLS-1$
return Collections.emptyList();
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/plugin/JptJpaDbPlugin.java b/jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/plugin/JptJpaDbPlugin.java
new file mode 100644
index 0000000000..7f32f7d3ef
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/plugin/JptJpaDbPlugin.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2012 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.jpa.db.internal.plugin;
+
+import java.util.Hashtable;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.jpt.common.core.internal.utility.JptPlugin;
+import org.eclipse.jpt.jpa.db.internal.DTPConnectionProfileFactory;
+
+public class JptJpaDbPlugin
+ extends JptPlugin
+{
+ private final Hashtable<IWorkspace, DTPConnectionProfileFactory> connectionProfileFactories = new Hashtable<IWorkspace, DTPConnectionProfileFactory>();
+
+
+ // ********** singleton **********
+
+ private static volatile JptJpaDbPlugin INSTANCE; // sorta-final
+
+ /**
+ * Return the Dali JPA DB plug-in.
+ */
+ public static JptJpaDbPlugin instance() {
+ return INSTANCE;
+ }
+
+
+ // ********** Dali plug-in **********
+
+ public JptJpaDbPlugin() {
+ super();
+ }
+
+ @Override
+ protected void setInstance(JptPlugin plugin) {
+ INSTANCE = (JptJpaDbPlugin) plugin;
+ }
+
+ @Override
+ protected void stop_() throws Exception {
+ try {
+ for (DTPConnectionProfileFactory factory : this.connectionProfileFactories.values()) {
+ try {
+ factory.stop();
+ } catch (Throwable ex) {
+ this.logError(ex); // keep going
+ }
+ }
+ this.connectionProfileFactories.clear();
+ } finally {
+ super.stop_();
+ }
+ }
+
+
+ // ********** connection profile factories **********
+
+ public synchronized DTPConnectionProfileFactory getConnectionProfileFactory(IWorkspace workspace) {
+ DTPConnectionProfileFactory factory = this.connectionProfileFactories.get(workspace);
+ if (this.isActive() && (factory == null)) {
+ factory = this.buildConnectionProfileFactory(workspace);
+ factory.start();
+ this.connectionProfileFactories.put(workspace, factory);
+ }
+ return factory;
+ }
+
+ private DTPConnectionProfileFactory buildConnectionProfileFactory(IWorkspace workspace) {
+ return new DTPConnectionProfileFactory(workspace);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core.ddlgen/META-INF/MANIFEST.MF b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core.ddlgen/META-INF/MANIFEST.MF
index faaf11185f..2d904986fa 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core.ddlgen/META-INF/MANIFEST.MF
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core.ddlgen/META-INF/MANIFEST.MF
@@ -4,6 +4,8 @@ Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.jpt.jpa.eclipselink.core.ddlgen;singleton:=true
Bundle-Version: 2.1.0.qualifier
+Bundle-ActivationPolicy: lazy
+Bundle-ClassPath: .
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Require-Bundle: org.eclipse.jpt.jpa.eclipselink.core;bundle-version="[2.0.0,3.0.0)",
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/.classpath b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/.classpath
index c0a0d3812e..bef6ac8f6c 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/.classpath
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/.classpath
@@ -5,6 +5,7 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
<accessrules>
+ <accessrule kind="nonaccessible" pattern="org/eclipse/jpt/**/plugin/**"/>
<accessrule kind="accessible" pattern="org/eclipse/jpt/jpa/eclipselink/core/**"/>
<accessrule kind="accessible" pattern="org/eclipse/jpt/jpa/core/**"/>
<accessrule kind="accessible" pattern="org/eclipse/jpt/common/core/**"/>
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/META-INF/MANIFEST.MF b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/META-INF/MANIFEST.MF
index 0f9530ac8b..a5b880da56 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/META-INF/MANIFEST.MF
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/META-INF/MANIFEST.MF
@@ -4,7 +4,7 @@ Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.jpt.jpa.eclipselink.core;singleton:=true
Bundle-Version: 2.2.0.qualifier
-Bundle-Activator: org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin
+Bundle-Activator: org.eclipse.jpt.jpa.eclipselink.core.internal.plugin.JptJpaEclipseLinkCorePlugin
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .
Bundle-Localization: plugin
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/plugin.properties b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/plugin.properties
index e070816f6a..8ba919aca2 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/plugin.properties
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/plugin.properties
@@ -1,5 +1,5 @@
################################################################################
-# Copyright (c) 2006, 2011 Oracle. All rights reserved.
+# Copyright (c) 2006, 2012 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.
@@ -22,7 +22,7 @@
pluginName = Dali Java Persistence Tools - JPA EclipseLink Support - Core
providerName = Eclipse Web Tools Platform
-ECLIPSELINK_ORM_XML_CONTENT = EclipseLink XML mapping files
+ECLIPSELINK_ORM_XML_CONTENT = EclipseLink mapping file
ECLIPSELINK_PLATFORM_GROUP_LABEL=EclipseLink
ECLIPSELINK1_0_x_PLATFORM = EclipseLink 1.0.x
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/plugin.xml b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/plugin.xml
index 1858724fc8..70546d18d4 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/plugin.xml
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/plugin.xml
@@ -11,7 +11,9 @@
-->
<plugin>
-
+
+ <!-- ***** content types ***** -->
+
<extension
point="org.eclipse.core.contenttype.contentTypes">
@@ -28,8 +30,74 @@
</content-type>
</extension>
-
-
+
+
+ <!-- ***** resource types ***** -->
+
+ <extension
+ point="org.eclipse.jpt.common.core.resourceTypes">
+
+ <resource-type
+ id="org.eclipse.jpt.jpa.eclipselink.core.resource.orm_1_0"
+ content-type="org.eclipse.jpt.jpa.eclipselink.core.content.orm"
+ version="1.0">
+ <base-type id="org.eclipse.jpt.jpa.core.resource.orm_1_0"/>
+ </resource-type>
+
+ <resource-type
+ id="org.eclipse.jpt.jpa.eclipselink.core.resource.orm_1_1"
+ content-type="org.eclipse.jpt.jpa.eclipselink.core.content.orm"
+ version="1.1">
+ <base-type id="org.eclipse.jpt.jpa.core.resource.orm_1_0"/>
+ </resource-type>
+
+ <resource-type
+ id="org.eclipse.jpt.jpa.eclipselink.core.resource.orm_1_2"
+ content-type="org.eclipse.jpt.jpa.eclipselink.core.content.orm"
+ version="1.2">
+ <base-type id="org.eclipse.jpt.jpa.core.resource.orm_1_0"/>
+ </resource-type>
+
+ <resource-type
+ id="org.eclipse.jpt.jpa.eclipselink.core.resource.orm_2_0"
+ content-type="org.eclipse.jpt.jpa.eclipselink.core.content.orm"
+ version="2.0">
+ <base-type id="org.eclipse.jpt.jpa.core.resource.orm_2_0"/>
+ </resource-type>
+
+ <resource-type
+ id="org.eclipse.jpt.jpa.eclipselink.core.resource.orm_2_1"
+ content-type="org.eclipse.jpt.jpa.eclipselink.core.content.orm"
+ version="2.1">
+ <base-type id="org.eclipse.jpt.jpa.core.resource.orm_2_0"/>
+ </resource-type>
+
+ <resource-type
+ id="org.eclipse.jpt.jpa.eclipselink.core.resource.orm_2_2"
+ content-type="org.eclipse.jpt.jpa.eclipselink.core.content.orm"
+ version="2.2">
+ <base-type id="org.eclipse.jpt.jpa.core.resource.orm_2_0"/>
+ </resource-type>
+
+ <resource-type
+ id="org.eclipse.jpt.jpa.eclipselink.core.resource.orm_2_3"
+ content-type="org.eclipse.jpt.jpa.eclipselink.core.content.orm"
+ version="2.3">
+ <base-type id="org.eclipse.jpt.jpa.core.resource.orm_2_0"/>
+ </resource-type>
+
+ <resource-type
+ id="org.eclipse.jpt.jpa.eclipselink.core.resource.orm_2_4"
+ content-type="org.eclipse.jpt.jpa.eclipselink.core.content.orm"
+ version="2.4">
+ <base-type id="org.eclipse.jpt.jpa.core.resource.orm_2_0"/>
+ </resource-type>
+
+ </extension>
+
+
+ <!-- ***** JPA platforms ***** -->
+
<extension
point="org.eclipse.jpt.jpa.core.jpaPlatforms">
@@ -95,6 +163,8 @@
</extension>
+ <!-- ***** library validators ***** -->
+
<extension
point="org.eclipse.jpt.common.core.libraryValidators">
@@ -137,8 +207,10 @@
</libraryValidator>
</extension>
-
-
+
+
+ <!-- ***** WTP Library Provider Framework Integration ***** -->
+
<extension
point="org.eclipse.jst.common.project.facet.core.libraryProviders">
@@ -175,23 +247,25 @@
</extension>
- <extension
- id="builder"
- name="%builderName"
- point="org.eclipse.core.resources.builders">
-
+ <!-- ***** builders ***** -->
+
+ <extension
+ point="org.eclipse.core.resources.builders"
+ id="builder"
+ name="%builderName">
+
<builder hasNature="false">
<run class="org.eclipse.jpt.jpa.eclipselink.core.builder.EclipseLinkStaticWeavingBuilder"/>
</builder>
+
</extension>
-
-
-
- <!-- ***** WTP extensions ***** -->
+
+
+ <!-- ***** WTP resource factories ***** -->
<extension
point="org.eclipse.wst.common.modulecore.resourceFactories">
-
+
<resourceFactory
class="org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmXmlResourceFactory"
isDefault="true">
@@ -199,7 +273,7 @@
contentTypeId="org.eclipse.jpt.jpa.eclipselink.core.content.orm">
</contentTypeBinding>
</resourceFactory>
-
+
</extension>
-
+
</plugin>
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/EclipseLinkJpaPreferences.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/EclipseLinkJpaPreferences.java
new file mode 100644
index 0000000000..e362398fec
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/EclipseLinkJpaPreferences.java
@@ -0,0 +1,101 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.jpa.eclipselink.core;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.plugin.JptJpaEclipseLinkCorePlugin;
+
+
+/**
+ * Public access to the Dali JPA EclipseLink preferences.
+ * <p>
+ * Provisional API: This class is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.2
+ * @since 3.2
+ */
+public final class EclipseLinkJpaPreferences {
+
+ // ********** project static weaving **********
+
+ public static String getStaticWeavingSourceLocation(IProject project, String defaultValue) {
+ return getPlugin().getPreference(project, STATIC_WEAVING_SOURCE_LOCATION, defaultValue);
+ }
+
+ public static void setStaticWeavingSourceLocation(IProject project, String location) {
+ getPlugin().setPreference(project, STATIC_WEAVING_SOURCE_LOCATION, location);
+ }
+
+ public static String getStaticWeavingTargetLocation(IProject project, String defaultValue) {
+ return getPlugin().getPreference(project, STATIC_WEAVING_TARGET_LOCATION, defaultValue);
+ }
+
+ public static void setStaticWeavingTargetLocation(IProject project, String location) {
+ getPlugin().setPreference(project, STATIC_WEAVING_TARGET_LOCATION, location);
+ }
+
+ /**
+ * @see org.eclipse.jpt.jpa.eclipselink.core.context.persistence.LoggingLevel#getPropertyValue()
+ */
+ public static String getStaticWeavingLogLevel(IProject project, String defaultValue) {
+ return getPlugin().getPreference(project, STATIC_WEAVING_LOG_LEVEL, defaultValue);
+ }
+
+ /**
+ * @see org.eclipse.jpt.jpa.eclipselink.core.context.persistence.LoggingLevel#getPropertyValue()
+ */
+ public static void setStaticWeavingLogLevel(IProject project, String logLevel) {
+ getPlugin().setPreference(project, STATIC_WEAVING_LOG_LEVEL, logLevel);
+ }
+
+ public static String getStaticWeavingPersistenceInfo(IProject project, String defaultValue) {
+ return getPlugin().getPreference(project, STATIC_WEAVING_PERSISTENCE_INFO, defaultValue);
+ }
+
+ public static void setStaticWeavingPersistenceInfo(IProject project, String info) {
+ getPlugin().setPreference(project, STATIC_WEAVING_PERSISTENCE_INFO, info);
+ }
+
+ private static final String STATIC_WEAVING = "staticWeaving"; //$NON-NLS-1$
+ private static final String STATIC_WEAVING_ = STATIC_WEAVING + '.';
+
+ private static final String STATIC_WEAVING_SOURCE_LOCATION = STATIC_WEAVING_ + "SOURCE"; //$NON-NLS-1$
+ private static final String STATIC_WEAVING_TARGET_LOCATION = STATIC_WEAVING_ + "TARGET"; //$NON-NLS-1$
+ private static final String STATIC_WEAVING_LOG_LEVEL = STATIC_WEAVING_ + "LOG_LEVEL"; //$NON-NLS-1$
+ private static final String STATIC_WEAVING_PERSISTENCE_INFO = STATIC_WEAVING_ + "PERSISTENCE_INFO"; //$NON-NLS-1$
+
+
+ // ********** misc **********
+
+ /**
+ * Remove both the project's settings and the project-specific workspace
+ * settings.
+ */
+ public static void removePreferences(IProject project) {
+ getPlugin().removePreferences(project);
+ getPlugin().removePersistentProperties(project);
+ }
+
+ public static void removePreferences() {
+ getPlugin().removePreferences();
+ }
+
+ private static JptJpaEclipseLinkCorePlugin getPlugin() {
+ return JptJpaEclipseLinkCorePlugin.instance();
+ }
+
+ private EclipseLinkJpaPreferences() {
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/EclipseLinkJpaProject.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/EclipseLinkJpaProject.java
index 4bbe6840ba..dff541d1e2 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/EclipseLinkJpaProject.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/EclipseLinkJpaProject.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2012 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.
@@ -30,8 +30,8 @@ public interface EclipseLinkJpaProject
* <code>META-INF/eclipselink-orm.xml</code> if that file has the
* EclipseLink content type.
*
- * @see org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin#DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH
- * @see org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin#ECLIPSELINK_ORM_XML_CONTENT_TYPE
+ * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings#DEFAULT_RUNTIME_PATH
+ * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings#CONTENT_TYPE
*/
JpaXmlResource getDefaultEclipseLinkOrmXmlResource();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/JptJpaEclipseLinkCorePlugin.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/JptJpaEclipseLinkCorePlugin.java
deleted file mode 100644
index 401ee1ae0f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/JptJpaEclipseLinkCorePlugin.java
+++ /dev/null
@@ -1,215 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2011 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.jpa.eclipselink.core;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.common.core.JptResourceType;
-import org.eclipse.jpt.jpa.core.JpaNode;
-import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaPlatformFactory.EclipseLinkVersion;
-import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLink;
-import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v1_1.EclipseLink1_1;
-import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v1_2.EclipseLink1_2;
-import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_0.EclipseLink2_0;
-import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_1.EclipseLink2_1;
-import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_2.EclipseLink2_2;
-import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_3.EclipseLink2_3;
-import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_4.EclipseLink2_4;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class JptJpaEclipseLinkCorePlugin
- extends Plugin
-{
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.jpt.jpa.eclipselink.core"; //$NON-NLS-1$
- public static final String PLUGIN_ID_ = PLUGIN_ID + '.';
-
- /**
- * Version string for EclipseLink platform version 1.0
- */
- public static final String ECLIPSELINK_PLATFORM_VERSION_1_0 = "1.0"; //$NON-NLS-1$
-
- /**
- * Version string for EclipseLink platform version 1.1
- */
- public static final String ECLIPSELINK_PLATFORM_VERSION_1_1 = "1.1"; //$NON-NLS-1$
-
- /**
- * Version string for EclipseLink platform version 1.2
- */
- public static final String ECLIPSELINK_PLATFORM_VERSION_1_2 = "1.2"; //$NON-NLS-1$
-
- /**
- * Version string for EclipseLink platform version 2.0
- */
- public static final String ECLIPSELINK_PLATFORM_VERSION_2_0 = "2.0"; //$NON-NLS-1$
-
- /**
- * Version string for EclipseLink platform version 2.1
- */
- public static final String ECLIPSELINK_PLATFORM_VERSION_2_1 = "2.1"; //$NON-NLS-1$
-
- /**
- * Version string for EclipseLink platform version 2.2
- */
- public static final String ECLIPSELINK_PLATFORM_VERSION_2_2 = "2.2"; //$NON-NLS-1$
-
- /**
- * Version string for EclipseLink platform version 2.3
- */
- public static final String ECLIPSELINK_PLATFORM_VERSION_2_3 = "2.3"; //$NON-NLS-1$
-
- /**
- * Version string for EclipseLink platform version 2.4
- */
- public static final String ECLIPSELINK_PLATFORM_VERSION_2_4 = "2.4"; //$NON-NLS-1$
-
- /**
- * Value of the content-type for eclipselink-orm.xml mappings files. Use this
- * value to retrieve the ORM xml content type from the content type manager
- * and to add new eclipselink-orm.xml-like extensions to this content type.
- *
- * @see org.eclipse.core.runtime.content.IContentTypeManager#getContentType(String)
- */
- public static final IContentType ECLIPSELINK_ORM_XML_CONTENT_TYPE =
- Platform.getContentTypeManager().getContentType(PLUGIN_ID_ + "content.orm"); //$NON-NLS-1$
-
- /**
- * The resource type for eclipselink-orm.xml version 1.0 mapping files
- */
- public static final JptResourceType ECLIPSELINK_ORM_XML_1_0_RESOURCE_TYPE
- = new JptResourceType(ECLIPSELINK_ORM_XML_CONTENT_TYPE, EclipseLink.SCHEMA_VERSION);
-
- /**
- * The resource type for eclipselink-orm.xml version 1.1 mapping files
- */
- public static final JptResourceType ECLIPSELINK_ORM_XML_1_1_RESOURCE_TYPE
- = new JptResourceType(ECLIPSELINK_ORM_XML_CONTENT_TYPE, EclipseLink1_1.SCHEMA_VERSION);
-
- /**
- * The resource type for eclipselink-orm.xml version 1.1 mapping files
- */
- public static final JptResourceType ECLIPSELINK_ORM_XML_1_2_RESOURCE_TYPE
- = new JptResourceType(ECLIPSELINK_ORM_XML_CONTENT_TYPE, EclipseLink1_2.SCHEMA_VERSION);
-
- /**
- * The resource type for eclipselink-orm.xml version 2.0 mapping files
- */
- public static final JptResourceType ECLIPSELINK_ORM_XML_2_0_RESOURCE_TYPE
- = new JptResourceType(ECLIPSELINK_ORM_XML_CONTENT_TYPE, EclipseLink2_0.SCHEMA_VERSION);
-
- /**
- * The resource type for eclipselink-orm.xml version 2.1 mapping files
- */
- public static final JptResourceType ECLIPSELINK_ORM_XML_2_1_RESOURCE_TYPE
- = new JptResourceType(ECLIPSELINK_ORM_XML_CONTENT_TYPE, EclipseLink2_1.SCHEMA_VERSION);
-
- /**
- * The resource type for eclipselink-orm.xml version 2.2 mapping files
- */
- public static final JptResourceType ECLIPSELINK_ORM_XML_2_2_RESOURCE_TYPE
- = new JptResourceType(ECLIPSELINK_ORM_XML_CONTENT_TYPE, EclipseLink2_2.SCHEMA_VERSION);
-
- /**
- * The resource type for eclipselink-orm.xml version 2.3 mapping files
- */
- public static final JptResourceType ECLIPSELINK_ORM_XML_2_3_RESOURCE_TYPE
- = new JptResourceType(ECLIPSELINK_ORM_XML_CONTENT_TYPE, EclipseLink2_3.SCHEMA_VERSION);
-
- /**
- * The resource type for eclipselink-orm.xml version 2.4 mapping files
- */
- public static final JptResourceType ECLIPSELINK_ORM_XML_2_4_RESOURCE_TYPE
- = new JptResourceType(ECLIPSELINK_ORM_XML_CONTENT_TYPE, EclipseLink2_4.SCHEMA_VERSION);
-
- public static final IPath DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH = new Path("META-INF/eclipselink-orm.xml"); //$NON-NLS-1$
-
-
- // ********** singleton **********
- private static JptJpaEclipseLinkCorePlugin INSTANCE;
-
- /**
- * Return the singleton JPT EclipseLink plug-in.
- */
- public static JptJpaEclipseLinkCorePlugin instance() {
- return INSTANCE;
- }
-
-
- // ********** public static methods **********
-
- public static boolean nodeIsEclipseLink2_3Compatible(JpaNode jpaNode) {
- return nodeIsEclipseLinkVersionCompatible(jpaNode, ECLIPSELINK_PLATFORM_VERSION_2_3);
- }
-
- public static boolean nodeIsEclipseLink2_4Compatible(JpaNode jpaNode) {
- return nodeIsEclipseLinkVersionCompatible(jpaNode, ECLIPSELINK_PLATFORM_VERSION_2_4);
- }
-
- public static boolean nodeIsEclipseLinkVersionCompatible(JpaNode jpaNode, String version) {
- return ((EclipseLinkVersion) jpaNode.getJpaProject().getJpaPlatform().getJpaVersion()).isCompatibleWithVersion(version);
- }
-
- /**
- * Log the specified message.
- */
- public static void log(String msg) {
- log(msg, null);
- }
-
- /**
- * Log the specified exception or error.
- */
- public static void log(Throwable throwable) {
- log(throwable.getLocalizedMessage(), throwable);
- }
-
- /**
- * Log the specified message and exception or error.
- */
- public static void log(String msg, Throwable throwable) {
- log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, msg, throwable));
- }
-
- /**
- * Log the specified status.
- */
- public static void log(IStatus status) {
- INSTANCE.getLog().log(status);
- }
-
-
- // ********** plug-in implementation **********
-
- public JptJpaEclipseLinkCorePlugin() {
- super();
- }
-
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- INSTANCE = this;
- }
-
- @Override
- public void stop(BundleContext context) throws Exception {
- INSTANCE = null;
- super.stop(context);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/builder/EclipseLinkStaticWeavingBuilder.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/builder/EclipseLinkStaticWeavingBuilder.java
index 6e5e49c70f..ceed71a002 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/builder/EclipseLinkStaticWeavingBuilder.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/builder/EclipseLinkStaticWeavingBuilder.java
@@ -1,12 +1,12 @@
/*******************************************************************************
-* Copyright (c) 2012 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
-*******************************************************************************/
+ * Copyright (c) 2012 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.jpa.eclipselink.core.builder;
import java.util.Map;
@@ -22,13 +22,13 @@ import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jpt.common.core.gen.JptGenerator;
import org.eclipse.jpt.common.core.gen.LaunchConfigListener;
import org.eclipse.jpt.common.utility.internal.SynchronizedBoolean;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.plugin.JptJpaEclipseLinkCorePlugin;
import org.eclipse.jpt.jpa.eclipselink.core.internal.JptJpaEclipseLinkCoreMessages;
import org.eclipse.jpt.jpa.eclipselink.core.internal.weave.StaticWeave;
public class EclipseLinkStaticWeavingBuilder extends IncrementalProjectBuilder
{
- public static final String BUILDER_ID = JptJpaEclipseLinkCorePlugin.PLUGIN_ID + ".builder"; //$NON-NLS-1$
+ public static final String BUILDER_ID = JptJpaEclipseLinkCorePlugin.instance().getPluginID() + ".builder"; //$NON-NLS-1$
private EclipseLinkStaticWeavingBuilderConfigurator configurator;
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/builder/EclipseLinkStaticWeavingBuilderConfigurator.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/builder/EclipseLinkStaticWeavingBuilderConfigurator.java
index a254b4571b..422cdb0fa9 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/builder/EclipseLinkStaticWeavingBuilderConfigurator.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/builder/EclipseLinkStaticWeavingBuilderConfigurator.java
@@ -1,16 +1,15 @@
/*******************************************************************************
-* Copyright (c) 2012 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
-*******************************************************************************/
+ * Copyright (c) 2012 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.jpa.eclipselink.core.builder;
import java.util.logging.Level;
-
import org.eclipse.core.resources.ICommand;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
@@ -19,36 +18,32 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jpt.jpa.core.internal.prefs.JpaPreferencesManager;
+import org.eclipse.jpt.jpa.eclipselink.core.EclipseLinkJpaPreferences;
import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.LoggingLevel;
/**
* Configures and coordinates StaticWeaving builder behavior for the project.
* Also handles the builder preferences.
*/
-public class EclipseLinkStaticWeavingBuilderConfigurator extends JpaPreferencesManager
+public class EclipseLinkStaticWeavingBuilderConfigurator
{
- public static final String BUILDER_ID = EclipseLinkStaticWeavingBuilder.BUILDER_ID;
+ private final IProject project;
- private static final String STATIC_WEAVE_PREFIX = "staticweave."; //$NON-NLS-1$
+ private static final String BUILDER_ID = EclipseLinkStaticWeavingBuilder.BUILDER_ID;
- public static final String SOURCE = "SOURCE"; //$NON-NLS-1$
- public static final String TARGET = "TARGET"; //$NON-NLS-1$
- public static final String LOG_LEVEL = "LOG_LEVEL"; //$NON-NLS-1$
- public static final String PERSISTENCE_INFO = "PERSISTENCE_INFO"; //$NON-NLS-1$
// ********** constructors **********
public EclipseLinkStaticWeavingBuilderConfigurator(IProject project) {
-
- super(project);
+ super();
+ this.project = project;
}
// ********** builder **********
public void addBuilder() {
try {
- IProjectDescription description = this.getProject().getDescription();
+ IProjectDescription description = this.project.getDescription();
ICommand[] commands = description.getBuildSpec();
ICommand newCommand = description.newCommand();
@@ -65,7 +60,7 @@ public class EclipseLinkStaticWeavingBuilderConfigurator extends JpaPreferencesM
newCommands[0] = newCommand;
}
description.setBuildSpec(newCommands);
- this.getProject().setDescription(description, null);
+ this.project.setDescription(description, null);
}
catch(CoreException ce) {
// if we can't read the information, the project isn't open
@@ -76,7 +71,7 @@ public class EclipseLinkStaticWeavingBuilderConfigurator extends JpaPreferencesM
public boolean projectHasStaticWeavingBuilder() {
try {
- IProjectDescription description = this.getProject().getDescription();
+ IProjectDescription description = this.project.getDescription();
ICommand[] commands = description.getBuildSpec();
if(commands.length == 0)
return false;
@@ -95,7 +90,7 @@ public class EclipseLinkStaticWeavingBuilderConfigurator extends JpaPreferencesM
public void removeBuilder() {
try {
- IProjectDescription description = this.getProject().getDescription();
+ IProjectDescription description = this.project.getDescription();
ICommand[] commands = description.getBuildSpec();
if(commands.length == 0)
return;
@@ -117,7 +112,7 @@ public class EclipseLinkStaticWeavingBuilderConfigurator extends JpaPreferencesM
newCommands[j++] = commands[i];
}
description.setBuildSpec(newCommands);
- this.getProject().setDescription(description, IResource.NONE, null);
+ this.project.setDescription(description, IResource.NONE, null);
}
catch(CoreException ce) {
// if we can't read the information, the project isn't open
@@ -131,22 +126,22 @@ public class EclipseLinkStaticWeavingBuilderConfigurator extends JpaPreferencesM
public String getSourceLocationPreference() {
- return this.getLegacyProjectPreference(this.appendPrefix(SOURCE), this.getDefaultSourceLocation());
+ return EclipseLinkJpaPreferences.getStaticWeavingSourceLocation(this.project, this.getDefaultSourceLocation());
}
public String getTargetLocationPreference() {
- return this.getLegacyProjectPreference(this.appendPrefix(TARGET), this.getDefaultTargetLocation());
+ return EclipseLinkJpaPreferences.getStaticWeavingTargetLocation(this.project, this.getDefaultTargetLocation());
}
public String getPersistenceInfoPreference() {
- return this.getLegacyProjectPreference(this.appendPrefix(PERSISTENCE_INFO), this.getDefaultPersistenceInfo());
+ return EclipseLinkJpaPreferences.getStaticWeavingPersistenceInfo(this.project, this.getDefaultPersistenceInfo());
}
public String getLogLevelPreference() {
- return this.getLegacyProjectPreference(this.appendPrefix(LOG_LEVEL), this.getDefaultLogLevel());
+ return EclipseLinkJpaPreferences.getStaticWeavingLogLevel(this.project, this.getDefaultLogLevel());
}
// default preferences value
@@ -175,35 +170,35 @@ public class EclipseLinkStaticWeavingBuilderConfigurator extends JpaPreferencesM
// setting and removing preferences
public void setSourceLocationPreference(String location) {
- this.setLegacyProjectPreference(this.appendPrefix(SOURCE), location);
+ EclipseLinkJpaPreferences.setStaticWeavingSourceLocation(this.project, location);
}
public void removeSourceLocationPreference() {
- this.setLegacyProjectPreference(this.appendPrefix(SOURCE), null);
+ EclipseLinkJpaPreferences.setStaticWeavingSourceLocation(this.project, null);
}
public void setTargetLocationPreference(String location) {
- this.setLegacyProjectPreference(this.appendPrefix(TARGET), location);
+ EclipseLinkJpaPreferences.setStaticWeavingTargetLocation(this.project, location);
}
public void removeTargetLocationPreference() {
- this.setLegacyProjectPreference(this.appendPrefix(TARGET), null);
+ EclipseLinkJpaPreferences.setStaticWeavingTargetLocation(this.project, null);
}
public void setLogLevelPreference(String logLevel) {
- this.setLegacyProjectPreference(this.appendPrefix(LOG_LEVEL), logLevel);
+ EclipseLinkJpaPreferences.setStaticWeavingLogLevel(this.project, logLevel);
}
public void removeLogLevelPreference() {
- this.setLegacyProjectPreference(this.appendPrefix(LOG_LEVEL), null);
+ EclipseLinkJpaPreferences.setStaticWeavingLogLevel(this.project, null);
}
- public void setPersistenceInfoPreference(String persistenceInfo) {
- this.setLegacyProjectPreference(this.appendPrefix(PERSISTENCE_INFO), persistenceInfo);
+ public void setPersistenceInfoPreference(String info) {
+ EclipseLinkJpaPreferences.setStaticWeavingPersistenceInfo(this.project, info);
}
public void removePersistenceInfoPreference() {
- this.setLegacyProjectPreference(this.appendPrefix(PERSISTENCE_INFO), null);
+ EclipseLinkJpaPreferences.setStaticWeavingPersistenceInfo(this.project, null);
}
// ********** private methods **********
@@ -224,18 +219,13 @@ public class EclipseLinkStaticWeavingBuilderConfigurator extends JpaPreferencesM
IPath outputLocation = this.getJavaProject().getOutputLocation();
String projectName = outputLocation.segment(0);
- if(this.getProject().getName().equals(projectName)) {
+ if(this.project.getName().equals(projectName)) {
outputLocation = outputLocation.removeFirstSegments(1);
}
return outputLocation;
}
private IJavaProject getJavaProject() {
- return JavaCore.create(this.getProject());
+ return JavaCore.create(this.project);
}
-
- private String appendPrefix(String id) {
- return STATIC_WEAVE_PREFIX + id;
- }
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkPersistenceUnit.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkPersistenceUnit.java
index 17c1ce8e17..83698b02ee 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkPersistenceUnit.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkPersistenceUnit.java
@@ -44,7 +44,6 @@ import org.eclipse.jpt.jpa.core.context.Generator;
import org.eclipse.jpt.jpa.core.context.JpaNamedContextNode;
import org.eclipse.jpt.jpa.core.context.MappingFile;
import org.eclipse.jpt.jpa.core.context.MappingFilePersistenceUnitMetadata;
-import org.eclipse.jpt.jpa.core.context.MappingFileRoot;
import org.eclipse.jpt.jpa.core.context.PersistentType;
import org.eclipse.jpt.jpa.core.context.Query;
import org.eclipse.jpt.jpa.core.context.TypeMapping;
@@ -57,12 +56,11 @@ import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
import org.eclipse.jpt.jpa.core.internal.JptCoreMessages;
import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceUnit;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.ImpliedMappingFileRef;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.VirtualOrmXmlRef;
import org.eclipse.jpt.jpa.core.jpa2.context.persistence.options.SharedCacheMode;
import org.eclipse.jpt.jpa.core.jpql.JpaJpqlQueryHelper;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit;
import org.eclipse.jpt.jpa.eclipselink.core.EclipseLinkJpaProject;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkConverter;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkTypeMapping;
import org.eclipse.jpt.jpa.eclipselink.core.context.ReadOnlyTenantDiscriminatorColumn2_3;
@@ -81,6 +79,7 @@ import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.Eclipse
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.EclipseLinkCustomization;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.EclipseLinkGeneralProperties;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.EclipseLinkSchemaGeneration;
+import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings;
import org.eclipse.osgi.util.NLS;
import org.eclipse.text.edits.ReplaceEdit;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
@@ -131,7 +130,7 @@ public class EclipseLinkPersistenceUnit
public EclipseLinkPersistenceUnit(Persistence parent, XmlPersistenceUnit xmlPersistenceUnit) {
super(parent, xmlPersistenceUnit);
- this.potentialImpliedEclipseLinkMappingFileRef = this.buildEclipseLinkImpliedMappingFileRef();
+ this.potentialImpliedEclipseLinkMappingFileRef = this.buildEclipseLinkVirtualMappingFileRef();
}
@@ -301,8 +300,8 @@ public class EclipseLinkPersistenceUnit
this.firePropertyChanged(IMPLIED_ECLIPSELINK_MAPPING_FILE_REF_PROPERTY, old, mappingFileRef);
}
- private ImpliedMappingFileRef buildEclipseLinkImpliedMappingFileRef() {
- return new ImpliedMappingFileRef(this, JptJpaEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH.toString());
+ private VirtualOrmXmlRef buildEclipseLinkVirtualMappingFileRef() {
+ return new VirtualOrmXmlRef(this, XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
}
@Override
@@ -352,7 +351,7 @@ public class EclipseLinkPersistenceUnit
}
protected boolean impliedEclipseLinkMappingFileIsSpecified() {
- return this.mappingFileIsSpecified(JptJpaEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH.toString());
+ return this.mappingFileIsSpecified(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
}
protected boolean impliedEclipseLinkMappingFileExists() {
@@ -464,7 +463,7 @@ public class EclipseLinkPersistenceUnit
return new TransformationIterable<MappingFile, Iterable<EclipseLinkConverter>>(this.getMappingFiles()) {
@Override
protected Iterable<EclipseLinkConverter> transform(MappingFile mappingFile) {
- MappingFileRoot root = mappingFile.getRoot();
+ MappingFile.Root root = mappingFile.getRoot();
return (root instanceof EclipseLinkEntityMappings) ?
((EclipseLinkEntityMappings) root).getMappingFileConverters() :
EmptyIterable.<EclipseLinkConverter>instance();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/AbstractEclipseLink2_0JpaPlatformProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/AbstractEclipseLink2_0JpaPlatformProvider.java
deleted file mode 100644
index 0c436b183f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/AbstractEclipseLink2_0JpaPlatformProvider.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009, 2011 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.jpa.eclipselink.core.internal;
-
-import java.util.ArrayList;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
-import org.eclipse.jpt.common.core.JptResourceType;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.jpa.core.JpaResourceModelProvider;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.ResourceDefinition;
-import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.AbstractJpaPlatformProvider;
-import org.eclipse.jpt.jpa.core.internal.JarResourceModelProvider;
-import org.eclipse.jpt.jpa.core.internal.JavaResourceModelProvider;
-import org.eclipse.jpt.jpa.core.internal.OrmResourceModelProvider;
-import org.eclipse.jpt.jpa.core.internal.PersistenceResourceModelProvider;
-import org.eclipse.jpt.jpa.core.internal.context.java.JavaTransientMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmXmlDefinition;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.GenericOrmXml2_0Definition;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
-import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaBasicCollectionMappingDefinition2_0;
-import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaBasicMapMappingDefinition2_0;
-import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaBasicMappingDefinition2_0;
-import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaElementCollectionMappingDefinition2_0;
-import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaEmbeddableDefinition2_0;
-import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaEmbeddedIdMappingDefinition2_0;
-import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaEmbeddedMappingDefinition2_0;
-import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaEntityDefinition2_0;
-import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaIdMappingDefinition2_0;
-import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaManyToManyMappingDefinition2_0;
-import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaManyToOneMappingDefinition2_0;
-import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaMappedSuperclassDefinition2_0;
-import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaOneToManyMappingDefinition2_0;
-import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaOneToOneMappingDefinition2_0;
-import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaTransformationMappingDefinition2_0;
-import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaVariableOneToOneMappingDefinition2_0;
-import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaVersionMappingDefinition2_0;
-import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml1_1Definition;
-import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml1_2Definition;
-import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml2_0Definition;
-import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXmlDefinition;
-import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceXmlDefinition;
-
-/**
- * EclipseLink 2.0 platform config
- */
-public abstract class AbstractEclipseLink2_0JpaPlatformProvider
- extends AbstractJpaPlatformProvider
-{
- protected AbstractEclipseLink2_0JpaPlatformProvider() {
- super();
- }
-
-
- // ********** resource models **********
-
- public JptResourceType getMostRecentSupportedResourceType(IContentType contentType) {
- if (contentType.equals(JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE)) {
- return JptCommonCorePlugin.JAVA_SOURCE_RESOURCE_TYPE;
- }
- else if (contentType.equals(JptCommonCorePlugin.JAR_CONTENT_TYPE)) {
- return JptCommonCorePlugin.JAR_RESOURCE_TYPE;
- }
- else if (contentType.equals(JptJpaCorePlugin.PERSISTENCE_XML_CONTENT_TYPE)) {
- return JptJpaCorePlugin.PERSISTENCE_XML_2_0_RESOURCE_TYPE;
- }
- else if (contentType.equals(JptJpaCorePlugin.ORM_XML_CONTENT_TYPE)) {
- return JptJpaCorePlugin.ORM_XML_2_0_RESOURCE_TYPE;
- }
- else if (contentType.equals(JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE)) {
- return JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_2_0_RESOURCE_TYPE;
- }
- else {
- throw new IllegalArgumentException(contentType.toString());
- }
- }
-
- @Override
- protected void addResourceModelProvidersTo(ArrayList<JpaResourceModelProvider> providers) {
- CollectionTools.addAll(providers, RESOURCE_MODEL_PROVIDERS);
- }
-
- // order should not be important here
- protected static final JpaResourceModelProvider[] RESOURCE_MODEL_PROVIDERS = new JpaResourceModelProvider[] {
- JavaResourceModelProvider.instance(),
- JarResourceModelProvider.instance(),
- PersistenceResourceModelProvider.instance(),
- OrmResourceModelProvider.instance(),
- EclipseLinkOrmResourceModelProvider.instance()
- };
-
-
- // ********* Java type mappings *********
-
- @Override
- protected void addJavaTypeMappingDefinitionsTo(ArrayList<JavaTypeMappingDefinition> definitions) {
- CollectionTools.addAll(definitions, JAVA_TYPE_MAPPING_DEFINITIONS);
- }
-
- // order matches that used by EclipseLink
- // NB: no EclipseLink-specific mappings
- protected static final JavaTypeMappingDefinition[] JAVA_TYPE_MAPPING_DEFINITIONS = new JavaTypeMappingDefinition[] {
- EclipseLinkJavaEntityDefinition2_0.instance(),
- EclipseLinkJavaEmbeddableDefinition2_0.instance(),
- EclipseLinkJavaMappedSuperclassDefinition2_0.instance()
- };
-
-
- // ********* Java attribute mappings *********
-
- @Override
- protected void addDefaultJavaAttributeMappingDefinitionsTo(ArrayList<DefaultJavaAttributeMappingDefinition> definitions) {
- CollectionTools.addAll(definitions, DEFAULT_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS);
- }
-
- // order matches that used by EclipseLink
- // NB: no change from EclipseLink 1.2 to 2.0
- protected static final DefaultJavaAttributeMappingDefinition[] DEFAULT_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS = new DefaultJavaAttributeMappingDefinition[] {
- EclipseLinkJavaEmbeddedMappingDefinition2_0.instance(),
- EclipseLinkJavaOneToManyMappingDefinition2_0.instance(),
- EclipseLinkJavaOneToOneMappingDefinition2_0.instance(),
- EclipseLinkJavaVariableOneToOneMappingDefinition2_0.instance(),
- EclipseLinkJavaBasicMappingDefinition2_0.instance()
- };
-
- @Override
- protected void addSpecifiedJavaAttributeMappingDefinitionsTo(ArrayList<JavaAttributeMappingDefinition> definitions) {
- CollectionTools.addAll(definitions, SPECIFIED_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS);
- }
-
- // order matches that used by EclipseLink
- protected static final JavaAttributeMappingDefinition[] SPECIFIED_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS = new JavaAttributeMappingDefinition[] {
- JavaTransientMappingDefinition.instance(),
- EclipseLinkJavaBasicCollectionMappingDefinition2_0.instance(),
- EclipseLinkJavaBasicMapMappingDefinition2_0.instance(),
- EclipseLinkJavaElementCollectionMappingDefinition2_0.instance(),
- EclipseLinkJavaIdMappingDefinition2_0.instance(),
- EclipseLinkJavaVersionMappingDefinition2_0.instance(),
- EclipseLinkJavaBasicMappingDefinition2_0.instance(),
- EclipseLinkJavaEmbeddedMappingDefinition2_0.instance(),
- EclipseLinkJavaEmbeddedIdMappingDefinition2_0.instance(),
- EclipseLinkJavaTransformationMappingDefinition2_0.instance(),
- EclipseLinkJavaManyToManyMappingDefinition2_0.instance(),
- EclipseLinkJavaManyToOneMappingDefinition2_0.instance(),
- EclipseLinkJavaOneToManyMappingDefinition2_0.instance(),
- EclipseLinkJavaOneToOneMappingDefinition2_0.instance(),
- EclipseLinkJavaVariableOneToOneMappingDefinition2_0.instance()
- };
-
-
- // ********** resource definitions **********
-
- @Override
- protected void addResourceDefinitionsTo(ArrayList<ResourceDefinition> definitions) {
- CollectionTools.addAll(definitions, RESOURCE_DEFINITIONS);
- }
-
- protected static final ResourceDefinition[] RESOURCE_DEFINITIONS = new ResourceDefinition[] {
- EclipseLinkPersistenceXmlDefinition.instance(),
- GenericOrmXmlDefinition.instance(),
- GenericOrmXml2_0Definition.instance(),
- EclipseLinkOrmXmlDefinition.instance(),
- EclipseLinkOrmXml1_1Definition.instance(),
- EclipseLinkOrmXml1_2Definition.instance(),
- EclipseLinkOrmXml2_0Definition.instance()
- };
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/DefaultEclipseLinkJpaValidationMessages.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/DefaultEclipseLinkJpaValidationMessages.java
index 532f70ab4b..d2a045f7cb 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/DefaultEclipseLinkJpaValidationMessages.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/DefaultEclipseLinkJpaValidationMessages.java
@@ -16,8 +16,8 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.jpa.core.JpaNode;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidator;
import org.eclipse.wst.validation.internal.core.Message;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
@@ -78,7 +78,7 @@ public class DefaultEclipseLinkJpaValidationMessages {
// }
IMessage message = new EclipseLinkMessage(EclipseLinkJpaValidationMessages.BUNDLE_NAME, severity, messageId, parms, targetObject);
// TODO "EclipseLink JPA" validation marker?
- message.setMarkerId(JptJpaCorePlugin.VALIDATION_MARKER_ID);
+ message.setMarkerId(JpaValidator.MARKER_ID);
return message;
}
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_1JpaPlatformFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_1JpaPlatformFactory.java
index d134425f5f..8e71769ef7 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_1JpaPlatformFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_1JpaPlatformFactory.java
@@ -11,16 +11,15 @@ package org.eclipse.jpt.jpa.eclipselink.core.internal;
import org.eclipse.jpt.common.core.AnnotationProvider;
import org.eclipse.jpt.common.core.JptResourceType;
-import org.eclipse.jpt.jpa.core.JpaFacet;
import org.eclipse.jpt.jpa.core.JpaPlatform;
import org.eclipse.jpt.jpa.core.JpaPlatformFactory;
import org.eclipse.jpt.jpa.core.JpaPlatformVariation;
+import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.context.AccessType;
import org.eclipse.jpt.jpa.core.internal.GenericJpaAnnotationDefinitionProvider;
import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatform;
import org.eclipse.jpt.jpa.core.internal.JpaAnnotationProvider;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
-import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaPlatformFactory.EclipseLinkVersion;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaPlatformFactory.EclipseLinkJpaPlatformVersion;
import org.eclipse.persistence.jpa.jpql.parser.EclipseLinkJPQLGrammar1;
/**
@@ -31,6 +30,11 @@ public class EclipseLink1_1JpaPlatformFactory
implements JpaPlatformFactory
{
/**
+ * Version string for EclipseLink platform version 1.1
+ */
+ public static final String VERSION = "1.1"; //$NON-NLS-1$
+
+ /**
* zero-argument constructor
*/
public EclipseLink1_1JpaPlatformFactory() {
@@ -69,8 +73,6 @@ public class EclipseLink1_1JpaPlatformFactory
}
private JpaPlatform.Version buildJpaVersion() {
- return new EclipseLinkVersion(
- JptJpaEclipseLinkCorePlugin.ECLIPSELINK_PLATFORM_VERSION_1_1,
- JpaFacet.VERSION_1_0.getVersionString());
+ return new EclipseLinkJpaPlatformVersion(VERSION, JpaProject.FACET_VERSION_STRING);
}
-} \ No newline at end of file
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_1JpaPlatformProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_1JpaPlatformProvider.java
index fb4d28faed..72106cf847 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_1JpaPlatformProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_1JpaPlatformProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2012 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.
@@ -10,13 +10,10 @@
package org.eclipse.jpt.jpa.eclipselink.core.internal;
import java.util.ArrayList;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
import org.eclipse.jpt.common.core.JptResourceType;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.jpa.core.JpaPlatformProvider;
import org.eclipse.jpt.jpa.core.JpaResourceModelProvider;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.ResourceDefinition;
import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition;
import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
@@ -26,11 +23,13 @@ import org.eclipse.jpt.jpa.core.internal.JarResourceModelProvider;
import org.eclipse.jpt.jpa.core.internal.JavaResourceModelProvider;
import org.eclipse.jpt.jpa.core.internal.OrmResourceModelProvider;
import org.eclipse.jpt.jpa.core.internal.PersistenceResourceModelProvider;
+import org.eclipse.jpt.jpa.core.internal.context.java.JarDefinition;
import org.eclipse.jpt.jpa.core.internal.context.java.JavaEmbeddedIdMappingDefinition;
import org.eclipse.jpt.jpa.core.internal.context.java.JavaEmbeddedMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.java.JavaSourceFileDefinition;
import org.eclipse.jpt.jpa.core.internal.context.java.JavaTransientMappingDefinition;
import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmXmlDefinition;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.GenericPersistenceXmlDefinition;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaBasicCollectionMappingDefinition;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaBasicMapMappingDefinition;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaBasicMappingDefinition;
@@ -50,15 +49,14 @@ import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmX
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceXmlDefinition;
/**
- * EclipseLink platform
+ * EclipseLink 1.1 platform config
*/
public class EclipseLink1_1JpaPlatformProvider
- extends AbstractJpaPlatformProvider {
-
+ extends AbstractJpaPlatformProvider
+{
// singleton
private static final JpaPlatformProvider INSTANCE = new EclipseLink1_1JpaPlatformProvider();
-
/**
* Return the singleton.
*/
@@ -66,7 +64,6 @@ public class EclipseLink1_1JpaPlatformProvider
return INSTANCE;
}
-
/**
* Enforce singleton usage
*/
@@ -77,27 +74,20 @@ public class EclipseLink1_1JpaPlatformProvider
// ********** resource models **********
- public JptResourceType getMostRecentSupportedResourceType(IContentType contentType) {
- if (contentType.equals(JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE)) {
- return JptCommonCorePlugin.JAVA_SOURCE_RESOURCE_TYPE;
- }
- else if (contentType.equals(JptCommonCorePlugin.JAR_CONTENT_TYPE)) {
- return JptCommonCorePlugin.JAR_RESOURCE_TYPE;
- }
- else if (contentType.equals(JptJpaCorePlugin.PERSISTENCE_XML_CONTENT_TYPE)) {
- return JptJpaCorePlugin.PERSISTENCE_XML_1_0_RESOURCE_TYPE;
- }
- else if (contentType.equals(JptJpaCorePlugin.ORM_XML_CONTENT_TYPE)) {
- return JptJpaCorePlugin.ORM_XML_1_0_RESOURCE_TYPE;
- }
- else if (contentType.equals(JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE)) {
- return JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_1_1_RESOURCE_TYPE;
- }
- else {
- throw new IllegalArgumentException(contentType.toString());
- }
+ @Override
+ protected void addMostRecentSupportedResourceTypesTo(ArrayList<JptResourceType> types) {
+ CollectionTools.addAll(types, MOST_RECENT_SUPPORTED_RESOURCE_TYPES);
}
+ // order should not be important here
+ protected static final JptResourceType[] MOST_RECENT_SUPPORTED_RESOURCE_TYPES = new JptResourceType[] {
+ JavaSourceFileDefinition.instance().getResourceType(),
+ JarDefinition.instance().getResourceType(),
+ GenericPersistenceXmlDefinition.instance().getResourceType(),
+ GenericOrmXmlDefinition.instance().getResourceType(),
+ org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml1_1Definition.instance().getResourceType()
+ };
+
@Override
protected void addResourceModelProvidersTo(ArrayList<JpaResourceModelProvider> providers) {
CollectionTools.addAll(providers, RESOURCE_MODEL_PROVIDERS);
@@ -179,6 +169,8 @@ public class EclipseLink1_1JpaPlatformProvider
}
protected static final ResourceDefinition[] RESOURCE_DEFINITIONS = new ResourceDefinition[] {
+ JavaSourceFileDefinition.instance(),
+ JarDefinition.instance(),
EclipseLinkPersistenceXmlDefinition.instance(),
GenericOrmXmlDefinition.instance(),
EclipseLinkOrmXmlDefinition.instance(),
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_2JpaPlatformFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_2JpaPlatformFactory.java
index cf82ed8b66..764d1dde05 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_2JpaPlatformFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_2JpaPlatformFactory.java
@@ -11,16 +11,15 @@ package org.eclipse.jpt.jpa.eclipselink.core.internal;
import org.eclipse.jpt.common.core.AnnotationProvider;
import org.eclipse.jpt.common.core.JptResourceType;
-import org.eclipse.jpt.jpa.core.JpaFacet;
import org.eclipse.jpt.jpa.core.JpaPlatform;
import org.eclipse.jpt.jpa.core.JpaPlatformFactory;
import org.eclipse.jpt.jpa.core.JpaPlatformVariation;
+import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.context.AccessType;
import org.eclipse.jpt.jpa.core.internal.GenericJpaAnnotationDefinitionProvider;
import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatform;
import org.eclipse.jpt.jpa.core.internal.JpaAnnotationProvider;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
-import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaPlatformFactory.EclipseLinkVersion;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaPlatformFactory.EclipseLinkJpaPlatformVersion;
import org.eclipse.persistence.jpa.jpql.parser.EclipseLinkJPQLGrammar1;
/**
@@ -31,6 +30,12 @@ public class EclipseLink1_2JpaPlatformFactory
implements JpaPlatformFactory
{
/**
+ * Version string for EclipseLink platform version 1.2
+ */
+ public static final String VERSION = "1.2"; //$NON-NLS-1$
+
+
+ /**
* zero-argument constructor
*/
public EclipseLink1_2JpaPlatformFactory() {
@@ -70,8 +75,6 @@ public class EclipseLink1_2JpaPlatformFactory
}
private JpaPlatform.Version buildJpaVersion() {
- return new EclipseLinkVersion(
- JptJpaEclipseLinkCorePlugin.ECLIPSELINK_PLATFORM_VERSION_1_2,
- JpaFacet.VERSION_1_0.getVersionString());
+ return new EclipseLinkJpaPlatformVersion(VERSION, JpaProject.FACET_VERSION_STRING);
}
-} \ No newline at end of file
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_2JpaPlatformProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_2JpaPlatformProvider.java
index 1b31d88dbe..1d0d6f471c 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_2JpaPlatformProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink1_2JpaPlatformProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2012 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.
@@ -10,13 +10,10 @@
package org.eclipse.jpt.jpa.eclipselink.core.internal;
import java.util.ArrayList;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
import org.eclipse.jpt.common.core.JptResourceType;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.jpa.core.JpaPlatformProvider;
import org.eclipse.jpt.jpa.core.JpaResourceModelProvider;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.ResourceDefinition;
import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition;
import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
@@ -26,12 +23,14 @@ import org.eclipse.jpt.jpa.core.internal.JarResourceModelProvider;
import org.eclipse.jpt.jpa.core.internal.JavaResourceModelProvider;
import org.eclipse.jpt.jpa.core.internal.OrmResourceModelProvider;
import org.eclipse.jpt.jpa.core.internal.PersistenceResourceModelProvider;
+import org.eclipse.jpt.jpa.core.internal.context.java.JarDefinition;
import org.eclipse.jpt.jpa.core.internal.context.java.JavaBasicMappingDefinition;
import org.eclipse.jpt.jpa.core.internal.context.java.JavaEmbeddedIdMappingDefinition;
import org.eclipse.jpt.jpa.core.internal.context.java.JavaEmbeddedMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.java.JavaSourceFileDefinition;
import org.eclipse.jpt.jpa.core.internal.context.java.JavaTransientMappingDefinition;
import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmXmlDefinition;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.GenericPersistenceXmlDefinition;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaBasicCollectionMappingDefinition;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaBasicMapMappingDefinition;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaBasicMappingDefinition;
@@ -52,15 +51,14 @@ import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmX
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceXmlDefinition;
/**
- * EclipseLink platform
+ * EclipseLink 2.2 platform config
*/
public class EclipseLink1_2JpaPlatformProvider
- extends AbstractJpaPlatformProvider {
-
+ extends AbstractJpaPlatformProvider
+{
// singleton
private static final JpaPlatformProvider INSTANCE = new EclipseLink1_2JpaPlatformProvider();
-
/**
* Return the singleton.
*/
@@ -68,7 +66,6 @@ public class EclipseLink1_2JpaPlatformProvider
return INSTANCE;
}
-
/**
* Enforce singleton usage
*/
@@ -79,27 +76,20 @@ public class EclipseLink1_2JpaPlatformProvider
// ********** resource models **********
- public JptResourceType getMostRecentSupportedResourceType(IContentType contentType) {
- if (contentType.equals(JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE)) {
- return JptCommonCorePlugin.JAVA_SOURCE_RESOURCE_TYPE;
- }
- else if (contentType.equals(JptCommonCorePlugin.JAR_CONTENT_TYPE)) {
- return JptCommonCorePlugin.JAR_RESOURCE_TYPE;
- }
- else if (contentType.equals(JptJpaCorePlugin.PERSISTENCE_XML_CONTENT_TYPE)) {
- return JptJpaCorePlugin.PERSISTENCE_XML_1_0_RESOURCE_TYPE;
- }
- else if (contentType.equals(JptJpaCorePlugin.ORM_XML_CONTENT_TYPE)) {
- return JptJpaCorePlugin.ORM_XML_1_0_RESOURCE_TYPE;
- }
- else if (contentType.equals(JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE)) {
- return JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_1_2_RESOURCE_TYPE;
- }
- else {
- throw new IllegalArgumentException(contentType.toString());
- }
+ @Override
+ protected void addMostRecentSupportedResourceTypesTo(ArrayList<JptResourceType> types) {
+ CollectionTools.addAll(types, MOST_RECENT_SUPPORTED_RESOURCE_TYPES);
}
+ // order should not be important here
+ protected static final JptResourceType[] MOST_RECENT_SUPPORTED_RESOURCE_TYPES = new JptResourceType[] {
+ JavaSourceFileDefinition.instance().getResourceType(),
+ JarDefinition.instance().getResourceType(),
+ GenericPersistenceXmlDefinition.instance().getResourceType(),
+ GenericOrmXmlDefinition.instance().getResourceType(),
+ org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml1_2Definition.instance().getResourceType()
+ };
+
@Override
protected void addResourceModelProvidersTo(ArrayList<JpaResourceModelProvider> providers) {
CollectionTools.addAll(providers, RESOURCE_MODEL_PROVIDERS);
@@ -181,6 +171,8 @@ public class EclipseLink1_2JpaPlatformProvider
}
protected static final ResourceDefinition[] RESOURCE_DEFINITIONS = new ResourceDefinition[] {
+ JavaSourceFileDefinition.instance(),
+ JarDefinition.instance(),
EclipseLinkPersistenceXmlDefinition.instance(),
GenericOrmXmlDefinition.instance(),
EclipseLinkOrmXmlDefinition.instance(),
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_0JpaPlatformFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_0JpaPlatformFactory.java
index a758509542..a61a9d7d80 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_0JpaPlatformFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_0JpaPlatformFactory.java
@@ -1,17 +1,16 @@
/*******************************************************************************
-* Copyright (c) 2009, 2012 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
-*******************************************************************************/
+ * Copyright (c) 2009, 2012 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.jpa.eclipselink.core.internal;
import org.eclipse.jpt.common.core.AnnotationProvider;
import org.eclipse.jpt.common.core.JptResourceType;
-import org.eclipse.jpt.jpa.core.JpaFacet;
import org.eclipse.jpt.jpa.core.JpaPlatform;
import org.eclipse.jpt.jpa.core.JpaPlatformFactory;
import org.eclipse.jpt.jpa.core.JpaPlatformVariation;
@@ -19,18 +18,19 @@ import org.eclipse.jpt.jpa.core.context.AccessType;
import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatform;
import org.eclipse.jpt.jpa.core.internal.JpaAnnotationProvider;
import org.eclipse.jpt.jpa.core.internal.jpa2.Generic2_0JpaAnnotationDefinitionProvider;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
-import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaPlatformFactory.EclipseLinkVersion;
+import org.eclipse.jpt.jpa.core.jpa2.JpaProject2_0;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaPlatformFactory.EclipseLinkJpaPlatformVersion;
import org.eclipse.persistence.jpa.jpql.parser.EclipseLinkJPQLGrammar2_0;
-/**
- * All the state in the JPA platform should be "static" (i.e. unchanging once
- * it is initialized).
- */
public class EclipseLink2_0JpaPlatformFactory
implements JpaPlatformFactory
{
/**
+ * Version string for EclipseLink platform version 2.0
+ */
+ public static final String VERSION = "2.0"; //$NON-NLS-1$
+
+ /**
* zero-argument constructor
*/
public EclipseLink2_0JpaPlatformFactory() {
@@ -49,9 +49,7 @@ public class EclipseLink2_0JpaPlatformFactory
}
protected JpaPlatform.Version buildJpaVersion() {
- return new EclipseLinkVersion(
- JptJpaEclipseLinkCorePlugin.ECLIPSELINK_PLATFORM_VERSION_2_0,
- JpaFacet.VERSION_2_0.getVersionString());
+ return new EclipseLinkJpaPlatformVersion(VERSION, JpaProject2_0.FACET_VERSION_STRING);
}
protected AnnotationProvider buildAnnotationProvider() {
@@ -73,4 +71,4 @@ public class EclipseLink2_0JpaPlatformFactory
}
};
}
-} \ No newline at end of file
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_0JpaPlatformProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_0JpaPlatformProvider.java
index 598604351b..5a182144e9 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_0JpaPlatformProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_0JpaPlatformProvider.java
@@ -1,29 +1,67 @@
/*******************************************************************************
-* Copyright (c) 2009, 2011 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
-*******************************************************************************/
+ * Copyright (c) 2009, 2012 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.jpa.eclipselink.core.internal;
import java.util.ArrayList;
+import org.eclipse.jpt.common.core.JptResourceType;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.jpa.core.JpaPlatformProvider;
+import org.eclipse.jpt.jpa.core.JpaResourceModelProvider;
import org.eclipse.jpt.jpa.core.ResourceDefinition;
+import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.AbstractJpaPlatformProvider;
+import org.eclipse.jpt.jpa.core.internal.JarResourceModelProvider;
+import org.eclipse.jpt.jpa.core.internal.JavaResourceModelProvider;
+import org.eclipse.jpt.jpa.core.internal.OrmResourceModelProvider;
+import org.eclipse.jpt.jpa.core.internal.PersistenceResourceModelProvider;
+import org.eclipse.jpt.jpa.core.internal.context.java.JarDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.java.JavaSourceFileDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.java.JavaTransientMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmXmlDefinition;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.GenericOrmXml2_0Definition;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence.GenericPersistenceXml2_0Definition;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaBasicCollectionMappingDefinition2_0;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaBasicMapMappingDefinition2_0;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaBasicMappingDefinition2_0;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaElementCollectionMappingDefinition2_0;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaEmbeddableDefinition2_0;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaEmbeddedIdMappingDefinition2_0;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaEmbeddedMappingDefinition2_0;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaEntityDefinition2_0;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaIdMappingDefinition2_0;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaManyToManyMappingDefinition2_0;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaManyToOneMappingDefinition2_0;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaMappedSuperclassDefinition2_0;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaOneToManyMappingDefinition2_0;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaOneToOneMappingDefinition2_0;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaTransformationMappingDefinition2_0;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaVariableOneToOneMappingDefinition2_0;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaVersionMappingDefinition2_0;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml1_1Definition;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml1_2Definition;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml2_0Definition;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXmlDefinition;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.EclipseLink2_0PersistenceXmlDefinition;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceXmlDefinition;
/**
- * EclipseLink 2.0 platform config
+ * EclipseLink 2.0 platform config
*/
public class EclipseLink2_0JpaPlatformProvider
- extends AbstractEclipseLink2_0JpaPlatformProvider
+ extends AbstractJpaPlatformProvider
{
// singleton
private static final JpaPlatformProvider INSTANCE = new EclipseLink2_0JpaPlatformProvider();
-
/**
* Return the singleton
*/
@@ -31,19 +69,120 @@ public class EclipseLink2_0JpaPlatformProvider
return INSTANCE;
}
-
/**
* Enforce singleton usage
*/
protected EclipseLink2_0JpaPlatformProvider() {
super();
}
-
+
+
+ // ********** resource models **********
+
+ @Override
+ protected void addMostRecentSupportedResourceTypesTo(ArrayList<JptResourceType> types) {
+ CollectionTools.addAll(types, MOST_RECENT_SUPPORTED_RESOURCE_TYPES);
+ }
+
+ // order should not be important here
+ protected static final JptResourceType[] MOST_RECENT_SUPPORTED_RESOURCE_TYPES = new JptResourceType[] {
+ JavaSourceFileDefinition.instance().getResourceType(),
+ JarDefinition.instance().getResourceType(),
+ GenericPersistenceXml2_0Definition.instance().getResourceType(),
+ GenericOrmXml2_0Definition.instance().getResourceType(),
+ org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml2_0Definition.instance().getResourceType()
+ };
+
+ @Override
+ protected void addResourceModelProvidersTo(ArrayList<JpaResourceModelProvider> providers) {
+ CollectionTools.addAll(providers, RESOURCE_MODEL_PROVIDERS);
+ }
+
+ // order should not be important here
+ protected static final JpaResourceModelProvider[] RESOURCE_MODEL_PROVIDERS = new JpaResourceModelProvider[] {
+ JavaResourceModelProvider.instance(),
+ JarResourceModelProvider.instance(),
+ PersistenceResourceModelProvider.instance(),
+ OrmResourceModelProvider.instance(),
+ EclipseLinkOrmResourceModelProvider.instance()
+ };
+
+
+ // ********* Java type mappings *********
+
+ @Override
+ protected void addJavaTypeMappingDefinitionsTo(ArrayList<JavaTypeMappingDefinition> definitions) {
+ CollectionTools.addAll(definitions, JAVA_TYPE_MAPPING_DEFINITIONS);
+ }
+
+ // order matches that used by EclipseLink
+ // NB: no EclipseLink-specific mappings
+ protected static final JavaTypeMappingDefinition[] JAVA_TYPE_MAPPING_DEFINITIONS = new JavaTypeMappingDefinition[] {
+ EclipseLinkJavaEntityDefinition2_0.instance(),
+ EclipseLinkJavaEmbeddableDefinition2_0.instance(),
+ EclipseLinkJavaMappedSuperclassDefinition2_0.instance()
+ };
+
+
+ // ********* Java attribute mappings *********
+
+ @Override
+ protected void addDefaultJavaAttributeMappingDefinitionsTo(ArrayList<DefaultJavaAttributeMappingDefinition> definitions) {
+ CollectionTools.addAll(definitions, DEFAULT_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS);
+ }
+
+ // order matches that used by EclipseLink
+ // NB: no change from EclipseLink 1.2 to 2.0
+ protected static final DefaultJavaAttributeMappingDefinition[] DEFAULT_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS = new DefaultJavaAttributeMappingDefinition[] {
+ EclipseLinkJavaEmbeddedMappingDefinition2_0.instance(),
+ EclipseLinkJavaOneToManyMappingDefinition2_0.instance(),
+ EclipseLinkJavaOneToOneMappingDefinition2_0.instance(),
+ EclipseLinkJavaVariableOneToOneMappingDefinition2_0.instance(),
+ EclipseLinkJavaBasicMappingDefinition2_0.instance()
+ };
+
+ @Override
+ protected void addSpecifiedJavaAttributeMappingDefinitionsTo(ArrayList<JavaAttributeMappingDefinition> definitions) {
+ CollectionTools.addAll(definitions, SPECIFIED_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS);
+ }
+
+ // order matches that used by EclipseLink
+ protected static final JavaAttributeMappingDefinition[] SPECIFIED_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS = new JavaAttributeMappingDefinition[] {
+ JavaTransientMappingDefinition.instance(),
+ EclipseLinkJavaBasicCollectionMappingDefinition2_0.instance(),
+ EclipseLinkJavaBasicMapMappingDefinition2_0.instance(),
+ EclipseLinkJavaElementCollectionMappingDefinition2_0.instance(),
+ EclipseLinkJavaIdMappingDefinition2_0.instance(),
+ EclipseLinkJavaVersionMappingDefinition2_0.instance(),
+ EclipseLinkJavaBasicMappingDefinition2_0.instance(),
+ EclipseLinkJavaEmbeddedMappingDefinition2_0.instance(),
+ EclipseLinkJavaEmbeddedIdMappingDefinition2_0.instance(),
+ EclipseLinkJavaTransformationMappingDefinition2_0.instance(),
+ EclipseLinkJavaManyToManyMappingDefinition2_0.instance(),
+ EclipseLinkJavaManyToOneMappingDefinition2_0.instance(),
+ EclipseLinkJavaOneToManyMappingDefinition2_0.instance(),
+ EclipseLinkJavaOneToOneMappingDefinition2_0.instance(),
+ EclipseLinkJavaVariableOneToOneMappingDefinition2_0.instance()
+ };
+
+
// ********** resource definitions **********
@Override
protected void addResourceDefinitionsTo(ArrayList<ResourceDefinition> definitions) {
- super.addResourceDefinitionsTo(definitions);
- definitions.add(EclipseLink2_0PersistenceXmlDefinition.instance());
+ CollectionTools.addAll(definitions, RESOURCE_DEFINITIONS);
}
+
+ protected static final ResourceDefinition[] RESOURCE_DEFINITIONS = new ResourceDefinition[] {
+ JavaSourceFileDefinition.instance(),
+ JarDefinition.instance(),
+ EclipseLinkPersistenceXmlDefinition.instance(),
+ EclipseLink2_0PersistenceXmlDefinition.instance(),
+ GenericOrmXmlDefinition.instance(),
+ GenericOrmXml2_0Definition.instance(),
+ EclipseLinkOrmXmlDefinition.instance(),
+ EclipseLinkOrmXml1_1Definition.instance(),
+ EclipseLinkOrmXml1_2Definition.instance(),
+ EclipseLinkOrmXml2_0Definition.instance()
+ };
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_1JpaPlatformFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_1JpaPlatformFactory.java
index 648d92fca3..a391f02bdf 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_1JpaPlatformFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_1JpaPlatformFactory.java
@@ -1,41 +1,44 @@
/*******************************************************************************
- * Copyright (c) 2010, 2012 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
+ * Copyright (c) 2009, 2012 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
+ * Contributors:
+ * Oracle - initial API and implementation
*******************************************************************************/
package org.eclipse.jpt.jpa.eclipselink.core.internal;
import org.eclipse.jpt.common.core.AnnotationProvider;
import org.eclipse.jpt.common.core.JptResourceType;
-import org.eclipse.jpt.jpa.core.JpaFacet;
import org.eclipse.jpt.jpa.core.JpaPlatform;
+import org.eclipse.jpt.jpa.core.JpaPlatformFactory;
import org.eclipse.jpt.jpa.core.JpaPlatformVariation;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.AccessType;
import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatform;
import org.eclipse.jpt.jpa.core.internal.JpaAnnotationProvider;
import org.eclipse.jpt.jpa.core.internal.jpa2.Generic2_0JpaAnnotationDefinitionProvider;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
+import org.eclipse.jpt.jpa.core.jpa2.JpaProject2_0;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkAccessType;
-import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaPlatformFactory.EclipseLinkVersion;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaPlatformFactory.EclipseLinkJpaPlatformVersion;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml2_1Definition;
import org.eclipse.persistence.jpa.jpql.parser.EclipseLinkJPQLGrammar2_1;
public class EclipseLink2_1JpaPlatformFactory
- extends EclipseLink2_0JpaPlatformFactory
+ implements JpaPlatformFactory
{
/**
+ * Version string for EclipseLink platform version 2.1
+ */
+ public static final String VERSION = "2.1"; //$NON-NLS-1$
+
+ /**
* zero-argument constructor
*/
public EclipseLink2_1JpaPlatformFactory() {
super();
}
- @Override
public JpaPlatform buildJpaPlatform(String id) {
return new GenericJpaPlatform(
id,
@@ -47,21 +50,16 @@ public class EclipseLink2_1JpaPlatformFactory
EclipseLinkJPQLGrammar2_1.instance());
}
- @Override
protected JpaPlatform.Version buildJpaVersion() {
- return new EclipseLinkVersion(
- JptJpaEclipseLinkCorePlugin.ECLIPSELINK_PLATFORM_VERSION_2_1,
- JpaFacet.VERSION_2_0.getVersionString());
+ return new EclipseLinkJpaPlatformVersion(VERSION, JpaProject2_0.FACET_VERSION_STRING);
}
- @Override
protected AnnotationProvider buildAnnotationProvider() {
return new JpaAnnotationProvider(
Generic2_0JpaAnnotationDefinitionProvider.instance(),
EclipseLink2_1JpaAnnotationDefinitionProvider.instance());
}
- @Override
protected JpaPlatformVariation buildJpaVariation() {
return new JpaPlatformVariation() {
public Supported getTablePerConcreteClassInheritanceIsSupported() {
@@ -71,18 +69,16 @@ public class EclipseLink2_1JpaPlatformFactory
return true;
}
public AccessType[] getSupportedAccessTypes(JptResourceType resourceType) {
- if (resourceType.getContentType() == JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE) {
- if (this.versionIsEclipseLink2_1Compatibile(resourceType)) {
- return ECLIPSELINK_SUPPORTED_ACCESS_TYPES;
- }
- }
- return GENERIC_SUPPORTED_ACCESS_TYPES;
- }
- protected boolean versionIsEclipseLink2_1Compatibile(JptResourceType resourceType) {
- return JptJpaCorePlugin.resourceTypeIsCompatible(resourceType, JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_2_1_RESOURCE_TYPE.getVersion());
+ return resourceType.isKindOf(EclipseLinkOrmXml2_1Definition.instance().getResourceType()) ?
+ SUPPORTED_ACCESS_TYPES :
+ GENERIC_SUPPORTED_ACCESS_TYPES;
}
};
}
- public static final AccessType[] ECLIPSELINK_SUPPORTED_ACCESS_TYPES = new AccessType[] {AccessType.FIELD, AccessType.PROPERTY, EclipseLinkAccessType.VIRTUAL};
-} \ No newline at end of file
+ public static final AccessType[] SUPPORTED_ACCESS_TYPES = new AccessType[] {
+ AccessType.FIELD,
+ AccessType.PROPERTY,
+ EclipseLinkAccessType.VIRTUAL
+ };
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_1JpaPlatformProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_1JpaPlatformProvider.java
index 3b4b076ced..2c030f069c 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_1JpaPlatformProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_1JpaPlatformProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2012 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.
@@ -10,24 +10,59 @@
package org.eclipse.jpt.jpa.eclipselink.core.internal;
import java.util.ArrayList;
-import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.jpt.common.core.JptResourceType;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.jpa.core.JpaPlatformProvider;
+import org.eclipse.jpt.jpa.core.JpaResourceModelProvider;
import org.eclipse.jpt.jpa.core.ResourceDefinition;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
+import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
+import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.AbstractJpaPlatformProvider;
+import org.eclipse.jpt.jpa.core.internal.JarResourceModelProvider;
+import org.eclipse.jpt.jpa.core.internal.JavaResourceModelProvider;
+import org.eclipse.jpt.jpa.core.internal.OrmResourceModelProvider;
+import org.eclipse.jpt.jpa.core.internal.PersistenceResourceModelProvider;
+import org.eclipse.jpt.jpa.core.internal.context.java.JarDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.java.JavaSourceFileDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.java.JavaTransientMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmXmlDefinition;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.GenericOrmXml2_0Definition;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence.GenericPersistenceXml2_0Definition;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaBasicCollectionMappingDefinition2_0;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaBasicMapMappingDefinition2_0;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaBasicMappingDefinition2_0;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaElementCollectionMappingDefinition2_0;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaEmbeddableDefinition2_0;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaEmbeddedIdMappingDefinition2_0;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaEmbeddedMappingDefinition2_0;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaEntityDefinition2_0;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaIdMappingDefinition2_0;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaManyToManyMappingDefinition2_0;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaManyToOneMappingDefinition2_0;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaMappedSuperclassDefinition2_0;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaOneToManyMappingDefinition2_0;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaOneToOneMappingDefinition2_0;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaTransformationMappingDefinition2_0;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaVariableOneToOneMappingDefinition2_0;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaVersionMappingDefinition2_0;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml1_1Definition;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml1_2Definition;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml2_0Definition;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml2_1Definition;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXmlDefinition;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.EclipseLink2_0PersistenceXmlDefinition;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceXmlDefinition;
/**
- * EclipseLink 2.1 platform config
+ * EclipseLink 2.1 platform config
*/
public class EclipseLink2_1JpaPlatformProvider
- extends AbstractEclipseLink2_0JpaPlatformProvider
+ extends AbstractJpaPlatformProvider
{
// singleton
private static final JpaPlatformProvider INSTANCE = new EclipseLink2_1JpaPlatformProvider();
-
/**
* Return the singleton
*/
@@ -35,7 +70,6 @@ public class EclipseLink2_1JpaPlatformProvider
return INSTANCE;
}
-
/**
* Enforce singleton usage
*/
@@ -47,19 +81,110 @@ public class EclipseLink2_1JpaPlatformProvider
// ********** resource models **********
@Override
- public JptResourceType getMostRecentSupportedResourceType(IContentType contentType) {
- if (contentType.equals(JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE)) {
- return JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_2_1_RESOURCE_TYPE;
- }
- return super.getMostRecentSupportedResourceType(contentType);
+ protected void addMostRecentSupportedResourceTypesTo(ArrayList<JptResourceType> types) {
+ CollectionTools.addAll(types, MOST_RECENT_SUPPORTED_RESOURCE_TYPES);
}
+ // order should not be important here
+ protected static final JptResourceType[] MOST_RECENT_SUPPORTED_RESOURCE_TYPES = new JptResourceType[] {
+ JavaSourceFileDefinition.instance().getResourceType(),
+ JarDefinition.instance().getResourceType(),
+ GenericPersistenceXml2_0Definition.instance().getResourceType(),
+ GenericOrmXml2_0Definition.instance().getResourceType(),
+ org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml2_1Definition.instance().getResourceType(),
+ };
+
+ @Override
+ protected void addResourceModelProvidersTo(ArrayList<JpaResourceModelProvider> providers) {
+ CollectionTools.addAll(providers, RESOURCE_MODEL_PROVIDERS);
+ }
+
+ // order should not be important here
+ protected static final JpaResourceModelProvider[] RESOURCE_MODEL_PROVIDERS = new JpaResourceModelProvider[] {
+ JavaResourceModelProvider.instance(),
+ JarResourceModelProvider.instance(),
+ PersistenceResourceModelProvider.instance(),
+ OrmResourceModelProvider.instance(),
+ EclipseLinkOrmResourceModelProvider.instance()
+ };
+
+
+ // ********* Java type mappings *********
+
+ @Override
+ protected void addJavaTypeMappingDefinitionsTo(ArrayList<JavaTypeMappingDefinition> definitions) {
+ CollectionTools.addAll(definitions, JAVA_TYPE_MAPPING_DEFINITIONS);
+ }
+
+ // order matches that used by EclipseLink
+ // NB: no EclipseLink-specific mappings
+ protected static final JavaTypeMappingDefinition[] JAVA_TYPE_MAPPING_DEFINITIONS = new JavaTypeMappingDefinition[] {
+ EclipseLinkJavaEntityDefinition2_0.instance(),
+ EclipseLinkJavaEmbeddableDefinition2_0.instance(),
+ EclipseLinkJavaMappedSuperclassDefinition2_0.instance()
+ };
+
+
+ // ********* Java attribute mappings *********
+
+ @Override
+ protected void addDefaultJavaAttributeMappingDefinitionsTo(ArrayList<DefaultJavaAttributeMappingDefinition> definitions) {
+ CollectionTools.addAll(definitions, DEFAULT_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS);
+ }
+
+ // order matches that used by EclipseLink
+ // NB: no change from EclipseLink 1.2 to 2.0
+ protected static final DefaultJavaAttributeMappingDefinition[] DEFAULT_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS = new DefaultJavaAttributeMappingDefinition[] {
+ EclipseLinkJavaEmbeddedMappingDefinition2_0.instance(),
+ EclipseLinkJavaOneToManyMappingDefinition2_0.instance(),
+ EclipseLinkJavaOneToOneMappingDefinition2_0.instance(),
+ EclipseLinkJavaVariableOneToOneMappingDefinition2_0.instance(),
+ EclipseLinkJavaBasicMappingDefinition2_0.instance()
+ };
+
+ @Override
+ protected void addSpecifiedJavaAttributeMappingDefinitionsTo(ArrayList<JavaAttributeMappingDefinition> definitions) {
+ CollectionTools.addAll(definitions, SPECIFIED_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS);
+ }
+
+ // order matches that used by EclipseLink
+ protected static final JavaAttributeMappingDefinition[] SPECIFIED_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS = new JavaAttributeMappingDefinition[] {
+ JavaTransientMappingDefinition.instance(),
+ EclipseLinkJavaBasicCollectionMappingDefinition2_0.instance(),
+ EclipseLinkJavaBasicMapMappingDefinition2_0.instance(),
+ EclipseLinkJavaElementCollectionMappingDefinition2_0.instance(),
+ EclipseLinkJavaIdMappingDefinition2_0.instance(),
+ EclipseLinkJavaVersionMappingDefinition2_0.instance(),
+ EclipseLinkJavaBasicMappingDefinition2_0.instance(),
+ EclipseLinkJavaEmbeddedMappingDefinition2_0.instance(),
+ EclipseLinkJavaEmbeddedIdMappingDefinition2_0.instance(),
+ EclipseLinkJavaTransformationMappingDefinition2_0.instance(),
+ EclipseLinkJavaManyToManyMappingDefinition2_0.instance(),
+ EclipseLinkJavaManyToOneMappingDefinition2_0.instance(),
+ EclipseLinkJavaOneToManyMappingDefinition2_0.instance(),
+ EclipseLinkJavaOneToOneMappingDefinition2_0.instance(),
+ EclipseLinkJavaVariableOneToOneMappingDefinition2_0.instance()
+ };
+
+
// ********** resource definitions **********
@Override
protected void addResourceDefinitionsTo(ArrayList<ResourceDefinition> definitions) {
- super.addResourceDefinitionsTo(definitions);
- definitions.add(EclipseLink2_0PersistenceXmlDefinition.instance());
- definitions.add(EclipseLinkOrmXml2_1Definition.instance());
+ CollectionTools.addAll(definitions, RESOURCE_DEFINITIONS);
}
+
+ protected static final ResourceDefinition[] RESOURCE_DEFINITIONS = new ResourceDefinition[] {
+ JavaSourceFileDefinition.instance(),
+ JarDefinition.instance(),
+ EclipseLinkPersistenceXmlDefinition.instance(),
+ EclipseLink2_0PersistenceXmlDefinition.instance(),
+ GenericOrmXmlDefinition.instance(),
+ GenericOrmXml2_0Definition.instance(),
+ EclipseLinkOrmXmlDefinition.instance(),
+ EclipseLinkOrmXml1_1Definition.instance(),
+ EclipseLinkOrmXml1_2Definition.instance(),
+ EclipseLinkOrmXml2_0Definition.instance(),
+ EclipseLinkOrmXml2_1Definition.instance()
+ };
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_2JpaPlatformFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_2JpaPlatformFactory.java
index 317a2d7082..51999a4bce 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_2JpaPlatformFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_2JpaPlatformFactory.java
@@ -1,40 +1,43 @@
/*******************************************************************************
- * Copyright (c) 2010, 2012 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
+ * Copyright (c) 2010, 2012 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
+ * Contributors:
+ * Oracle - initial API and implementation
*******************************************************************************/
package org.eclipse.jpt.jpa.eclipselink.core.internal;
import org.eclipse.jpt.common.core.AnnotationProvider;
import org.eclipse.jpt.common.core.JptResourceType;
-import org.eclipse.jpt.jpa.core.JpaFacet;
import org.eclipse.jpt.jpa.core.JpaPlatform;
+import org.eclipse.jpt.jpa.core.JpaPlatformFactory;
import org.eclipse.jpt.jpa.core.JpaPlatformVariation;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.AccessType;
import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatform;
import org.eclipse.jpt.jpa.core.internal.JpaAnnotationProvider;
import org.eclipse.jpt.jpa.core.internal.jpa2.Generic2_0JpaAnnotationDefinitionProvider;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
-import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaPlatformFactory.EclipseLinkVersion;
+import org.eclipse.jpt.jpa.core.jpa2.JpaProject2_0;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaPlatformFactory.EclipseLinkJpaPlatformVersion;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml2_1Definition;
import org.eclipse.persistence.jpa.jpql.parser.EclipseLinkJPQLGrammar2_2;
public class EclipseLink2_2JpaPlatformFactory
- extends EclipseLink2_0JpaPlatformFactory
+ implements JpaPlatformFactory
{
/**
+ * Version string for EclipseLink platform version 2.2
+ */
+ public static final String VERSION = "2.2"; //$NON-NLS-1$
+
+ /**
* zero-argument constructor
*/
public EclipseLink2_2JpaPlatformFactory() {
super();
}
- @Override
public JpaPlatform buildJpaPlatform(String id) {
return new GenericJpaPlatform(
id,
@@ -46,21 +49,16 @@ public class EclipseLink2_2JpaPlatformFactory
EclipseLinkJPQLGrammar2_2.instance());
}
- @Override
protected JpaPlatform.Version buildJpaVersion() {
- return new EclipseLinkVersion(
- JptJpaEclipseLinkCorePlugin.ECLIPSELINK_PLATFORM_VERSION_2_2,
- JpaFacet.VERSION_2_0.getVersionString());
+ return new EclipseLinkJpaPlatformVersion(VERSION, JpaProject2_0.FACET_VERSION_STRING);
}
- @Override
protected AnnotationProvider buildAnnotationProvider() {
return new JpaAnnotationProvider(
Generic2_0JpaAnnotationDefinitionProvider.instance(),
EclipseLink2_2JpaAnnotationDefinitionProvider.instance());
}
- @Override
protected JpaPlatformVariation buildJpaVariation() {
return new JpaPlatformVariation() {
public Supported getTablePerConcreteClassInheritanceIsSupported() {
@@ -70,16 +68,10 @@ public class EclipseLink2_2JpaPlatformFactory
return true;
}
public AccessType[] getSupportedAccessTypes(JptResourceType resourceType) {
- if (resourceType.getContentType() == JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE) {
- if (this.versionIsEclipseLink2_1Compatibile(resourceType)) {
- return EclipseLink2_1JpaPlatformFactory.ECLIPSELINK_SUPPORTED_ACCESS_TYPES;
- }
- }
- return GENERIC_SUPPORTED_ACCESS_TYPES;
- }
- protected boolean versionIsEclipseLink2_1Compatibile(JptResourceType resourceType) {
- return JptJpaCorePlugin.resourceTypeIsCompatible(resourceType, JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_2_1_RESOURCE_TYPE.getVersion());
+ return resourceType.isKindOf(EclipseLinkOrmXml2_1Definition.instance().getResourceType()) ?
+ EclipseLink2_1JpaPlatformFactory.SUPPORTED_ACCESS_TYPES :
+ GENERIC_SUPPORTED_ACCESS_TYPES;
}
};
}
-} \ No newline at end of file
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_2JpaPlatformProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_2JpaPlatformProvider.java
index 87ba91f53a..782cdf5b4d 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_2JpaPlatformProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_2JpaPlatformProvider.java
@@ -1,25 +1,34 @@
/*******************************************************************************
-* Copyright (c) 2010, 2011 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
-*******************************************************************************/
+ * Copyright (c) 2010, 2012 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.jpa.eclipselink.core.internal;
import java.util.ArrayList;
-import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.jpt.common.core.JptResourceType;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.jpa.core.JpaPlatformProvider;
+import org.eclipse.jpt.jpa.core.JpaResourceModelProvider;
import org.eclipse.jpt.jpa.core.ResourceDefinition;
import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition;
import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.AbstractJpaPlatformProvider;
+import org.eclipse.jpt.jpa.core.internal.JarResourceModelProvider;
+import org.eclipse.jpt.jpa.core.internal.JavaResourceModelProvider;
+import org.eclipse.jpt.jpa.core.internal.OrmResourceModelProvider;
+import org.eclipse.jpt.jpa.core.internal.PersistenceResourceModelProvider;
+import org.eclipse.jpt.jpa.core.internal.context.java.JarDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.java.JavaSourceFileDefinition;
import org.eclipse.jpt.jpa.core.internal.context.java.JavaTransientMappingDefinition;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmXmlDefinition;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.GenericOrmXml2_0Definition;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence.GenericPersistenceXml2_0Definition;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaBasicCollectionMappingDefinition2_0;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaBasicMapMappingDefinition2_0;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaBasicMappingDefinition2_2;
@@ -37,25 +46,31 @@ import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJav
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaTransformationMappingDefinition2_0;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaVariableOneToOneMappingDefinition2_0;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaVersionMappingDefinition2_2;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml1_1Definition;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml1_2Definition;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml2_0Definition;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml2_1Definition;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml2_2Definition;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXmlDefinition;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.EclipseLink2_0PersistenceXmlDefinition;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceXmlDefinition;
+/**
+ * EclipseLink 2.2 platform config
+ */
public class EclipseLink2_2JpaPlatformProvider
- extends AbstractEclipseLink2_0JpaPlatformProvider
+ extends AbstractJpaPlatformProvider
{
// singleton
private static final JpaPlatformProvider INSTANCE = new EclipseLink2_2JpaPlatformProvider();
-
-
+
/**
* Return the singleton
*/
public static JpaPlatformProvider instance() {
return INSTANCE;
}
-
-
+
/**
* Enforce singleton usage
*/
@@ -67,24 +82,52 @@ public class EclipseLink2_2JpaPlatformProvider
// ********** resource models **********
@Override
- public JptResourceType getMostRecentSupportedResourceType(IContentType contentType) {
- if (contentType.equals(JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE)) {
- return JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_2_2_RESOURCE_TYPE;
- }
- return super.getMostRecentSupportedResourceType(contentType);
+ protected void addMostRecentSupportedResourceTypesTo(ArrayList<JptResourceType> types) {
+ CollectionTools.addAll(types, MOST_RECENT_SUPPORTED_RESOURCE_TYPES);
}
+
+ // order should not be important here
+ protected static final JptResourceType[] MOST_RECENT_SUPPORTED_RESOURCE_TYPES = new JptResourceType[] {
+ JavaSourceFileDefinition.instance().getResourceType(),
+ JarDefinition.instance().getResourceType(),
+ GenericPersistenceXml2_0Definition.instance().getResourceType(),
+ GenericOrmXml2_0Definition.instance().getResourceType(),
+ org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml2_2Definition.instance().getResourceType(),
+ };
+ @Override
+ protected void addResourceModelProvidersTo(ArrayList<JpaResourceModelProvider> providers) {
+ CollectionTools.addAll(providers, RESOURCE_MODEL_PROVIDERS);
+ }
+
+ // order should not be important here
+ protected static final JpaResourceModelProvider[] RESOURCE_MODEL_PROVIDERS = new JpaResourceModelProvider[] {
+ JavaResourceModelProvider.instance(),
+ JarResourceModelProvider.instance(),
+ PersistenceResourceModelProvider.instance(),
+ OrmResourceModelProvider.instance(),
+ EclipseLinkOrmResourceModelProvider.instance()
+ };
+
// ********** resource definitions **********
@Override
protected void addResourceDefinitionsTo(ArrayList<ResourceDefinition> definitions) {
- super.addResourceDefinitionsTo(definitions);
CollectionTools.addAll(definitions, RESOURCE_DEFINITIONS);
}
protected static final ResourceDefinition[] RESOURCE_DEFINITIONS = new ResourceDefinition[] {
+ JavaSourceFileDefinition.instance(),
+ JarDefinition.instance(),
+ EclipseLinkPersistenceXmlDefinition.instance(),
EclipseLink2_0PersistenceXmlDefinition.instance(),
+ GenericOrmXmlDefinition.instance(),
+ GenericOrmXml2_0Definition.instance(),
+ EclipseLinkOrmXmlDefinition.instance(),
+ EclipseLinkOrmXml1_1Definition.instance(),
+ EclipseLinkOrmXml1_2Definition.instance(),
+ EclipseLinkOrmXml2_0Definition.instance(),
EclipseLinkOrmXml2_1Definition.instance(),
EclipseLinkOrmXml2_2Definition.instance()
};
@@ -94,12 +137,12 @@ public class EclipseLink2_2JpaPlatformProvider
@Override
protected void addJavaTypeMappingDefinitionsTo(ArrayList<JavaTypeMappingDefinition> definitions) {
- CollectionTools.addAll(definitions, JAVA_TYPE_MAPPING_DEFINITIONS);
+ CollectionTools.addAll(definitions, JAVA_TYPE_MAPPING_DEFINITIONS_2_2);
}
// order matches that used by EclipseLink
// NB: no EclipseLink-specific mappings
- protected static final JavaTypeMappingDefinition[] JAVA_TYPE_MAPPING_DEFINITIONS = new JavaTypeMappingDefinition[] {
+ protected static final JavaTypeMappingDefinition[] JAVA_TYPE_MAPPING_DEFINITIONS_2_2 = new JavaTypeMappingDefinition[] {
EclipseLinkJavaEntityDefinition2_2.instance(),
EclipseLinkJavaEmbeddableDefinition2_2.instance(),
EclipseLinkJavaMappedSuperclassDefinition2_2.instance()
@@ -109,12 +152,12 @@ public class EclipseLink2_2JpaPlatformProvider
@Override
protected void addDefaultJavaAttributeMappingDefinitionsTo(ArrayList<DefaultJavaAttributeMappingDefinition> definitions) {
- CollectionTools.addAll(definitions, DEFAULT_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS);
+ CollectionTools.addAll(definitions, DEFAULT_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS_2_2);
}
// order matches that used by EclipseLink
// NB: no change from EclipseLink 1.2 to 2.0
- protected static final DefaultJavaAttributeMappingDefinition[] DEFAULT_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS = new DefaultJavaAttributeMappingDefinition[] {
+ protected static final DefaultJavaAttributeMappingDefinition[] DEFAULT_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS_2_2 = new DefaultJavaAttributeMappingDefinition[] {
EclipseLinkJavaEmbeddedMappingDefinition2_2.instance(),
EclipseLinkJavaOneToManyMappingDefinition2_2.instance(),
EclipseLinkJavaOneToOneMappingDefinition2_2.instance(),
@@ -124,11 +167,11 @@ public class EclipseLink2_2JpaPlatformProvider
@Override
protected void addSpecifiedJavaAttributeMappingDefinitionsTo(ArrayList<JavaAttributeMappingDefinition> definitions) {
- CollectionTools.addAll(definitions, SPECIFIED_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS);
+ CollectionTools.addAll(definitions, SPECIFIED_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS_2_2);
}
// order matches that used by EclipseLink
- protected static final JavaAttributeMappingDefinition[] SPECIFIED_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS = new JavaAttributeMappingDefinition[] {
+ protected static final JavaAttributeMappingDefinition[] SPECIFIED_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS_2_2 = new JavaAttributeMappingDefinition[] {
JavaTransientMappingDefinition.instance(),
EclipseLinkJavaBasicCollectionMappingDefinition2_0.instance(),
EclipseLinkJavaBasicMapMappingDefinition2_0.instance(),
@@ -145,5 +188,4 @@ public class EclipseLink2_2JpaPlatformProvider
EclipseLinkJavaOneToOneMappingDefinition2_2.instance(),
EclipseLinkJavaVariableOneToOneMappingDefinition2_0.instance()
};
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_3JpaPlatformFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_3JpaPlatformFactory.java
index 9157ad05c0..739174e0ed 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_3JpaPlatformFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_3JpaPlatformFactory.java
@@ -1,30 +1,35 @@
/*******************************************************************************
- * Copyright (c) 2011, 2012 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
+ * Copyright (c) 2011, 2012 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
+ * Contributors:
+ * Oracle - initial API and implementation
*******************************************************************************/
package org.eclipse.jpt.jpa.eclipselink.core.internal;
import org.eclipse.jpt.common.core.AnnotationProvider;
import org.eclipse.jpt.common.core.JptResourceType;
-import org.eclipse.jpt.jpa.core.JpaFacet;
import org.eclipse.jpt.jpa.core.JpaPlatform;
+import org.eclipse.jpt.jpa.core.JpaPlatformFactory;
import org.eclipse.jpt.jpa.core.JpaPlatformVariation;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.AccessType;
import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatform;
import org.eclipse.jpt.jpa.core.internal.JpaAnnotationProvider;
import org.eclipse.jpt.jpa.core.internal.jpa2.Generic2_0JpaAnnotationDefinitionProvider;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
-import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaPlatformFactory.EclipseLinkVersion;
+import org.eclipse.jpt.jpa.core.jpa2.JpaProject2_0;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaPlatformFactory.EclipseLinkJpaPlatformVersion;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml2_1Definition;
import org.eclipse.persistence.jpa.jpql.parser.EclipseLinkJPQLGrammar2_3;
public class EclipseLink2_3JpaPlatformFactory
- extends EclipseLink2_0JpaPlatformFactory {
+ implements JpaPlatformFactory
+{
+ /**
+ * Version string for EclipseLink platform version 2.3
+ */
+ public static final String VERSION = "2.3"; //$NON-NLS-1$
/**
* zero-argument constructor
@@ -33,7 +38,6 @@ public class EclipseLink2_3JpaPlatformFactory
super();
}
- @Override
public JpaPlatform buildJpaPlatform(String id) {
return new GenericJpaPlatform(
id,
@@ -45,21 +49,16 @@ public class EclipseLink2_3JpaPlatformFactory
EclipseLinkJPQLGrammar2_3.instance());
}
- @Override
protected JpaPlatform.Version buildJpaVersion() {
- return new EclipseLinkVersion(
- JptJpaEclipseLinkCorePlugin.ECLIPSELINK_PLATFORM_VERSION_2_3,
- JpaFacet.VERSION_2_0.getVersionString());
+ return new EclipseLinkJpaPlatformVersion(VERSION, JpaProject2_0.FACET_VERSION_STRING);
}
- @Override
protected AnnotationProvider buildAnnotationProvider() {
return new JpaAnnotationProvider(
Generic2_0JpaAnnotationDefinitionProvider.instance(),
EclipseLink2_3JpaAnnotationDefinitionProvider.instance());
}
- @Override
protected JpaPlatformVariation buildJpaVariation() {
return new JpaPlatformVariation() {
public Supported getTablePerConcreteClassInheritanceIsSupported() {
@@ -69,16 +68,10 @@ public class EclipseLink2_3JpaPlatformFactory
return true;
}
public AccessType[] getSupportedAccessTypes(JptResourceType resourceType) {
- if (resourceType.getContentType() == JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE) {
- if (this.versionIsEclipseLink2_1Compatibile(resourceType)) {
- return EclipseLink2_1JpaPlatformFactory.ECLIPSELINK_SUPPORTED_ACCESS_TYPES;
- }
- }
- return GENERIC_SUPPORTED_ACCESS_TYPES;
- }
- protected boolean versionIsEclipseLink2_1Compatibile(JptResourceType resourceType) {
- return JptJpaCorePlugin.resourceTypeIsCompatible(resourceType, JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_2_1_RESOURCE_TYPE.getVersion());
+ return resourceType.isKindOf(EclipseLinkOrmXml2_1Definition.instance().getResourceType()) ?
+ EclipseLink2_1JpaPlatformFactory.SUPPORTED_ACCESS_TYPES :
+ GENERIC_SUPPORTED_ACCESS_TYPES;
}
};
}
-} \ No newline at end of file
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_3JpaPlatformProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_3JpaPlatformProvider.java
index 8367d2f7d0..b001e467e7 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_3JpaPlatformProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_3JpaPlatformProvider.java
@@ -1,25 +1,34 @@
/*******************************************************************************
- * Copyright (c) 2011 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
- *******************************************************************************/
+ * Copyright (c) 2011, 2012 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.jpa.eclipselink.core.internal;
import java.util.ArrayList;
-import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.jpt.common.core.JptResourceType;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.jpa.core.JpaPlatformProvider;
+import org.eclipse.jpt.jpa.core.JpaResourceModelProvider;
import org.eclipse.jpt.jpa.core.ResourceDefinition;
import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition;
import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.AbstractJpaPlatformProvider;
+import org.eclipse.jpt.jpa.core.internal.JarResourceModelProvider;
+import org.eclipse.jpt.jpa.core.internal.JavaResourceModelProvider;
+import org.eclipse.jpt.jpa.core.internal.OrmResourceModelProvider;
+import org.eclipse.jpt.jpa.core.internal.PersistenceResourceModelProvider;
+import org.eclipse.jpt.jpa.core.internal.context.java.JarDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.java.JavaSourceFileDefinition;
import org.eclipse.jpt.jpa.core.internal.context.java.JavaTransientMappingDefinition;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmXmlDefinition;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.GenericOrmXml2_0Definition;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence.GenericPersistenceXml2_0Definition;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaArrayMappingDefinition2_3;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaBasicCollectionMappingDefinition2_0;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaBasicMapMappingDefinition2_0;
@@ -39,27 +48,32 @@ import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJav
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaTransformationMappingDefinition2_0;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaVariableOneToOneMappingDefinition2_0;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaVersionMappingDefinition2_2;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml1_1Definition;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml1_2Definition;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml2_0Definition;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml2_1Definition;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml2_2Definition;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml2_3Definition;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXmlDefinition;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.EclipseLink2_0PersistenceXmlDefinition;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceXmlDefinition;
-
+/**
+ * EclipseLink 2.3 platform config
+ */
public class EclipseLink2_3JpaPlatformProvider
- extends AbstractEclipseLink2_0JpaPlatformProvider {
-
+ extends AbstractJpaPlatformProvider
+{
// singleton
private static final JpaPlatformProvider INSTANCE = new EclipseLink2_3JpaPlatformProvider();
-
-
+
/**
* Return the singleton
*/
public static JpaPlatformProvider instance() {
return INSTANCE;
}
-
-
+
/**
* Enforce singleton usage
*/
@@ -71,39 +85,68 @@ public class EclipseLink2_3JpaPlatformProvider
// ********** resource models **********
@Override
- public JptResourceType getMostRecentSupportedResourceType(IContentType contentType) {
- if (contentType.equals(JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE)) {
- return JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_2_3_RESOURCE_TYPE;
- }
- return super.getMostRecentSupportedResourceType(contentType);
+ protected void addMostRecentSupportedResourceTypesTo(ArrayList<JptResourceType> types) {
+ CollectionTools.addAll(types, MOST_RECENT_SUPPORTED_RESOURCE_TYPES);
}
+
+ // order should not be important here
+ protected static final JptResourceType[] MOST_RECENT_SUPPORTED_RESOURCE_TYPES = new JptResourceType[] {
+ JavaSourceFileDefinition.instance().getResourceType(),
+ JarDefinition.instance().getResourceType(),
+ GenericPersistenceXml2_0Definition.instance().getResourceType(),
+ GenericOrmXml2_0Definition.instance().getResourceType(),
+ org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml2_3Definition.instance().getResourceType(),
+ };
+
+ @Override
+ protected void addResourceModelProvidersTo(ArrayList<JpaResourceModelProvider> providers) {
+ CollectionTools.addAll(providers, RESOURCE_MODEL_PROVIDERS);
+ }
+
+ // order should not be important here
+ protected static final JpaResourceModelProvider[] RESOURCE_MODEL_PROVIDERS = new JpaResourceModelProvider[] {
+ JavaResourceModelProvider.instance(),
+ JarResourceModelProvider.instance(),
+ PersistenceResourceModelProvider.instance(),
+ OrmResourceModelProvider.instance(),
+ EclipseLinkOrmResourceModelProvider.instance()
+ };
// ********** resource definitions **********
@Override
protected void addResourceDefinitionsTo(ArrayList<ResourceDefinition> definitions) {
- super.addResourceDefinitionsTo(definitions);
CollectionTools.addAll(definitions, RESOURCE_DEFINITIONS);
}
protected static final ResourceDefinition[] RESOURCE_DEFINITIONS = new ResourceDefinition[] {
+ JavaSourceFileDefinition.instance(),
+ JarDefinition.instance(),
+ EclipseLinkPersistenceXmlDefinition.instance(),
EclipseLink2_0PersistenceXmlDefinition.instance(),
+ GenericOrmXmlDefinition.instance(),
+ GenericOrmXml2_0Definition.instance(),
+ EclipseLinkOrmXmlDefinition.instance(),
+ EclipseLinkOrmXml1_1Definition.instance(),
+ EclipseLinkOrmXml1_2Definition.instance(),
+ EclipseLinkOrmXml2_0Definition.instance(),
EclipseLinkOrmXml2_1Definition.instance(),
EclipseLinkOrmXml2_2Definition.instance(),
EclipseLinkOrmXml2_3Definition.instance()
};
+
// ********* Java type mappings *********
@Override
protected void addJavaTypeMappingDefinitionsTo(ArrayList<JavaTypeMappingDefinition> definitions) {
- CollectionTools.addAll(definitions, JAVA_TYPE_MAPPING_DEFINITIONS);
+ CollectionTools.addAll(definitions, JAVA_TYPE_MAPPING_DEFINITIONS_2_3);
}
// order matches that used by EclipseLink
// NB: no EclipseLink-specific mappings
- protected static final JavaTypeMappingDefinition[] JAVA_TYPE_MAPPING_DEFINITIONS = new JavaTypeMappingDefinition[] {
+ protected static final JavaTypeMappingDefinition[] JAVA_TYPE_MAPPING_DEFINITIONS_2_3 = new JavaTypeMappingDefinition[] {
EclipseLinkJavaEntityDefinition2_3.instance(),
EclipseLinkJavaEmbeddableDefinition2_2.instance(),
EclipseLinkJavaMappedSuperclassDefinition2_3.instance()
@@ -114,12 +157,12 @@ public class EclipseLink2_3JpaPlatformProvider
@Override
protected void addDefaultJavaAttributeMappingDefinitionsTo(ArrayList<DefaultJavaAttributeMappingDefinition> definitions) {
- CollectionTools.addAll(definitions, DEFAULT_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS);
+ CollectionTools.addAll(definitions, DEFAULT_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS_2_3);
}
// order matches that used by EclipseLink
// NB: no change from EclipseLink 1.2 to 2.0
- protected static final DefaultJavaAttributeMappingDefinition[] DEFAULT_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS = new DefaultJavaAttributeMappingDefinition[] {
+ protected static final DefaultJavaAttributeMappingDefinition[] DEFAULT_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS_2_3 = new DefaultJavaAttributeMappingDefinition[] {
EclipseLinkJavaEmbeddedMappingDefinition2_2.instance(),
EclipseLinkJavaOneToManyMappingDefinition2_2.instance(),
EclipseLinkJavaOneToOneMappingDefinition2_2.instance(),
@@ -129,11 +172,11 @@ public class EclipseLink2_3JpaPlatformProvider
@Override
protected void addSpecifiedJavaAttributeMappingDefinitionsTo(ArrayList<JavaAttributeMappingDefinition> definitions) {
- CollectionTools.addAll(definitions, SPECIFIED_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS);
+ CollectionTools.addAll(definitions, SPECIFIED_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS_2_3);
}
// order matches that used by EclipseLink
- protected static final JavaAttributeMappingDefinition[] SPECIFIED_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS = new JavaAttributeMappingDefinition[] {
+ protected static final JavaAttributeMappingDefinition[] SPECIFIED_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS_2_3 = new JavaAttributeMappingDefinition[] {
JavaTransientMappingDefinition.instance(),
EclipseLinkJavaBasicCollectionMappingDefinition2_0.instance(),
EclipseLinkJavaBasicMapMappingDefinition2_0.instance(),
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_4JpaPlatformFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_4JpaPlatformFactory.java
index f68c7f01e9..a9022fcc93 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_4JpaPlatformFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_4JpaPlatformFactory.java
@@ -1,30 +1,35 @@
/*******************************************************************************
- * Copyright (c) 2011, 2012 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
+ * Copyright (c) 2011, 2012 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
+ * Contributors:
+ * Oracle - initial API and implementation
*******************************************************************************/
package org.eclipse.jpt.jpa.eclipselink.core.internal;
import org.eclipse.jpt.common.core.AnnotationProvider;
import org.eclipse.jpt.common.core.JptResourceType;
-import org.eclipse.jpt.jpa.core.JpaFacet;
import org.eclipse.jpt.jpa.core.JpaPlatform;
+import org.eclipse.jpt.jpa.core.JpaPlatformFactory;
import org.eclipse.jpt.jpa.core.JpaPlatformVariation;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.AccessType;
import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatform;
import org.eclipse.jpt.jpa.core.internal.JpaAnnotationProvider;
import org.eclipse.jpt.jpa.core.internal.jpa2.Generic2_0JpaAnnotationDefinitionProvider;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
-import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaPlatformFactory.EclipseLinkVersion;
+import org.eclipse.jpt.jpa.core.jpa2.JpaProject2_0;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaPlatformFactory.EclipseLinkJpaPlatformVersion;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml2_1Definition;
import org.eclipse.persistence.jpa.jpql.parser.EclipseLinkJPQLGrammar2_4;
public class EclipseLink2_4JpaPlatformFactory
- extends EclipseLink2_0JpaPlatformFactory {
+ implements JpaPlatformFactory
+{
+ /**
+ * Version string for EclipseLink platform version 2.4
+ */
+ public static final String VERSION = "2.4"; //$NON-NLS-1$
/**
* zero-argument constructor
@@ -33,7 +38,6 @@ public class EclipseLink2_4JpaPlatformFactory
super();
}
- @Override
public JpaPlatform buildJpaPlatform(String id) {
return new GenericJpaPlatform(
id,
@@ -45,21 +49,16 @@ public class EclipseLink2_4JpaPlatformFactory
EclipseLinkJPQLGrammar2_4.instance());
}
- @Override
protected JpaPlatform.Version buildJpaVersion() {
- return new EclipseLinkVersion(
- JptJpaEclipseLinkCorePlugin.ECLIPSELINK_PLATFORM_VERSION_2_4,
- JpaFacet.VERSION_2_0.getVersionString());
+ return new EclipseLinkJpaPlatformVersion(VERSION, JpaProject2_0.FACET_VERSION_STRING);
}
- @Override
protected AnnotationProvider buildAnnotationProvider() {
return new JpaAnnotationProvider(
Generic2_0JpaAnnotationDefinitionProvider.instance(),
EclipseLink2_4JpaAnnotationDefinitionProvider.instance());
}
- @Override
protected JpaPlatformVariation buildJpaVariation() {
return new JpaPlatformVariation() {
public Supported getTablePerConcreteClassInheritanceIsSupported() {
@@ -69,16 +68,10 @@ public class EclipseLink2_4JpaPlatformFactory
return true;
}
public AccessType[] getSupportedAccessTypes(JptResourceType resourceType) {
- if (resourceType.getContentType() == JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE) {
- if (this.versionIsEclipseLink2_1Compatibile(resourceType)) {
- return EclipseLink2_1JpaPlatformFactory.ECLIPSELINK_SUPPORTED_ACCESS_TYPES;
- }
- }
- return GENERIC_SUPPORTED_ACCESS_TYPES;
- }
- protected boolean versionIsEclipseLink2_1Compatibile(JptResourceType resourceType) {
- return JptJpaCorePlugin.resourceTypeIsCompatible(resourceType, JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_2_1_RESOURCE_TYPE.getVersion());
+ return resourceType.isKindOf(EclipseLinkOrmXml2_1Definition.instance().getResourceType()) ?
+ EclipseLink2_1JpaPlatformFactory.SUPPORTED_ACCESS_TYPES :
+ GENERIC_SUPPORTED_ACCESS_TYPES;
}
};
}
-} \ No newline at end of file
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_4JpaPlatformProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_4JpaPlatformProvider.java
index 448eb63fe6..1d09283706 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_4JpaPlatformProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLink2_4JpaPlatformProvider.java
@@ -1,25 +1,34 @@
/*******************************************************************************
- * Copyright (c) 2011 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
- *******************************************************************************/
+ * Copyright (c) 2011, 2012 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.jpa.eclipselink.core.internal;
import java.util.ArrayList;
-import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.jpt.common.core.JptResourceType;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.jpa.core.JpaPlatformProvider;
+import org.eclipse.jpt.jpa.core.JpaResourceModelProvider;
import org.eclipse.jpt.jpa.core.ResourceDefinition;
import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition;
import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.AbstractJpaPlatformProvider;
+import org.eclipse.jpt.jpa.core.internal.JarResourceModelProvider;
+import org.eclipse.jpt.jpa.core.internal.JavaResourceModelProvider;
+import org.eclipse.jpt.jpa.core.internal.OrmResourceModelProvider;
+import org.eclipse.jpt.jpa.core.internal.PersistenceResourceModelProvider;
+import org.eclipse.jpt.jpa.core.internal.context.java.JarDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.java.JavaSourceFileDefinition;
import org.eclipse.jpt.jpa.core.internal.context.java.JavaTransientMappingDefinition;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmXmlDefinition;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.GenericOrmXml2_0Definition;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence.GenericPersistenceXml2_0Definition;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaArrayMappingDefinition2_3;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaBasicCollectionMappingDefinition2_0;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaBasicMapMappingDefinition2_0;
@@ -39,20 +48,26 @@ import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJav
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaTransformationMappingDefinition2_0;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaVariableOneToOneMappingDefinition2_0;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaVersionMappingDefinition2_2;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml1_1Definition;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml1_2Definition;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml2_0Definition;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml2_1Definition;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml2_2Definition;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml2_3Definition;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml2_4Definition;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXmlDefinition;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.EclipseLink2_4PersistenceXmlDefinition;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceXmlDefinition;
-
+/**
+ * EclipseLink 2.4 platform config
+ */
public class EclipseLink2_4JpaPlatformProvider
- extends AbstractEclipseLink2_0JpaPlatformProvider {
-
+ extends AbstractJpaPlatformProvider
+{
// singleton
private static final JpaPlatformProvider INSTANCE = new EclipseLink2_4JpaPlatformProvider();
-
/**
* Return the singleton
*/
@@ -60,7 +75,6 @@ public class EclipseLink2_4JpaPlatformProvider
return INSTANCE;
}
-
/**
* Enforce singleton usage
*/
@@ -72,40 +86,69 @@ public class EclipseLink2_4JpaPlatformProvider
// ********** resource models **********
@Override
- public JptResourceType getMostRecentSupportedResourceType(IContentType contentType) {
- if (contentType.equals(JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE)) {
- return JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_2_4_RESOURCE_TYPE;
- }
- return super.getMostRecentSupportedResourceType(contentType);
+ protected void addMostRecentSupportedResourceTypesTo(ArrayList<JptResourceType> types) {
+ CollectionTools.addAll(types, MOST_RECENT_SUPPORTED_RESOURCE_TYPES);
+ }
+
+ // order should not be important here
+ protected static final JptResourceType[] MOST_RECENT_SUPPORTED_RESOURCE_TYPES = new JptResourceType[] {
+ JavaSourceFileDefinition.instance().getResourceType(),
+ JarDefinition.instance().getResourceType(),
+ GenericPersistenceXml2_0Definition.instance().getResourceType(),
+ GenericOrmXml2_0Definition.instance().getResourceType(),
+ org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml2_4Definition.instance().getResourceType()
+ };
+
+ @Override
+ protected void addResourceModelProvidersTo(ArrayList<JpaResourceModelProvider> providers) {
+ CollectionTools.addAll(providers, RESOURCE_MODEL_PROVIDERS);
}
+ // order should not be important here
+ protected static final JpaResourceModelProvider[] RESOURCE_MODEL_PROVIDERS = new JpaResourceModelProvider[] {
+ JavaResourceModelProvider.instance(),
+ JarResourceModelProvider.instance(),
+ PersistenceResourceModelProvider.instance(),
+ OrmResourceModelProvider.instance(),
+ EclipseLinkOrmResourceModelProvider.instance()
+ };
+
// ********** resource definitions **********
@Override
protected void addResourceDefinitionsTo(ArrayList<ResourceDefinition> definitions) {
- super.addResourceDefinitionsTo(definitions);
CollectionTools.addAll(definitions, RESOURCE_DEFINITIONS);
}
protected static final ResourceDefinition[] RESOURCE_DEFINITIONS = new ResourceDefinition[] {
+ JavaSourceFileDefinition.instance(),
+ JarDefinition.instance(),
+ EclipseLinkPersistenceXmlDefinition.instance(),
EclipseLink2_4PersistenceXmlDefinition.instance(),
+ GenericOrmXmlDefinition.instance(),
+ GenericOrmXml2_0Definition.instance(),
+ EclipseLinkOrmXmlDefinition.instance(),
+ EclipseLinkOrmXml1_1Definition.instance(),
+ EclipseLinkOrmXml1_2Definition.instance(),
+ EclipseLinkOrmXml2_0Definition.instance(),
EclipseLinkOrmXml2_1Definition.instance(),
EclipseLinkOrmXml2_2Definition.instance(),
EclipseLinkOrmXml2_3Definition.instance(),
EclipseLinkOrmXml2_4Definition.instance()
};
+
// ********* Java type mappings *********
@Override
protected void addJavaTypeMappingDefinitionsTo(ArrayList<JavaTypeMappingDefinition> definitions) {
- CollectionTools.addAll(definitions, JAVA_TYPE_MAPPING_DEFINITIONS);
+ CollectionTools.addAll(definitions, JAVA_TYPE_MAPPING_DEFINITIONS_2_4);
}
// order matches that used by EclipseLink
// NB: no EclipseLink-specific mappings
- protected static final JavaTypeMappingDefinition[] JAVA_TYPE_MAPPING_DEFINITIONS = new JavaTypeMappingDefinition[] {
+ protected static final JavaTypeMappingDefinition[] JAVA_TYPE_MAPPING_DEFINITIONS_2_4 = new JavaTypeMappingDefinition[] {
EclipseLinkJavaEntityDefinition2_3.instance(),
EclipseLinkJavaEmbeddableDefinition2_2.instance(),
EclipseLinkJavaMappedSuperclassDefinition2_3.instance()
@@ -116,12 +159,12 @@ public class EclipseLink2_4JpaPlatformProvider
@Override
protected void addDefaultJavaAttributeMappingDefinitionsTo(ArrayList<DefaultJavaAttributeMappingDefinition> definitions) {
- CollectionTools.addAll(definitions, DEFAULT_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS);
+ CollectionTools.addAll(definitions, DEFAULT_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS_2_4);
}
// order matches that used by EclipseLink
// NB: no change from EclipseLink 1.2 to 2.0
- protected static final DefaultJavaAttributeMappingDefinition[] DEFAULT_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS = new DefaultJavaAttributeMappingDefinition[] {
+ protected static final DefaultJavaAttributeMappingDefinition[] DEFAULT_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS_2_4 = new DefaultJavaAttributeMappingDefinition[] {
EclipseLinkJavaEmbeddedMappingDefinition2_2.instance(),
EclipseLinkJavaOneToManyMappingDefinition2_2.instance(),
EclipseLinkJavaOneToOneMappingDefinition2_2.instance(),
@@ -131,11 +174,11 @@ public class EclipseLink2_4JpaPlatformProvider
@Override
protected void addSpecifiedJavaAttributeMappingDefinitionsTo(ArrayList<JavaAttributeMappingDefinition> definitions) {
- CollectionTools.addAll(definitions, SPECIFIED_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS);
+ CollectionTools.addAll(definitions, SPECIFIED_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS_2_4);
}
// order matches that used by EclipseLink
- protected static final JavaAttributeMappingDefinition[] SPECIFIED_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS = new JavaAttributeMappingDefinition[] {
+ protected static final JavaAttributeMappingDefinition[] SPECIFIED_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS_2_4 = new JavaAttributeMappingDefinition[] {
JavaTransientMappingDefinition.instance(),
EclipseLinkJavaBasicCollectionMappingDefinition2_0.instance(),
EclipseLinkJavaBasicMapMappingDefinition2_0.instance(),
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaPlatformFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaPlatformFactory.java
index ec067a3fd5..598e5e15ca 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaPlatformFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaPlatformFactory.java
@@ -11,16 +11,16 @@ package org.eclipse.jpt.jpa.eclipselink.core.internal;
import org.eclipse.jpt.common.core.AnnotationProvider;
import org.eclipse.jpt.common.core.JptResourceType;
-import org.eclipse.jpt.jpa.core.JpaFacet;
+import org.eclipse.jpt.common.utility.internal.VersionComparator;
import org.eclipse.jpt.jpa.core.JpaPlatform;
import org.eclipse.jpt.jpa.core.JpaPlatformFactory;
import org.eclipse.jpt.jpa.core.JpaPlatformVariation;
+import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.context.AccessType;
import org.eclipse.jpt.jpa.core.internal.GenericJpaAnnotationDefinitionProvider;
import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatform;
-import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatformFactory.SimpleVersion;
+import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatformFactory.GenericJpaPlatformVersion;
import org.eclipse.jpt.jpa.core.internal.JpaAnnotationProvider;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
import org.eclipse.persistence.jpa.jpql.parser.EclipseLinkJPQLGrammar1;
/**
@@ -30,6 +30,11 @@ import org.eclipse.persistence.jpa.jpql.parser.EclipseLinkJPQLGrammar1;
public class EclipseLinkJpaPlatformFactory
implements JpaPlatformFactory
{
+ /**
+ * Version string for EclipseLink platform version 1.0
+ */
+ public static final String VERSION = "1.0"; //$NON-NLS-1$
+
/**
* zero-argument constructor
@@ -50,9 +55,7 @@ public class EclipseLinkJpaPlatformFactory
}
private JpaPlatform.Version buildJpaVersion() {
- return new EclipseLinkVersion(
- JptJpaEclipseLinkCorePlugin.ECLIPSELINK_PLATFORM_VERSION_1_0,
- JpaFacet.VERSION_1_0.getVersionString());
+ return new EclipseLinkJpaPlatformVersion(VERSION, JpaProject.FACET_VERSION_STRING);
}
protected AnnotationProvider buildAnnotationProvider() {
@@ -75,12 +78,15 @@ public class EclipseLinkJpaPlatformFactory
};
}
-
- public static class EclipseLinkVersion extends SimpleVersion {
-
+ /**
+ * EclipseLink JPA platform version
+ */
+ public static class EclipseLinkJpaPlatformVersion
+ extends GenericJpaPlatformVersion
+ {
protected final String eclipseLinkVersion;
- public EclipseLinkVersion(String eclipseLinkVersion, String jpaVersion) {
+ public EclipseLinkJpaPlatformVersion(String eclipseLinkVersion, String jpaVersion) {
super(jpaVersion);
this.eclipseLinkVersion = eclipseLinkVersion;
}
@@ -92,21 +98,21 @@ public class EclipseLinkJpaPlatformFactory
/**
* Return whether the platform is compatible with the specified EclipseLink version.
- * @see JptJpaEclipseLinkCorePlugin#ECLIPSELINK_PLATFORM_VERSION_1_0
- * @see JptJpaEclipseLinkCorePlugin#ECLIPSELINK_PLATFORM_VERSION_1_1
- * @see JptJpaEclipseLinkCorePlugin#ECLIPSELINK_PLATFORM_VERSION_1_2
- * @see JptJpaEclipseLinkCorePlugin#ECLIPSELINK_PLATFORM_VERSION_2_0
- * @see JptJpaEclipseLinkCorePlugin#ECLIPSELINK_PLATFORM_VERSION_2_1
- * @see JptJpaEclipseLinkCorePlugin#ECLIPSELINK_PLATFORM_VERSION_2_2
- * @see JptJpaEclipseLinkCorePlugin#ECLIPSELINK_PLATFORM_VERSION_2_3
+ * @see EclipseLinkJpaPlatformFactory#VERSION
+ * @see EclipseLink1_1JpaPlatformFactory#VERSION
+ * @see EclipseLink1_2JpaPlatformFactory#VERSION
+ * @see EclipseLink2_0JpaPlatformFactory#VERSION
+ * @see EclipseLink2_1JpaPlatformFactory#VERSION
+ * @see EclipseLink2_2JpaPlatformFactory#VERSION
+ * @see EclipseLink2_3JpaPlatformFactory#VERSION
*/
- public boolean isCompatibleWithVersion(String version) {
- return VERSION_COMPARATOR.compare(this.eclipseLinkVersion, version) >= 0;
+ public boolean isCompatibleWithEclipseLinkVersion(String version) {
+ return VersionComparator.INTEGER_VERSION_COMPARATOR.compare(this.eclipseLinkVersion, version) >= 0;
}
@Override
public String toString() {
- return super.toString() + " EclipseLink version: " + this.getVersion(); //$NON-NLS-1$
+ return super.toString() + "/EclipseLink " + this.eclipseLinkVersion; //$NON-NLS-1$
}
}
-} \ No newline at end of file
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaPlatformProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaPlatformProvider.java
index 641e5b14a1..6d935b2e95 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaPlatformProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaPlatformProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2012 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.
@@ -10,13 +10,10 @@
package org.eclipse.jpt.jpa.eclipselink.core.internal;
import java.util.ArrayList;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
import org.eclipse.jpt.common.core.JptResourceType;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.jpa.core.JpaPlatformProvider;
import org.eclipse.jpt.jpa.core.JpaResourceModelProvider;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.ResourceDefinition;
import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition;
import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
@@ -26,11 +23,13 @@ import org.eclipse.jpt.jpa.core.internal.JarResourceModelProvider;
import org.eclipse.jpt.jpa.core.internal.JavaResourceModelProvider;
import org.eclipse.jpt.jpa.core.internal.OrmResourceModelProvider;
import org.eclipse.jpt.jpa.core.internal.PersistenceResourceModelProvider;
+import org.eclipse.jpt.jpa.core.internal.context.java.JarDefinition;
import org.eclipse.jpt.jpa.core.internal.context.java.JavaEmbeddedIdMappingDefinition;
import org.eclipse.jpt.jpa.core.internal.context.java.JavaEmbeddedMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.java.JavaSourceFileDefinition;
import org.eclipse.jpt.jpa.core.internal.context.java.JavaTransientMappingDefinition;
import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmXmlDefinition;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.GenericPersistenceXmlDefinition;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaBasicCollectionMappingDefinition;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaBasicMapMappingDefinition;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.EclipseLinkJavaBasicMappingDefinition;
@@ -49,15 +48,14 @@ import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmX
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceXmlDefinition;
/**
- * EclipseLink platform
+ * EclipseLink 1.0 platform
*/
public class EclipseLinkJpaPlatformProvider
- extends AbstractJpaPlatformProvider {
-
+ extends AbstractJpaPlatformProvider
+{
// singleton
private static final JpaPlatformProvider INSTANCE = new EclipseLinkJpaPlatformProvider();
-
/**
* Return the singleton.
*/
@@ -65,7 +63,6 @@ public class EclipseLinkJpaPlatformProvider
return INSTANCE;
}
-
/**
* Enforce singleton usage
*/
@@ -76,27 +73,20 @@ public class EclipseLinkJpaPlatformProvider
// ********* resource models *********
- public JptResourceType getMostRecentSupportedResourceType(IContentType contentType) {
- if (contentType.equals(JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE)) {
- return JptCommonCorePlugin.JAVA_SOURCE_RESOURCE_TYPE;
- }
- else if (contentType.equals(JptCommonCorePlugin.JAR_CONTENT_TYPE)) {
- return JptCommonCorePlugin.JAR_RESOURCE_TYPE;
- }
- else if (contentType.equals(JptJpaCorePlugin.PERSISTENCE_XML_CONTENT_TYPE)) {
- return JptJpaCorePlugin.PERSISTENCE_XML_1_0_RESOURCE_TYPE;
- }
- else if (contentType.equals(JptJpaCorePlugin.ORM_XML_CONTENT_TYPE)) {
- return JptJpaCorePlugin.ORM_XML_1_0_RESOURCE_TYPE;
- }
- else if (contentType.equals(JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE)) {
- return JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_1_0_RESOURCE_TYPE;
- }
- else {
- throw new IllegalArgumentException(contentType.toString());
- }
+ @Override
+ protected void addMostRecentSupportedResourceTypesTo(ArrayList<JptResourceType> types) {
+ CollectionTools.addAll(types, MOST_RECENT_SUPPORTED_RESOURCE_TYPES);
}
+ // order should not be important here
+ protected static final JptResourceType[] MOST_RECENT_SUPPORTED_RESOURCE_TYPES = new JptResourceType[] {
+ JavaSourceFileDefinition.instance().getResourceType(),
+ JarDefinition.instance().getResourceType(),
+ GenericPersistenceXmlDefinition.instance().getResourceType(),
+ GenericOrmXmlDefinition.instance().getResourceType(),
+ org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXmlDefinition.instance().getResourceType()
+ };
+
@Override
protected void addResourceModelProvidersTo(ArrayList<JpaResourceModelProvider> providers) {
CollectionTools.addAll(providers, RESOURCE_MODEL_PROVIDERS);
@@ -176,6 +166,8 @@ public class EclipseLinkJpaPlatformProvider
}
protected static final ResourceDefinition[] RESOURCE_DEFINITIONS = new ResourceDefinition[] {
+ JavaSourceFileDefinition.instance(),
+ JarDefinition.instance(),
EclipseLinkPersistenceXmlDefinition.instance(),
EclipseLinkOrmXmlDefinition.instance(),
GenericOrmXmlDefinition.instance()
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaProjectImpl.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaProjectImpl.java
index d354457ad5..4d16305210 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaProjectImpl.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaProjectImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2012 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.
@@ -13,7 +13,7 @@ import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.internal.AbstractJpaProject;
import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
import org.eclipse.jpt.jpa.eclipselink.core.EclipseLinkJpaProject;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
+import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings;
/**
* EclipseLink-specific JPA project.
@@ -28,7 +28,7 @@ public class EclipseLinkJpaProjectImpl
public JpaXmlResource getDefaultEclipseLinkOrmXmlResource() {
return (JpaXmlResource) this.getResourceModel(
- JptJpaEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH,
- JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE);
+ XmlEntityMappings.DEFAULT_RUNTIME_PATH,
+ XmlEntityMappings.CONTENT_TYPE);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkOrmResourceModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkOrmResourceModelProvider.java
index d6d8ed6086..8887127999 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkOrmResourceModelProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkOrmResourceModelProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2012 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.
@@ -14,8 +14,8 @@ import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.JpaResourceModelProvider;
import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.orm.EclipseLinkOrmXmlResourceProvider;
+import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings;
/**
* EclipseLink orm.xml
@@ -44,7 +44,7 @@ public class EclipseLinkOrmResourceModelProvider
public IContentType getContentType() {
- return JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE;
+ return XmlEntityMappings.CONTENT_TYPE;
}
public JpaXmlResource buildResourceModel(JpaProject jpaProject, IFile file) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkEntityImpl.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkEntityImpl.java
index bf03953941..324e1e264b 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkEntityImpl.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkEntityImpl.java
@@ -17,6 +17,7 @@ import org.eclipse.jpt.common.utility.internal.NotNullFilter;
import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
+import org.eclipse.jpt.jpa.core.JpaPlatform.Version;
import org.eclipse.jpt.jpa.core.context.AttributeMapping;
import org.eclipse.jpt.jpa.core.context.InheritanceType;
import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
@@ -26,7 +27,6 @@ import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaEntity;
import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCacheable2_0;
import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCacheableHolder2_0;
import org.eclipse.jpt.jpa.core.resource.java.EntityAnnotation;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkChangeTracking;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkConverter;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkCustomizer;
@@ -35,8 +35,11 @@ import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkCaching;
import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkConverterContainer;
import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkEntity;
import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkMultitenancy2_3;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLink2_3JpaPlatformFactory;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaPlatformFactory.EclipseLinkJpaPlatformVersion;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.EclipseLinkEntityPrimaryKeyValidator;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.EclipseLinkTypeMappingValidator;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.plugin.JptJpaEclipseLinkCorePlugin;
import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink;
import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkClassExtractorAnnotation2_1;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
@@ -189,7 +192,12 @@ public class JavaEclipseLinkEntityImpl
}
protected boolean isEclipseLink2_3Compatible() {
- return JptJpaEclipseLinkCorePlugin.nodeIsEclipseLink2_3Compatible(this);
+ return this.getJpaPlatformVersion().isCompatibleWithEclipseLinkVersion(EclipseLink2_3JpaPlatformFactory.VERSION);
+ }
+
+ @Override
+ protected EclipseLinkJpaPlatformVersion getJpaPlatformVersion() {
+ return (EclipseLinkJpaPlatformVersion) super.getJpaPlatformVersion();
}
public boolean isMultitenantMetadataAllowed() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkMappedSuperclassImpl.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkMappedSuperclassImpl.java
index d35595468c..a7691ed13e 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkMappedSuperclassImpl.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkMappedSuperclassImpl.java
@@ -26,7 +26,6 @@ import org.eclipse.jpt.jpa.core.jpa2.context.CacheableHolder2_0;
import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCacheable2_0;
import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCacheableHolder2_0;
import org.eclipse.jpt.jpa.core.resource.java.MappedSuperclassAnnotation;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkChangeTracking;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkConverter;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkCustomizer;
@@ -35,8 +34,11 @@ import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkCaching;
import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkConverterContainer;
import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkMappedSuperclass;
import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkMultitenancy2_3;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLink2_3JpaPlatformFactory;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaPlatformFactory.EclipseLinkJpaPlatformVersion;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.EclipseLinkMappedSuperclassPrimaryKeyValidator;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.EclipseLinkMappedSuperclassValidator;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.plugin.JptJpaEclipseLinkCorePlugin;
import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLink;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -189,7 +191,12 @@ public class JavaEclipseLinkMappedSuperclassImpl
}
protected boolean isEclipseLink2_3Compatible() {
- return JptJpaEclipseLinkCorePlugin.nodeIsEclipseLink2_3Compatible(this);
+ return this.getJpaPlatformVersion().isCompatibleWithEclipseLinkVersion(EclipseLink2_3JpaPlatformFactory.VERSION);
+ }
+
+ @Override
+ protected EclipseLinkJpaPlatformVersion getJpaPlatformVersion() {
+ return (EclipseLinkJpaPlatformVersion) super.getJpaPlatformVersion();
}
public boolean isMultitenantMetadataAllowed() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkMultitenancyImpl2_3.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkMultitenancyImpl2_3.java
index 28c377cd69..821a4f6be5 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkMultitenancyImpl2_3.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkMultitenancyImpl2_3.java
@@ -24,7 +24,7 @@ import org.eclipse.jpt.common.utility.internal.iterables.SuperListIterableWrappe
import org.eclipse.jpt.jpa.core.context.DiscriminatorType;
import org.eclipse.jpt.jpa.core.context.Entity;
import org.eclipse.jpt.jpa.core.context.InheritanceType;
-import org.eclipse.jpt.jpa.core.context.MappingFileRoot;
+import org.eclipse.jpt.jpa.core.context.MappingFile;
import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn;
import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedDiscriminatorColumn;
import org.eclipse.jpt.jpa.core.context.TypeMapping;
@@ -33,7 +33,6 @@ import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
import org.eclipse.jpt.jpa.db.Table;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkEntity;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkMappedSuperclass;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkMultitenantType2_3;
@@ -48,6 +47,8 @@ import org.eclipse.jpt.jpa.eclipselink.core.context.orm.EclipseLinkEntityMapping
import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceUnit;
import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.TargetDatabase;
import org.eclipse.jpt.jpa.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLink2_4JpaPlatformFactory;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaPlatformFactory.EclipseLinkJpaPlatformVersion;
import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.TenantDiscriminatorColumnValidator2_3;
import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.java.NullEclipseLinkTenantDiscriminatorColumnAnnotation2_3;
@@ -585,7 +586,7 @@ public class JavaEclipseLinkMultitenancyImpl2_3
}
public EclipseLinkEntityMappings getEclipseLinkEntityMappings() {
- MappingFileRoot mfRoot = super.getMappingFileRoot();
+ MappingFile.Root mfRoot = super.getMappingFileRoot();
if (mfRoot instanceof EclipseLinkEntityMappings) {
return (EclipseLinkEntityMappings) mfRoot;
}
@@ -674,7 +675,7 @@ public class JavaEclipseLinkMultitenancyImpl2_3
@Override
public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
super.validate(messages, reporter, astRoot);
- if (getSpecifiedType() == EclipseLinkMultitenantType2_3.TABLE_PER_TENANT && !JptJpaEclipseLinkCorePlugin.nodeIsEclipseLink2_4Compatible(this)) {
+ if (getSpecifiedType() == EclipseLinkMultitenantType2_3.TABLE_PER_TENANT && ! this.getJpaPlatformVersion().isCompatibleWithEclipseLinkVersion(EclipseLink2_4JpaPlatformFactory.VERSION)) {
messages.add(
DefaultEclipseLinkJpaValidationMessages.buildMessage(
IMessage.NORMAL_SEVERITY,
@@ -758,6 +759,11 @@ public class JavaEclipseLinkMultitenancyImpl2_3
}
}
+ @Override
+ protected EclipseLinkJpaPlatformVersion getJpaPlatformVersion() {
+ return (EclipseLinkJpaPlatformVersion) super.getJpaPlatformVersion();
+ }
+
public TextRange getValidationTextRange(CompilationUnit astRoot) {
TextRange textRange = this.getMultitenantAnnotation().getTextRange(astRoot);
return (textRange != null) ? textRange : this.getTypeMapping().getValidationTextRange(astRoot);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkEntityMappingsImpl.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkEntityMappingsImpl.java
index 4988ef0b6d..fb7ae7852e 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkEntityMappingsImpl.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkEntityMappingsImpl.java
@@ -31,7 +31,6 @@ import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractEntityMappings;
import org.eclipse.jpt.jpa.db.Table;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkConverter;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkTypeMapping;
import org.eclipse.jpt.jpa.eclipselink.core.context.ReadOnlyTenantDiscriminatorColumn2_3;
@@ -655,7 +654,7 @@ public class EclipseLinkEntityMappingsImpl
@Override
protected IContentType getContentType() {
- return JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE;
+ return XmlEntityMappings.CONTENT_TYPE;
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmElementCollectionMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmElementCollectionMapping2_0.java
index 184167e1c2..0fbdd7244c 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmElementCollectionMapping2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmElementCollectionMapping2_0.java
@@ -19,13 +19,13 @@ import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
import org.eclipse.jpt.jpa.core.context.orm.OrmConverter;
import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.AbstractOrmElementCollectionMapping2_0;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkAccessType;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkElementCollectionMapping2_0;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkJoinFetch;
import org.eclipse.jpt.jpa.eclipselink.core.context.orm.EclipseLinkOrmConvertibleMapping;
import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkConverterContainer;
import org.eclipse.jpt.jpa.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLink2_0JpaPlatformFactory;
import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages;
import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlElementCollection;
import org.eclipse.text.edits.ReplaceEdit;
@@ -84,7 +84,7 @@ public class EclipseLinkOrmElementCollectionMapping2_0
// ********** join fetch **********
public EclipseLinkJoinFetch getJoinFetch() {
- if (getJpaPlatformVersion().getVersion().equals(JptJpaEclipseLinkCorePlugin.ECLIPSELINK_PLATFORM_VERSION_2_0)) {
+ if (getJpaPlatformVersion().getVersion().equals(EclipseLink2_0JpaPlatformFactory.VERSION)) {
throw new UnsupportedOperationException("join-fetch not supported in EclipseLink 2.0 platform"); //$NON-NLS-1$
}
return this.joinFetch;
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmPersistentTypeImpl.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmPersistentTypeImpl.java
index c63cd186a7..5b0ce1bb7a 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmPersistentTypeImpl.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmPersistentTypeImpl.java
@@ -11,6 +11,8 @@ package org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm;
import java.util.List;
import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
+import org.eclipse.jpt.jpa.core.JpaProject;
+import org.eclipse.jpt.jpa.core.JpaPlatform.Version;
import org.eclipse.jpt.jpa.core.context.PersistentType;
import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
@@ -21,11 +23,13 @@ import org.eclipse.jpt.jpa.core.internal.context.orm.SpecifiedOrmPersistentType;
import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
import org.eclipse.jpt.jpa.core.resource.orm.Attributes;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkAccessType;
import org.eclipse.jpt.jpa.eclipselink.core.context.orm.EclipseLinkEntityMappings;
import org.eclipse.jpt.jpa.eclipselink.core.context.orm.EclipseLinkOrmPersistentType;
import org.eclipse.jpt.jpa.eclipselink.core.context.orm.EclipseLinkOrmTypeMapping;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLink2_1JpaPlatformFactory;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaPlatformFactory.EclipseLinkJpaPlatformVersion;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.plugin.JptJpaEclipseLinkCorePlugin;
import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmFactory;
import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlAccessMethods;
import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlAccessMethodsHolder;
@@ -112,10 +116,15 @@ public class EclipseLinkOrmPersistentTypeImpl
//and then the hierarchy affects the access type and we get stuck in an update.
//Validation will check that virtual access is set if it is dynamic.
protected boolean buildDynamic() {
- return JptJpaEclipseLinkCorePlugin.nodeIsEclipseLinkVersionCompatible(this, JptJpaEclipseLinkCorePlugin.ECLIPSELINK_PLATFORM_VERSION_2_1)
+ return this.getJpaPlatformVersion().isCompatibleWithEclipseLinkVersion(EclipseLink2_1JpaPlatformFactory.VERSION)
&& this.resolveJavaResourceType() == null;
}
+ @Override
+ protected EclipseLinkJpaPlatformVersion getJpaPlatformVersion() {
+ return (EclipseLinkJpaPlatformVersion) super.getJpaPlatformVersion();
+ }
+
protected boolean isVirtualAccess() {
return this.getAccess() == EclipseLinkAccessType.VIRTUAL;
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml1_1Definition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml1_1Definition.java
index ba636b0de6..b085e4cb9c 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml1_1Definition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml1_1Definition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2012 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.
@@ -15,7 +15,8 @@ import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition;
import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
import org.eclipse.jpt.jpa.core.context.orm.OrmXmlDefinition;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
+import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings;
+import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v1_1.EclipseLink1_1;
public class EclipseLinkOrmXml1_1Definition
extends AbstractEclipseLinkOrmXmlDefinition
@@ -38,7 +39,7 @@ public class EclipseLinkOrmXml1_1Definition
super();
}
public JptResourceType getResourceType() {
- return JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_1_1_RESOURCE_TYPE;
+ return this.getResourceType(XmlEntityMappings.CONTENT_TYPE, EclipseLink1_1.SCHEMA_VERSION);
}
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml1_2Definition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml1_2Definition.java
index 77527bef2b..224d79805a 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml1_2Definition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml1_2Definition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2012 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.
@@ -15,7 +15,8 @@ import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition;
import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
import org.eclipse.jpt.jpa.core.context.orm.OrmXmlDefinition;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
+import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings;
+import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v1_2.EclipseLink1_2;
public class EclipseLinkOrmXml1_2Definition
extends AbstractEclipseLinkOrmXmlDefinition
@@ -39,7 +40,7 @@ public class EclipseLinkOrmXml1_2Definition
}
public JptResourceType getResourceType() {
- return JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_1_2_RESOURCE_TYPE;
+ return this.getResourceType(XmlEntityMappings.CONTENT_TYPE, EclipseLink1_2.SCHEMA_VERSION);
}
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml2_0Definition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml2_0Definition.java
index 2cd76ef0e9..6e730385b3 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml2_0Definition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml2_0Definition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2012 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.
@@ -27,8 +27,9 @@ import org.eclipse.jpt.jpa.core.internal.context.orm.OrmOneToOneMappingDefinitio
import org.eclipse.jpt.jpa.core.internal.context.orm.OrmTransientMappingDefinition;
import org.eclipse.jpt.jpa.core.internal.context.orm.OrmVersionMappingDefinition;
import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.OrmElementCollectionMapping2_0Definition;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLink2_0JpaPlatformProvider;
+import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings;
+import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_0.EclipseLink2_0;
public class EclipseLinkOrmXml2_0Definition
extends AbstractEclipseLinkOrmXmlDefinition
@@ -52,7 +53,7 @@ public class EclipseLinkOrmXml2_0Definition
}
public JptResourceType getResourceType() {
- return JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_2_0_RESOURCE_TYPE;
+ return this.getResourceType(XmlEntityMappings.CONTENT_TYPE, EclipseLink2_0.SCHEMA_VERSION);
}
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml2_1Definition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml2_1Definition.java
index bb5f160db9..d06be14959 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml2_1Definition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml2_1Definition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2012 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.
@@ -15,7 +15,8 @@ import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition;
import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
import org.eclipse.jpt.jpa.core.context.orm.OrmXmlDefinition;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
+import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings;
+import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_1.EclipseLink2_1;
public class EclipseLinkOrmXml2_1Definition
extends AbstractEclipseLinkOrmXmlDefinition
@@ -39,7 +40,7 @@ public class EclipseLinkOrmXml2_1Definition
}
public JptResourceType getResourceType() {
- return JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_2_1_RESOURCE_TYPE;
+ return this.getResourceType(XmlEntityMappings.CONTENT_TYPE, EclipseLink2_1.SCHEMA_VERSION);
}
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml2_2Definition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml2_2Definition.java
index 0b9a42b08c..826bfd4aab 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml2_2Definition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml2_2Definition.java
@@ -1,13 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2010, 2011 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
- *******************************************************************************/
+ * Copyright (c) 2010, 2012 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.jpa.eclipselink.core.internal.context.orm;
import java.util.ArrayList;
@@ -16,14 +15,14 @@ import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition;
import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
import org.eclipse.jpt.jpa.core.context.orm.OrmXmlDefinition;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
+import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings;
+import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_2.EclipseLink2_2;
public class EclipseLinkOrmXml2_2Definition
extends AbstractEclipseLinkOrmXmlDefinition
{
// singleton
- private static final OrmXmlDefinition INSTANCE =
- new EclipseLinkOrmXml2_2Definition();
+ private static final OrmXmlDefinition INSTANCE = new EclipseLinkOrmXml2_2Definition();
/**
@@ -32,7 +31,7 @@ public class EclipseLinkOrmXml2_2Definition
public static OrmXmlDefinition instance() {
return INSTANCE;
}
-
+
/**
* Enforce singleton usage
@@ -48,7 +47,7 @@ public class EclipseLinkOrmXml2_2Definition
}
public JptResourceType getResourceType() {
- return JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_2_2_RESOURCE_TYPE;
+ return this.getResourceType(XmlEntityMappings.CONTENT_TYPE, EclipseLink2_2.SCHEMA_VERSION);
}
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml2_3Definition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml2_3Definition.java
index 1b86429d5a..b44a6c2e0a 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml2_3Definition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml2_3Definition.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2011 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
- *******************************************************************************/
+ * Copyright (c) 2011, 2012 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.jpa.eclipselink.core.internal.context.orm;
import java.util.ArrayList;
@@ -27,7 +27,9 @@ import org.eclipse.jpt.jpa.core.internal.context.orm.OrmOneToOneMappingDefinitio
import org.eclipse.jpt.jpa.core.internal.context.orm.OrmTransientMappingDefinition;
import org.eclipse.jpt.jpa.core.internal.context.orm.OrmVersionMappingDefinition;
import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.OrmElementCollectionMapping2_0Definition;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLink2_3JpaPlatformProvider;
+import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings;
+import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_3.EclipseLink2_3;
public class EclipseLinkOrmXml2_3Definition
@@ -43,7 +45,7 @@ public class EclipseLinkOrmXml2_3Definition
public static OrmXmlDefinition instance() {
return INSTANCE;
}
-
+
/**
* Enforce singleton usage
@@ -54,7 +56,7 @@ public class EclipseLinkOrmXml2_3Definition
public JptResourceType getResourceType() {
- return JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_2_3_RESOURCE_TYPE;
+ return this.getResourceType(XmlEntityMappings.CONTENT_TYPE, EclipseLink2_3.SCHEMA_VERSION);
}
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml2_4Definition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml2_4Definition.java
index a5669b4c8d..785cd6c05f 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml2_4Definition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXml2_4Definition.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2011, 2012 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
- *******************************************************************************/
+ * Copyright (c) 2011, 2012 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.jpa.eclipselink.core.internal.context.orm;
import java.util.ArrayList;
@@ -15,7 +15,8 @@ import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition;
import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
import org.eclipse.jpt.jpa.core.context.orm.OrmXmlDefinition;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
+import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings;
+import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_4.EclipseLink2_4;
public class EclipseLinkOrmXml2_4Definition
@@ -42,7 +43,7 @@ public class EclipseLinkOrmXml2_4Definition
public JptResourceType getResourceType() {
- return JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_2_4_RESOURCE_TYPE;
+ return this.getResourceType(XmlEntityMappings.CONTENT_TYPE, EclipseLink2_4.SCHEMA_VERSION);
}
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXmlDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXmlDefinition.java
index 751e36ce08..15f287768e 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXmlDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXmlDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2012 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.
@@ -26,8 +26,9 @@ import org.eclipse.jpt.jpa.core.internal.context.orm.OrmOneToManyMappingDefiniti
import org.eclipse.jpt.jpa.core.internal.context.orm.OrmOneToOneMappingDefinition;
import org.eclipse.jpt.jpa.core.internal.context.orm.OrmTransientMappingDefinition;
import org.eclipse.jpt.jpa.core.internal.context.orm.OrmVersionMappingDefinition;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaPlatformProvider;
+import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLink;
+import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings;
public class EclipseLinkOrmXmlDefinition
extends AbstractEclipseLinkOrmXmlDefinition
@@ -51,7 +52,7 @@ public class EclipseLinkOrmXmlDefinition
}
public JptResourceType getResourceType() {
- return JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_1_0_RESOURCE_TYPE;
+ return this.getResourceType(XmlEntityMappings.CONTENT_TYPE, EclipseLink.SCHEMA_VERSION);
}
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkEntityImpl.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkEntityImpl.java
index 894ed5a3bd..eb03727958 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkEntityImpl.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkEntityImpl.java
@@ -31,7 +31,6 @@ import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCacheable2_0;
import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCacheableHolder2_0;
import org.eclipse.jpt.jpa.core.resource.orm.XmlClassReference;
import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlCacheable_2_0;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkChangeTracking;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkConverter;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkCustomizer;
@@ -42,10 +41,13 @@ import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkConverterC
import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkEntity;
import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkMultitenancy2_3;
import org.eclipse.jpt.jpa.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLink2_3JpaPlatformFactory;
import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaPlatformFactory.EclipseLinkJpaPlatformVersion;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.EclipseLinkDynamicTypeMappingValidator;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.EclipseLinkEntityPrimaryKeyValidator;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.EclipseLinkTypeMappingValidator;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.plugin.JptJpaEclipseLinkCorePlugin;
import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkClassExtractorAnnotation2_1;
import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntity;
import org.eclipse.text.edits.ReplaceEdit;
@@ -206,7 +208,12 @@ public class OrmEclipseLinkEntityImpl
}
protected boolean isEclipseLink2_3Compatible() {
- return JptJpaEclipseLinkCorePlugin.nodeIsEclipseLink2_3Compatible(this);
+ return this.getJpaPlatformVersion().isCompatibleWithEclipseLinkVersion(EclipseLink2_3JpaPlatformFactory.VERSION);
+ }
+
+ @Override
+ protected EclipseLinkJpaPlatformVersion getJpaPlatformVersion() {
+ return (EclipseLinkJpaPlatformVersion) super.getJpaPlatformVersion();
}
public boolean isMultitenantMetadataAllowed() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkMappedSuperclassImpl.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkMappedSuperclassImpl.java
index 86fe9361e7..c2e2e80170 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkMappedSuperclassImpl.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkMappedSuperclassImpl.java
@@ -27,7 +27,6 @@ import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmMappedSuperclass
import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCacheable2_0;
import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCacheableHolder2_0;
import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlCacheable_2_0;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkChangeTracking;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkConverter;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkCustomizer;
@@ -38,10 +37,13 @@ import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkMappedSupe
import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmEclipseLinkMultitenancy2_3;
import org.eclipse.jpt.jpa.eclipselink.core.context.orm.EclipseLinkOrmPersistentType;
import org.eclipse.jpt.jpa.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLink2_3JpaPlatformFactory;
import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaPlatformFactory.EclipseLinkJpaPlatformVersion;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.EclipseLinkDynamicTypeMappingValidator;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.EclipseLinkMappedSuperclassPrimaryKeyValidator;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.EclipseLinkMappedSuperclassValidator;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.plugin.JptJpaEclipseLinkCorePlugin;
import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlMappedSuperclass;
import org.eclipse.text.edits.ReplaceEdit;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
@@ -208,9 +210,15 @@ public class OrmEclipseLinkMappedSuperclassImpl
}
protected boolean isEclipseLink2_3Compatible() {
- return JptJpaEclipseLinkCorePlugin.nodeIsEclipseLink2_3Compatible(this);
+ return this.getJpaPlatformVersion().isCompatibleWithEclipseLinkVersion(EclipseLink2_3JpaPlatformFactory.VERSION);
}
+ @Override
+ protected EclipseLinkJpaPlatformVersion getJpaPlatformVersion() {
+ return (EclipseLinkJpaPlatformVersion) super.getJpaPlatformVersion();
+ }
+
+
// ********** query container **********
public OrmQueryContainer getQueryContainer() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkMultitenancyImpl2_3.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkMultitenancyImpl2_3.java
index 9b298be332..2e54001c3f 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkMultitenancyImpl2_3.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkMultitenancyImpl2_3.java
@@ -28,7 +28,6 @@ import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
import org.eclipse.jpt.jpa.core.resource.orm.XmlTypeMapping;
import org.eclipse.jpt.jpa.db.Table;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkEntity;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkMappedSuperclass;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkMultitenantType2_3;
@@ -46,6 +45,8 @@ import org.eclipse.jpt.jpa.eclipselink.core.context.orm.OrmVirtualTenantDiscrimi
import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceUnit;
import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.TargetDatabase;
import org.eclipse.jpt.jpa.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLink2_4JpaPlatformFactory;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaPlatformFactory.EclipseLinkJpaPlatformVersion;
import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.TenantDiscriminatorColumnValidator2_3;
import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmFactory;
@@ -694,7 +695,7 @@ public class OrmEclipseLinkMultitenancyImpl2_3
@Override
public void validate(List<IMessage> messages, IReporter reporter) {
super.validate(messages, reporter);
- if (getType() == EclipseLinkMultitenantType2_3.TABLE_PER_TENANT && !JptJpaEclipseLinkCorePlugin.nodeIsEclipseLink2_4Compatible(this)) {
+ if (getType() == EclipseLinkMultitenantType2_3.TABLE_PER_TENANT && ! this.getJpaPlatformVersion().isCompatibleWithEclipseLinkVersion(EclipseLink2_4JpaPlatformFactory.VERSION)) {
messages.add(
DefaultEclipseLinkJpaValidationMessages.buildMessage(
IMessage.NORMAL_SEVERITY,
@@ -767,6 +768,11 @@ public class OrmEclipseLinkMultitenancyImpl2_3
}
}
+ @Override
+ protected EclipseLinkJpaPlatformVersion getJpaPlatformVersion() {
+ return (EclipseLinkJpaPlatformVersion) super.getJpaPlatformVersion();
+ }
+
public TextRange getValidationTextRange() {
TextRange textRange = this.getXmlMultitenantValidationTextRange();
return (textRange != null) ? textRange : this.getTypeMapping().getValidationTextRange();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/VirtualJavaPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/VirtualJavaPersistentAttribute.java
index d457409419..6162ce8504 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/VirtualJavaPersistentAttribute.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/VirtualJavaPersistentAttribute.java
@@ -34,8 +34,8 @@ import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaNullAttrib
import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField;
import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaPersistentAttribute2_0;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
import org.eclipse.jpt.jpa.eclipselink.core.context.java.JavaEclipseLinkPersistentAttribute;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.plugin.JptJpaEclipseLinkCorePlugin;
import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlAttributeMapping;
public class VirtualJavaPersistentAttribute
@@ -212,7 +212,7 @@ public class VirtualJavaPersistentAttribute
this.interfaceIsValidForVariableOneToOne();
}
catch (JavaModelException e) {
- JptJpaEclipseLinkCorePlugin.log(e);
+ JptJpaEclipseLinkCorePlugin.instance().logError(e);
return false;
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLink2_0PersistenceXmlDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLink2_0PersistenceXmlDefinition.java
index 1b37aec558..474d0e3c05 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLink2_0PersistenceXmlDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLink2_0PersistenceXmlDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2012 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.
@@ -11,10 +11,10 @@ package org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence;
import org.eclipse.emf.ecore.EFactory;
import org.eclipse.jpt.common.core.JptResourceType;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXmlContextNodeFactory;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXmlDefinition;
import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceXmlDefinition;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence.GenericPersistenceXml2_0Definition;
import org.eclipse.jpt.jpa.core.resource.persistence.v2_0.PersistenceV2_0Factory;
public class EclipseLink2_0PersistenceXmlDefinition
@@ -39,7 +39,7 @@ public class EclipseLink2_0PersistenceXmlDefinition
}
public JptResourceType getResourceType() {
- return JptJpaCorePlugin.PERSISTENCE_XML_2_0_RESOURCE_TYPE;
+ return GenericPersistenceXml2_0Definition.instance().getResourceType();
}
public EFactory getResourceNodeFactory() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLink2_4PersistenceXmlDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLink2_4PersistenceXmlDefinition.java
index f8a5d3fee3..eb18ffe6fc 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLink2_4PersistenceXmlDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLink2_4PersistenceXmlDefinition.java
@@ -11,14 +11,15 @@ package org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence;
import org.eclipse.emf.ecore.EFactory;
import org.eclipse.jpt.common.core.JptResourceType;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXmlContextNodeFactory;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXmlDefinition;
import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceXmlDefinition;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence.GenericPersistenceXml2_0Definition;
import org.eclipse.jpt.jpa.core.resource.persistence.v2_0.PersistenceV2_0Factory;
-public class EclipseLink2_4PersistenceXmlDefinition extends AbstractPersistenceXmlDefinition {
-
+public class EclipseLink2_4PersistenceXmlDefinition
+ extends AbstractPersistenceXmlDefinition
+{
// singleton
private static final PersistenceXmlDefinition INSTANCE = new EclipseLink2_4PersistenceXmlDefinition();
@@ -42,7 +43,7 @@ public class EclipseLink2_4PersistenceXmlDefinition extends AbstractPersistenceX
}
public JptResourceType getResourceType() {
- return JptJpaCorePlugin.PERSISTENCE_XML_2_0_RESOURCE_TYPE;
+ return GenericPersistenceXml2_0Definition.instance().getResourceType();
}
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceXmlDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceXmlDefinition.java
index e522115f3a..f5cd68c226 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceXmlDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceXmlDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2012 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.
@@ -11,10 +11,10 @@ package org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence;
import org.eclipse.emf.ecore.EFactory;
import org.eclipse.jpt.common.core.JptResourceType;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXmlContextNodeFactory;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXmlDefinition;
import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceXmlDefinition;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.GenericPersistenceXmlDefinition;
import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
public class EclipseLinkPersistenceXmlDefinition
@@ -39,7 +39,7 @@ public class EclipseLinkPersistenceXmlDefinition
}
public JptResourceType getResourceType() {
- return JptJpaCorePlugin.PERSISTENCE_XML_1_0_RESOURCE_TYPE;
+ return GenericPersistenceXmlDefinition.instance().getResourceType();
}
public EFactory getResourceNodeFactory() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/ddlgen/AbstractEclipseLinkDDLGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/ddlgen/AbstractEclipseLinkDDLGenerator.java
index 349532ad0f..22922d19ea 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/ddlgen/AbstractEclipseLinkDDLGenerator.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/ddlgen/AbstractEclipseLinkDDLGenerator.java
@@ -36,7 +36,6 @@ import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXmlEnumValue;
import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
import org.eclipse.jpt.jpa.db.ConnectionProfile;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.Connection;
import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.Customization;
import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.DdlGenerationType;
@@ -44,6 +43,9 @@ import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.Logging;
import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.LoggingLevel;
import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.OutputMode;
import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.SchemaGeneration;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLink2_1JpaPlatformFactory;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaPlatformFactory.EclipseLinkJpaPlatformVersion;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.plugin.JptJpaEclipseLinkCorePlugin;
import org.eclipse.osgi.util.ManifestElement;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleException;
@@ -142,7 +144,8 @@ public abstract class AbstractEclipseLinkDDLGenerator extends AbstractJptGenerat
}
protected void appendDynamicArgument(StringBuffer sb) {
- if (JptJpaEclipseLinkCorePlugin.nodeIsEclipseLinkVersionCompatible(this.jpaProject, JptJpaEclipseLinkCorePlugin.ECLIPSELINK_PLATFORM_VERSION_2_1)) {
+ EclipseLinkJpaPlatformVersion jpaVersion = (EclipseLinkJpaPlatformVersion) this.jpaProject.getJpaPlatform().getJpaVersion();
+ if (jpaVersion.isCompatibleWithEclipseLinkVersion(EclipseLink2_1JpaPlatformFactory.VERSION)) {
sb.append(' ').append(DYNAMIC_PROGRAM_ARGUMENT);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/operations/EclipseLinkOrmFileCreationDataModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/operations/EclipseLinkOrmFileCreationDataModelProvider.java
index 2d6b3e56eb..971753a851 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/operations/EclipseLinkOrmFileCreationDataModelProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/operations/EclipseLinkOrmFileCreationDataModelProvider.java
@@ -9,13 +9,13 @@
******************************************************************************/
package org.eclipse.jpt.jpa.eclipselink.core.internal.operations;
-import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.jpt.common.utility.internal.ArrayTools;
+import org.eclipse.jpt.jpa.core.JpaPlatform;
import org.eclipse.jpt.jpa.core.internal.operations.OrmFileCreationDataModelProvider;
-import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
import org.eclipse.jpt.jpa.eclipselink.core.platform.EclipseLinkPlatform;
import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLink;
+import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v1_1.EclipseLink1_1;
import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v1_2.EclipseLink1_2;
import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_0.EclipseLink2_0;
@@ -43,36 +43,29 @@ public class EclipseLinkOrmFileCreationDataModelProvider
@Override
protected String getDefaultFileName() {
- return JptJpaEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH.lastSegment();
+ return XmlEntityMappings.DEFAULT_RUNTIME_PATH.lastSegment();
}
@Override
- protected String getDefaultVersion() {
- JpaProject jpaProject = this.getJpaProject();
- if (jpaProject == null) {
- return null;
- }
- try {
- return jpaProject.getJpaPlatform().getMostRecentSupportedResourceType(
- JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE).getVersion();
- }
- catch (IllegalArgumentException iae) {
- // eclipselink content not supported for project
- return null;
- }
+ protected IContentType getContentType() {
+ return XmlEntityMappings.CONTENT_TYPE;
}
@Override
protected boolean fileVersionSupported(String fileVersion) {
- return fileVersion.equals(EclipseLink.SCHEMA_VERSION)
- || fileVersion.equals(EclipseLink1_1.SCHEMA_VERSION)
- || fileVersion.equals(EclipseLink1_2.SCHEMA_VERSION)
- || fileVersion.equals(EclipseLink2_0.SCHEMA_VERSION)
- || fileVersion.equals(EclipseLink2_1.SCHEMA_VERSION)
- || fileVersion.equals(EclipseLink2_2.SCHEMA_VERSION)
- || fileVersion.equals(EclipseLink2_3.SCHEMA_VERSION)
- || fileVersion.equals(EclipseLink2_4.SCHEMA_VERSION);
+ return ArrayTools.contains(ECLIPSE_LINK_SCHEMA_VERSIONS, fileVersion);
}
+
+ protected static final String[] ECLIPSE_LINK_SCHEMA_VERSIONS = new String[] {
+ EclipseLink.SCHEMA_VERSION,
+ EclipseLink1_1.SCHEMA_VERSION,
+ EclipseLink1_2.SCHEMA_VERSION,
+ EclipseLink2_0.SCHEMA_VERSION,
+ EclipseLink2_1.SCHEMA_VERSION,
+ EclipseLink2_2.SCHEMA_VERSION,
+ EclipseLink2_3.SCHEMA_VERSION,
+ EclipseLink2_4.SCHEMA_VERSION
+ };
@Override
protected boolean fileVersionSupportedForFacetVersion(String fileVersion, String jpaFacetVersion) {
@@ -81,11 +74,7 @@ public class EclipseLinkOrmFileCreationDataModelProvider
}
@Override
- protected boolean isSupportedPlatformId(String id) {
- JpaPlatformDescription platform = JptJpaCorePlugin.getJpaPlatformManager().getJpaPlatform(id);
- if (platform == null) {
- return false;
- }
- return EclipseLinkPlatform.GROUP.equals(platform.getGroup());
+ protected boolean platformIsSupported(JpaPlatform jpaPlatform) {
+ return jpaPlatform.getDescription().getGroupDescription().equals(EclipseLinkPlatform.GROUP);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/operations/EclipseLinkOrmFileCreationOperation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/operations/EclipseLinkOrmFileCreationOperation.java
index 06573a32b5..4ea778af34 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/operations/EclipseLinkOrmFileCreationOperation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/operations/EclipseLinkOrmFileCreationOperation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2012 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.
@@ -11,7 +11,7 @@ package org.eclipse.jpt.jpa.eclipselink.core.internal.operations;
import org.eclipse.core.resources.IFile;
import org.eclipse.jpt.jpa.core.internal.operations.OrmFileCreationOperation;
-import org.eclipse.jpt.jpa.core.resource.AbstractXmlResourceProvider;
+import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResourceProvider;
import org.eclipse.jpt.jpa.eclipselink.core.internal.resource.orm.EclipseLinkOrmXmlResourceProvider;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
@@ -23,7 +23,7 @@ public class EclipseLinkOrmFileCreationOperation extends OrmFileCreationOperatio
@Override
- protected AbstractXmlResourceProvider getXmlResourceProvider(IFile file) {
+ protected JpaXmlResourceProvider getXmlResourceProvider(IFile file) {
return EclipseLinkOrmXmlResourceProvider.getXmlResourceProvider(file);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/plugin/JptJpaEclipseLinkCorePlugin.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/plugin/JptJpaEclipseLinkCorePlugin.java
new file mode 100644
index 0000000000..7118c88530
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/plugin/JptJpaEclipseLinkCorePlugin.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2012 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.jpa.eclipselink.core.internal.plugin;
+
+import org.eclipse.jpt.common.core.internal.utility.JptPlugin;
+
+public class JptJpaEclipseLinkCorePlugin
+ extends JptPlugin
+{
+ // ********** singleton **********
+
+ private static volatile JptJpaEclipseLinkCorePlugin INSTANCE;
+
+ /**
+ * Return the singleton Dali EclipseLink core plug-in.
+ */
+ public static JptJpaEclipseLinkCorePlugin instance() {
+ return INSTANCE;
+ }
+
+
+ // ********** Dali plug-in **********
+
+ public JptJpaEclipseLinkCorePlugin() {
+ super();
+ }
+
+ @Override
+ protected void setInstance(JptPlugin plugin) {
+ INSTANCE = (JptJpaEclipseLinkCorePlugin) plugin;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/orm/EclipseLinkOrmXmlResourceProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/orm/EclipseLinkOrmXmlResourceProvider.java
index d6d6be213c..d2d9511e38 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/orm/EclipseLinkOrmXmlResourceProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/orm/EclipseLinkOrmXmlResourceProvider.java
@@ -13,16 +13,15 @@ import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jpt.jpa.core.internal.operations.OrmFileCreationDataModelProperties;
-import org.eclipse.jpt.jpa.core.resource.AbstractXmlResourceProvider;
+import org.eclipse.jpt.jpa.core.internal.resource.xml.AbstractJpaXmlResourceProvider;
import org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitDefaults;
import org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitMetadata;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmFactory;
import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
public class EclipseLinkOrmXmlResourceProvider
- extends AbstractXmlResourceProvider
+ extends AbstractJpaXmlResourceProvider
implements OrmFileCreationDataModelProperties
{
/**
@@ -46,7 +45,7 @@ public class EclipseLinkOrmXmlResourceProvider
* the given project in the default runtime location
*/
public static EclipseLinkOrmXmlResourceProvider getDefaultXmlResourceProvider(IProject project) {
- return getXmlResourceProvider(project, JptJpaEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH);
+ return getXmlResourceProvider(project, XmlEntityMappings.DEFAULT_RUNTIME_PATH);
}
private static EclipseLinkOrmXmlResourceProvider getXmlResourceProvider_(IProject project, IPath fullPath) {
@@ -55,11 +54,11 @@ public class EclipseLinkOrmXmlResourceProvider
public EclipseLinkOrmXmlResourceProvider(IProject project) {
- this(project, JptJpaEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH);
+ this(project, XmlEntityMappings.DEFAULT_RUNTIME_PATH);
}
public EclipseLinkOrmXmlResourceProvider(IProject project, IPath filePath) {
- super(project, filePath, JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE);
+ super(project, filePath, XmlEntityMappings.CONTENT_TYPE);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/platform/EclipseLinkPlatform.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/platform/EclipseLinkPlatform.java
index b6401dd3e1..f13d7eb218 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/platform/EclipseLinkPlatform.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/platform/EclipseLinkPlatform.java
@@ -1,17 +1,19 @@
/*******************************************************************************
- * Copyright (c) 2010, 2011 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
- *******************************************************************************/
+ * Copyright (c) 2010, 2012 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.jpa.eclipselink.core.platform;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.jpt.jpa.core.JpaWorkspace;
import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
import org.eclipse.jpt.jpa.core.platform.JpaPlatformGroupDescription;
+import org.eclipse.jpt.jpa.core.platform.JpaPlatformManager;
/**
* Constants pertaining to the EclipseLink JPA platforms and their group
@@ -27,33 +29,39 @@ import org.eclipse.jpt.jpa.core.platform.JpaPlatformGroupDescription;
*/
public class EclipseLinkPlatform {
- public static final JpaPlatformGroupDescription GROUP
- = JptJpaCorePlugin.getJpaPlatformManager().getJpaPlatformGroup("eclipselink"); //$NON-NLS-1$
+ public static final JpaPlatformGroupDescription GROUP = getJpaPlatformGroupDescription("eclipselink"); //$NON-NLS-1$
- public static final JpaPlatformDescription VERSION_1_0
- = JptJpaCorePlugin.getJpaPlatformManager().getJpaPlatform("org.eclipse.eclipselink.platform"); //$NON-NLS-1$
+ public static final JpaPlatformDescription VERSION_1_0 = getJpaPlatformDescription("org.eclipse.eclipselink.platform"); //$NON-NLS-1$
- public static final JpaPlatformDescription VERSION_1_1
- = JptJpaCorePlugin.getJpaPlatformManager().getJpaPlatform("eclipselink1_1"); //$NON-NLS-1$
+ public static final JpaPlatformDescription VERSION_1_1 = getJpaPlatformDescription("eclipselink1_1"); //$NON-NLS-1$
- public static final JpaPlatformDescription VERSION_1_2
- = JptJpaCorePlugin.getJpaPlatformManager().getJpaPlatform("eclipselink1_2"); //$NON-NLS-1$
+ public static final JpaPlatformDescription VERSION_1_2 = getJpaPlatformDescription("eclipselink1_2"); //$NON-NLS-1$
- public static final JpaPlatformDescription VERSION_2_0
- = JptJpaCorePlugin.getJpaPlatformManager().getJpaPlatform("eclipselink2_0"); //$NON-NLS-1$
+ public static final JpaPlatformDescription VERSION_2_0 = getJpaPlatformDescription("eclipselink2_0"); //$NON-NLS-1$
- public static final JpaPlatformDescription VERSION_2_1
- = JptJpaCorePlugin.getJpaPlatformManager().getJpaPlatform("eclipselink2_1"); //$NON-NLS-1$
+ public static final JpaPlatformDescription VERSION_2_1 = getJpaPlatformDescription("eclipselink2_1"); //$NON-NLS-1$
- public static final JpaPlatformDescription VERSION_2_2
- = JptJpaCorePlugin.getJpaPlatformManager().getJpaPlatform("eclipselink2_2"); //$NON-NLS-1$
+ public static final JpaPlatformDescription VERSION_2_2 = getJpaPlatformDescription("eclipselink2_2"); //$NON-NLS-1$
- public static final JpaPlatformDescription VERSION_2_3
- = JptJpaCorePlugin.getJpaPlatformManager().getJpaPlatform("eclipselink2_3"); //$NON-NLS-1$
+ public static final JpaPlatformDescription VERSION_2_3 = getJpaPlatformDescription("eclipselink2_3"); //$NON-NLS-1$
- public static final JpaPlatformDescription VERSION_2_4
- = JptJpaCorePlugin.getJpaPlatformManager().getJpaPlatform("eclipselink2_4"); //$NON-NLS-1$
+ public static final JpaPlatformDescription VERSION_2_4 = getJpaPlatformDescription("eclipselink2_4"); //$NON-NLS-1$
+ private static JpaPlatformGroupDescription getJpaPlatformGroupDescription(String platformGroupID) {
+ return getJpaPlatformManager().getJpaPlatformGroupDescription(platformGroupID);
+ }
+
+ private static JpaPlatformDescription getJpaPlatformDescription(String platformID) {
+ return getJpaPlatformManager().getJpaPlatformDescription(platformID);
+ }
+
+ private static JpaPlatformManager getJpaPlatformManager() {
+ return getJpaWorkspace().getJpaPlatformManager();
+ }
+
+ private static JpaWorkspace getJpaWorkspace() {
+ return (JpaWorkspace) ResourcesPlugin.getWorkspace().getAdapter(JpaWorkspace.class);
+ }
/**
* Not for instantiation
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/EclipseLinkOrmXmlResourceFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/EclipseLinkOrmXmlResourceFactory.java
index 57154bbb46..ce0b3e6aed 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/EclipseLinkOrmXmlResourceFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/EclipseLinkOrmXmlResourceFactory.java
@@ -1,18 +1,16 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2012 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.jpa.eclipselink.core.resource.orm;
import org.eclipse.emf.common.util.URI;
import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
import org.eclipse.wst.common.internal.emf.resource.Renderer;
import org.eclipse.wst.common.internal.emf.resource.RendererFactory;
import org.eclipse.wst.common.internal.emf.resource.TranslatorResource;
@@ -48,6 +46,6 @@ public class EclipseLinkOrmXmlResourceFactory extends TranslatorResourceFactory
*/
@Override
protected TranslatorResource createResource(URI uri, Renderer renderer) {
- return new JpaXmlResource(uri, renderer, JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE, XmlEntityMappings.getRootTranslator());
+ return new JpaXmlResource(uri, renderer, XmlEntityMappings.CONTENT_TYPE, XmlEntityMappings.getRootTranslator());
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlEntityMappings.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlEntityMappings.java
index 37deb173ec..1c9b4c77f5 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlEntityMappings.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlEntityMappings.java
@@ -12,7 +12,9 @@ package org.eclipse.jpt.jpa.eclipselink.core.resource.orm;
import java.util.Collection;
import java.util.HashMap;
-import java.util.Map;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.EList;
@@ -28,6 +30,7 @@ import org.eclipse.jpt.jpa.core.resource.orm.SqlResultSetMapping;
import org.eclipse.jpt.jpa.core.resource.orm.XmlNamedNativeQuery;
import org.eclipse.jpt.jpa.core.resource.orm.XmlNamedQuery;
import org.eclipse.jpt.jpa.core.resource.orm.XmlSequenceGenerator;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.plugin.JptJpaEclipseLinkCorePlugin;
import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v1_1.EclipseLink1_1;
import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v1_2.EclipseLink1_2;
import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_0.EclipseLink2_0;
@@ -1336,21 +1339,24 @@ public class XmlEntityMappings extends org.eclipse.jpt.jpa.core.resource.orm.Xml
}
return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
}
-
-
- // **************** version -> schema location mapping ********************
-
- private static String namespace = EclipseLink.SCHEMA_NAMESPACE;
-
+
+
+ // ********** version -> schema location mapping **********
+
@Override
protected String getNamespace() {
- return namespace;
+ return EclipseLink.SCHEMA_NAMESPACE;
}
-
- private static Map<String, String> versionsToSchemaLocations = buildVersionsToSchemaLocations();
-
- private static Map<String, String> buildVersionsToSchemaLocations() {
- Map<String, String> map = new HashMap<String, String>();
+
+ @Override
+ protected String getSchemaLocationForVersion(String schemaVersion) {
+ return SCHEMA_LOCATIONS.get(schemaVersion);
+ }
+
+ private static HashMap<String, String> SCHEMA_LOCATIONS = buildSchemaLocations();
+
+ private static HashMap<String, String> buildSchemaLocations() {
+ HashMap<String, String> map = new HashMap<String, String>();
map.put(EclipseLink.SCHEMA_VERSION, EclipseLink.SCHEMA_LOCATION);
map.put(EclipseLink1_1.SCHEMA_VERSION, EclipseLink1_1.SCHEMA_LOCATION);
map.put(EclipseLink1_2.SCHEMA_VERSION, EclipseLink1_2.SCHEMA_LOCATION);
@@ -1362,13 +1368,24 @@ public class XmlEntityMappings extends org.eclipse.jpt.jpa.core.resource.orm.Xml
return map;
}
- @Override
- protected String getSchemaLocationForVersion(String version) {
- return versionsToSchemaLocations.get(version);
- }
-
+
+ // ********** content/resource type **********
+
+ /**
+ * The content type for <code>eclipselink-orm.xml</code> mapping files.
+ * @see org.eclipse.jpt.jpa.core.resource.ResourceMappingFile.Root#CONTENT_TYPE
+ */
+ public static final IContentType CONTENT_TYPE = JptJpaEclipseLinkCorePlugin.instance().getContentType("orm"); //$NON-NLS-1$
+
+
+ // ********** default runtime path **********
- // **************** translators *******************************************
+ public static final String DEFAULT_RUNTIME_PATH_NAME = "META-INF/eclipselink-orm.xml"; //$NON-NLS-1$
+
+ public static final IPath DEFAULT_RUNTIME_PATH = new Path(DEFAULT_RUNTIME_PATH_NAME);
+
+
+ // ********** translators **********
private static final Translator ROOT_TRANSLATOR = buildRootTranslator();
@@ -1377,18 +1394,15 @@ public class XmlEntityMappings extends org.eclipse.jpt.jpa.core.resource.orm.Xml
}
private static Translator buildRootTranslator() {
- return new SimpleRootTranslator(
- JPA.ENTITY_MAPPINGS,
- EclipseLinkOrmPackage.eINSTANCE.getXmlEntityMappings(),
- buildTranslatorChildren());
+ return new SimpleRootTranslator(JPA.ENTITY_MAPPINGS, EclipseLinkOrmPackage.eINSTANCE.getXmlEntityMappings(), buildTranslatorChildren());
}
private static Translator[] buildTranslatorChildren() {
return new Translator[] {
- buildVersionTranslator(versionsToSchemaLocations),
- buildNamespaceTranslator(namespace),
+ buildVersionTranslator(SCHEMA_LOCATIONS),
+ buildNamespaceTranslator(EclipseLink.SCHEMA_NAMESPACE),
buildSchemaNamespaceTranslator(),
- buildSchemaLocationTranslator(namespace, versionsToSchemaLocations),
+ buildSchemaLocationTranslator(EclipseLink.SCHEMA_NAMESPACE, SCHEMA_LOCATIONS),
buildDescriptionTranslator(),
XmlPersistenceUnitMetadata.buildTranslator(JPA.PERSISTENCE_UNIT_METADATA, OrmPackage.eINSTANCE.getXmlEntityMappings_PersistenceUnitMetadata()),
buildPackageTranslator(),
@@ -1430,5 +1444,4 @@ public class XmlEntityMappings extends org.eclipse.jpt.jpa.core.resource.orm.Xml
protected static Translator buildAccessMethodsTranslator() {
return XmlAccessMethods.buildTranslator(EclipseLink.ACCESS_METHODS, EclipseLinkOrmPackage.eINSTANCE.getXmlAccessMethodsHolder_AccessMethods());
}
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/.classpath b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/.classpath
index e990211c48..56f805a063 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/.classpath
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/.classpath
@@ -5,6 +5,7 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
<accessrules>
+ <accessrule kind="nonaccessible" pattern="org/eclipse/jpt/**/plugin/**"/>
<accessrule kind="accessible" pattern="org/eclipse/jpt/jpa/ui/**"/>
<accessrule kind="accessible" pattern="org/eclipse/jpt/common/core/**"/>
<accessrule kind="accessible" pattern="org/eclipse/jpt/common/ui/**"/>
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/META-INF/MANIFEST.MF b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/META-INF/MANIFEST.MF
index e5c707146c..21041052b5 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/META-INF/MANIFEST.MF
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/META-INF/MANIFEST.MF
@@ -4,7 +4,7 @@ Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.jpt.jpa.eclipselink.ui;singleton:=true
Bundle-Version: 2.2.0.qualifier
-Bundle-Activator: org.eclipse.jpt.jpa.eclipselink.ui.JptJpaEclipseLinkUiPlugin
+Bundle-Activator: org.eclipse.jpt.jpa.eclipselink.ui.internal.plugin.JptJpaEclipseLinkUiPlugin
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .
Bundle-Localization: plugin
@@ -35,9 +35,10 @@ Require-Bundle: org.eclipse.core.resources;bundle-version="[3.4.0,4.0.0)",
org.eclipse.wst.common.emf;bundle-version="[1.2.100,2.0.0)",
org.eclipse.wst.common.frameworks;bundle-version="[1.1.200,2.0.0)",
org.eclipse.wst.common.frameworks.ui;bundle-version="[1.1.200,2.0.0)",
+ org.eclipse.wst.common.project.facet.core;bundle-version="[1.4.100,2.0.0)",
org.eclipse.wst.validation;bundle-version="[1.2.0,2.0.0)"
-Export-Package: org.eclipse.jpt.jpa.eclipselink.ui,
- org.eclipse.jpt.jpa.eclipselink.ui.internal;x-internal:=true,
+Import-Package: com.ibm.icu.text;version="4.0.1"
+Export-Package: org.eclipse.jpt.jpa.eclipselink.ui.internal;x-internal:=true,
org.eclipse.jpt.jpa.eclipselink.ui.internal.commands;x-internal:=true,
org.eclipse.jpt.jpa.eclipselink.ui.internal.ddlgen;x-internal:=true,
org.eclipse.jpt.jpa.eclipselink.ui.internal.ddlgen.wizards;x-internal:=true,
@@ -62,4 +63,3 @@ Export-Package: org.eclipse.jpt.jpa.eclipselink.ui,
org.eclipse.jpt.jpa.eclipselink.ui.internal.wizards;x-internal:=true,
org.eclipse.jpt.jpa.eclipselink.ui.internal.wizards.conversion.java;x-internal:=true,
org.eclipse.jpt.jpa.eclipselink.ui.internal.wizards.gen;x-internal:=true
-Import-Package: com.ibm.icu.text;version="4.0.1"
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/plugin.xml b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/plugin.xml
index fc8d4c28b4..bcd9013ea3 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/plugin.xml
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/plugin.xml
@@ -257,7 +257,7 @@
<count value="1"/>
<iterate operator="and">
<instanceof value="org.eclipse.jpt.jpa.eclipselink.core.context.orm.EclipseLinkOrmPersistentType"/>
- <test property="org.eclipse.jpt.jpa.core.isCompatibleVersion" value="&apos;2.1&apos;"/>
+ <test property="org.eclipse.jpt.common.core.resourceTypeIsKindOf" value="org.eclipse.jpt.jpa.eclipselink.core.content.orm:2.1"/>
</iterate>
</with>
</and>
@@ -325,7 +325,7 @@
<count value="1"/>
<iterate operator="and">
<instanceof value="org.eclipse.jpt.jpa.eclipselink.core.context.orm.EclipseLinkOrmPersistentType"/>
- <test property="org.eclipse.jpt.jpa.core.isCompatibleVersion" value="&apos;2.1&apos;"/>
+ <test property="org.eclipse.jpt.common.core.resourceTypeIsKindOf" value="org.eclipse.jpt.jpa.eclipselink.core.content.orm:2.1"/>
</iterate>
</with>
</visibleWhen>
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/JptJpaEclipseLinkUiPlugin.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/JptJpaEclipseLinkUiPlugin.java
deleted file mode 100644
index 4cd3365542..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/JptJpaEclipseLinkUiPlugin.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2011 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.jpa.eclipselink.ui;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-/**
- * The activator class controls the plug-in life cycle
- *
- *
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- */
-@SuppressWarnings("nls")
-public class JptJpaEclipseLinkUiPlugin extends AbstractUIPlugin
-{
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.jpt.jpa.eclipselink.ui";
-
-
- // ********** singleton **********
- private static JptJpaEclipseLinkUiPlugin INSTANCE;
-
- /**
- * Returns the singleton Plugin
- */
- public static JptJpaEclipseLinkUiPlugin instance() {
- return INSTANCE;
- }
-
- /**
- * Log the specified message.
- */
- public static void log(String msg) {
- log(msg, null);
- }
-
- /**
- * Log the specified exception or error.
- */
- public static void log(Throwable throwable) {
- log(throwable.getLocalizedMessage(), throwable);
- }
-
- /**
- * Log the specified message and exception or error.
- */
- public static void log(String msg, Throwable throwable) {
- log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, msg, throwable));
- }
-
- /**
- * Log the specified status.
- */
- public static void log(IStatus status) {
- INSTANCE.getLog().log(status);
- }
-
-
- // ********** Image API **********
- /**
- * This gets a .gif from the icons folder.
- */
- public static ImageDescriptor getImageDescriptor(String key) {
- if (! key.startsWith("icons/")) {
- key = "icons/" + key;
- }
- if (! key.endsWith(".gif")) {
- key = key + ".gif";
- }
- return imageDescriptorFromPlugin(PLUGIN_ID, key);
- }
-
- /**
- * This returns an image for a .gif from the icons folder
- */
- //TODO we are using the ImageRegistry here and storing all our icons for the life of the plugin,
- //which means until the workspace is closed. This is better than before where we constantly
- //created new images. Bug 306437 is about cleaning this up and using Local Resource Managers
- //on our views so that closing the JPA perspective would mean our icons are disposed.
- public static Image getImage(String key) {
- ImageRegistry imageRegistry = instance().getImageRegistry();
- Image image = imageRegistry.get(key);
- if (image == null) {
- imageRegistry.put(key, getImageDescriptor(key));
- image = imageRegistry.get(key);
- }
- return image;
- }
-
-
-
- // ********** constructors **********
- public JptJpaEclipseLinkUiPlugin() {
- super();
- if (INSTANCE != null) {
- throw new IllegalStateException();
- }
- INSTANCE = this;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/EclipseLinkHelpContextIds.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/EclipseLinkHelpContextIds.java
index 77d4f5c04f..14d9685622 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/EclipseLinkHelpContextIds.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/EclipseLinkHelpContextIds.java
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.eclipselink.ui.internal;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
+import org.eclipse.jpt.jpa.eclipselink.ui.internal.plugin.JptJpaEclipseLinkUiPlugin;
/**
* Help context ids for the Dali EclipseLink UI.
@@ -22,7 +22,7 @@ import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
public interface EclipseLinkHelpContextIds {
//ContextID prefix
- public static final String PREFIX = JptJpaUiPlugin.PLUGIN_ID + ".";
+ public static final String PREFIX = JptJpaEclipseLinkUiPlugin.instance().getPluginID() + ".";
//Persistent Type composites
public static final String CACHING_ALWAYS_REFRESH = PREFIX + "caching_alwaysRefresh";
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/ddlgen/EclipseLinkDDLGeneratorUi.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/ddlgen/EclipseLinkDDLGeneratorUi.java
index 83a5b4392c..55cbc7e496 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/ddlgen/EclipseLinkDDLGeneratorUi.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/ddlgen/EclipseLinkDDLGeneratorUi.java
@@ -1,12 +1,12 @@
/*******************************************************************************
-* Copyright (c) 2007, 2012 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
-*******************************************************************************/
+ * Copyright (c) 2007, 2012 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.jpa.eclipselink.ui.internal.ddlgen;
import org.eclipse.jface.wizard.WizardDialog;
@@ -79,6 +79,6 @@ public class EclipseLinkDDLGeneratorUi
}
protected Persistence getPersistence() {
- return this.project.getRootContextNode().getPersistenceXml().getPersistence();
+ return this.project.getRootContextNode().getPersistenceXml().getRoot();
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/ddlgen/wizards/GenerateDDLWizard.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/ddlgen/wizards/GenerateDDLWizard.java
index 6dd3df244e..9a6cb133c6 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/ddlgen/wizards/GenerateDDLWizard.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/ddlgen/wizards/GenerateDDLWizard.java
@@ -27,8 +27,8 @@ import org.eclipse.jpt.jpa.db.ConnectionProfile;
import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.OutputMode;
import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.SchemaGeneration;
import org.eclipse.jpt.jpa.eclipselink.core.internal.ddlgen.EclipseLinkDDLGenerator;
-import org.eclipse.jpt.jpa.eclipselink.ui.JptJpaEclipseLinkUiPlugin;
import org.eclipse.jpt.jpa.eclipselink.ui.internal.EclipseLinkUiMessages;
+import org.eclipse.jpt.jpa.eclipselink.ui.internal.plugin.JptJpaEclipseLinkUiPlugin;
import org.eclipse.jpt.jpa.ui.internal.JptUiMessages;
import org.eclipse.jpt.jpa.ui.internal.wizards.DatabaseSchemaWizardPage;
import org.eclipse.osgi.util.NLS;
@@ -204,7 +204,7 @@ public class GenerateDDLWizard extends Wizard {
@Override
protected void jptPluginLogException(Exception exception) {
- JptJpaEclipseLinkUiPlugin.log(exception);
+ JptJpaEclipseLinkUiPlugin.instance().logError(exception);
}
// ********** internal methods **********
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/AbstractEclipseLinkArrayMapping2_3UiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/AbstractEclipseLinkArrayMapping2_3UiDefinition.java
index 11a0dda8fa..7b9fbe3edf 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/AbstractEclipseLinkArrayMapping2_3UiDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/AbstractEclipseLinkArrayMapping2_3UiDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 Oracle. All rights reserved.
+ * Copyright (c) 2011, 2012 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.
@@ -11,11 +11,8 @@ package org.eclipse.jpt.jpa.eclipselink.ui.internal.details;
import org.eclipse.jpt.jpa.eclipselink.core.EclipseLinkMappingKeys;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkArrayMapping2_3;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
-import org.eclipse.jpt.jpa.ui.internal.JptUiIcons;
import org.eclipse.jpt.jpa.ui.internal.details.AbstractMappingUiDefinition;
import org.eclipse.jpt.jpa.ui.internal.jpa2.details.JptUiDetailsMessages2_0;
-import org.eclipse.swt.graphics.Image;
public abstract class AbstractEclipseLinkArrayMapping2_3UiDefinition<M, T extends EclipseLinkArrayMapping2_3>
extends AbstractMappingUiDefinition<M, T>
@@ -24,8 +21,8 @@ public abstract class AbstractEclipseLinkArrayMapping2_3UiDefinition<M, T extend
super();
}
- public Image getImage() {
- return JptJpaUiPlugin.getImage(JptUiIcons.JPA_CONTENT);
+ public String getKey() {
+ return EclipseLinkMappingKeys.ARRAY_ATTRIBUTE_MAPPING_KEY;
}
public String getLabel() {
@@ -35,8 +32,4 @@ public abstract class AbstractEclipseLinkArrayMapping2_3UiDefinition<M, T extend
public String getLinkLabel() {
return JptUiDetailsMessages2_0.ArrayMapping2_3_linkLabel;
}
-
- public String getKey() {
- return EclipseLinkMappingKeys.ARRAY_ATTRIBUTE_MAPPING_KEY;
- }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/AbstractEclipseLinkBasicCollectionMappingUiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/AbstractEclipseLinkBasicCollectionMappingUiDefinition.java
index ea4bfeb0b9..7939f71723 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/AbstractEclipseLinkBasicCollectionMappingUiDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/AbstractEclipseLinkBasicCollectionMappingUiDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2012 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.
@@ -11,10 +11,7 @@ package org.eclipse.jpt.jpa.eclipselink.ui.internal.details;
import org.eclipse.jpt.jpa.eclipselink.core.EclipseLinkMappingKeys;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkBasicCollectionMapping;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
-import org.eclipse.jpt.jpa.ui.internal.JptUiIcons;
import org.eclipse.jpt.jpa.ui.internal.details.AbstractMappingUiDefinition;
-import org.eclipse.swt.graphics.Image;
public abstract class AbstractEclipseLinkBasicCollectionMappingUiDefinition<M, T extends EclipseLinkBasicCollectionMapping>
extends AbstractMappingUiDefinition<M, T>
@@ -22,21 +19,16 @@ public abstract class AbstractEclipseLinkBasicCollectionMappingUiDefinition<M, T
protected AbstractEclipseLinkBasicCollectionMappingUiDefinition() {
super();
}
-
-
- public Image getImage() {
- return JptJpaUiPlugin.getImage(JptUiIcons.JPA_CONTENT);
+
+ public String getKey() {
+ return EclipseLinkMappingKeys.BASIC_COLLECTION_ATTRIBUTE_MAPPING_KEY;
}
-
+
public String getLabel() {
return EclipseLinkUiDetailsMessages.EclipseLinkBasicCollectionMappingUiProvider_label;
}
-
+
public String getLinkLabel() {
return EclipseLinkUiDetailsMessages.EclipseLinkBasicCollectionMappingUiProvider_linkLabel;
}
-
- public String getKey() {
- return EclipseLinkMappingKeys.BASIC_COLLECTION_ATTRIBUTE_MAPPING_KEY;
- }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/AbstractEclipseLinkBasicMapMappingUiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/AbstractEclipseLinkBasicMapMappingUiDefinition.java
index 8784ef4ec8..f61eaf1fc6 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/AbstractEclipseLinkBasicMapMappingUiDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/AbstractEclipseLinkBasicMapMappingUiDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2012 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.
@@ -11,10 +11,7 @@ package org.eclipse.jpt.jpa.eclipselink.ui.internal.details;
import org.eclipse.jpt.jpa.eclipselink.core.EclipseLinkMappingKeys;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkBasicMapMapping;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
-import org.eclipse.jpt.jpa.ui.internal.JptUiIcons;
import org.eclipse.jpt.jpa.ui.internal.details.AbstractMappingUiDefinition;
-import org.eclipse.swt.graphics.Image;
public abstract class AbstractEclipseLinkBasicMapMappingUiDefinition<M, T extends EclipseLinkBasicMapMapping>
extends AbstractMappingUiDefinition<M, T>
@@ -22,21 +19,16 @@ public abstract class AbstractEclipseLinkBasicMapMappingUiDefinition<M, T extend
protected AbstractEclipseLinkBasicMapMappingUiDefinition() {
super();
}
-
-
- public Image getImage() {
- return JptJpaUiPlugin.getImage(JptUiIcons.JPA_CONTENT);
+
+ public String getKey() {
+ return EclipseLinkMappingKeys.BASIC_MAP_ATTRIBUTE_MAPPING_KEY;
}
-
+
public String getLabel() {
return EclipseLinkUiDetailsMessages.EclipseLinkBasicMapMappingUiProvider_label;
}
-
+
public String getLinkLabel() {
return EclipseLinkUiDetailsMessages.EclipseLinkBasicMapMappingUiProvider_linkLabel;
}
-
- public String getKey() {
- return EclipseLinkMappingKeys.BASIC_MAP_ATTRIBUTE_MAPPING_KEY;
- }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/AbstractEclipseLinkStructureMapping2_3UiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/AbstractEclipseLinkStructureMapping2_3UiDefinition.java
index f293506590..b10df93c27 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/AbstractEclipseLinkStructureMapping2_3UiDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/AbstractEclipseLinkStructureMapping2_3UiDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 Oracle. All rights reserved.
+ * Copyright (c) 2011, 2012 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.
@@ -11,11 +11,8 @@ package org.eclipse.jpt.jpa.eclipselink.ui.internal.details;
import org.eclipse.jpt.jpa.eclipselink.core.EclipseLinkMappingKeys;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkStructureMapping2_3;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
-import org.eclipse.jpt.jpa.ui.internal.JptUiIcons;
import org.eclipse.jpt.jpa.ui.internal.details.AbstractMappingUiDefinition;
import org.eclipse.jpt.jpa.ui.internal.jpa2.details.JptUiDetailsMessages2_0;
-import org.eclipse.swt.graphics.Image;
public abstract class AbstractEclipseLinkStructureMapping2_3UiDefinition<M, T extends EclipseLinkStructureMapping2_3>
extends AbstractMappingUiDefinition<M, T>
@@ -24,8 +21,8 @@ public abstract class AbstractEclipseLinkStructureMapping2_3UiDefinition<M, T ex
super();
}
- public Image getImage() {
- return JptJpaUiPlugin.getImage(JptUiIcons.JPA_CONTENT);
+ public String getKey() {
+ return EclipseLinkMappingKeys.STRUCTURE_ATTRIBUTE_MAPPING_KEY;
}
public String getLabel() {
@@ -35,8 +32,4 @@ public abstract class AbstractEclipseLinkStructureMapping2_3UiDefinition<M, T ex
public String getLinkLabel() {
return JptUiDetailsMessages2_0.StructureMapping2_3_linkLabel;
}
-
- public String getKey() {
- return EclipseLinkMappingKeys.STRUCTURE_ATTRIBUTE_MAPPING_KEY;
- }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/AbstractEclipseLinkTransformationMappingUiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/AbstractEclipseLinkTransformationMappingUiDefinition.java
index e684b086ec..14e510bc96 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/AbstractEclipseLinkTransformationMappingUiDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/AbstractEclipseLinkTransformationMappingUiDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2012 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.
@@ -11,10 +11,7 @@ package org.eclipse.jpt.jpa.eclipselink.ui.internal.details;
import org.eclipse.jpt.jpa.eclipselink.core.EclipseLinkMappingKeys;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkTransformationMapping;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
-import org.eclipse.jpt.jpa.ui.internal.JptUiIcons;
import org.eclipse.jpt.jpa.ui.internal.details.AbstractMappingUiDefinition;
-import org.eclipse.swt.graphics.Image;
public abstract class AbstractEclipseLinkTransformationMappingUiDefinition<M, T extends EclipseLinkTransformationMapping>
extends AbstractMappingUiDefinition<M, T>
@@ -22,21 +19,16 @@ public abstract class AbstractEclipseLinkTransformationMappingUiDefinition<M, T
protected AbstractEclipseLinkTransformationMappingUiDefinition() {
super();
}
-
-
- public Image getImage() {
- return JptJpaUiPlugin.getImage(JptUiIcons.JPA_CONTENT);
+
+ public String getKey() {
+ return EclipseLinkMappingKeys.TRANSFORMATION_ATTRIBUTE_MAPPING_KEY;
}
-
+
public String getLabel() {
return EclipseLinkUiDetailsMessages.EclipseLinkTransformationMappingUiProvider_label;
}
-
+
public String getLinkLabel() {
return EclipseLinkUiDetailsMessages.EclipseLinkTransformationMappingUiProvider_linkLabel;
}
-
- public String getKey() {
- return EclipseLinkMappingKeys.TRANSFORMATION_ATTRIBUTE_MAPPING_KEY;
- }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/AbstractEclipseLinkVariableOneToOneMappingUiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/AbstractEclipseLinkVariableOneToOneMappingUiDefinition.java
index fe7a51fad1..be593b2bfd 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/AbstractEclipseLinkVariableOneToOneMappingUiDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/AbstractEclipseLinkVariableOneToOneMappingUiDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2012 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.
@@ -11,10 +11,7 @@ package org.eclipse.jpt.jpa.eclipselink.ui.internal.details;
import org.eclipse.jpt.jpa.eclipselink.core.EclipseLinkMappingKeys;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkVariableOneToOneMapping;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
-import org.eclipse.jpt.jpa.ui.internal.JptUiIcons;
import org.eclipse.jpt.jpa.ui.internal.details.AbstractMappingUiDefinition;
-import org.eclipse.swt.graphics.Image;
public abstract class AbstractEclipseLinkVariableOneToOneMappingUiDefinition<M, T extends EclipseLinkVariableOneToOneMapping>
extends AbstractMappingUiDefinition<M, T>
@@ -22,21 +19,16 @@ public abstract class AbstractEclipseLinkVariableOneToOneMappingUiDefinition<M,
protected AbstractEclipseLinkVariableOneToOneMappingUiDefinition() {
super();
}
-
-
- public Image getImage() {
- return JptJpaUiPlugin.getImage(JptUiIcons.JPA_CONTENT);
+
+ public String getKey() {
+ return EclipseLinkMappingKeys.VARIABLE_ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY;
}
-
+
public String getLabel() {
return EclipseLinkUiDetailsMessages.EclipseLinkVariableOneToOneMappingUiProvider_label;
}
-
+
public String getLinkLabel() {
return EclipseLinkUiDetailsMessages.EclipseLinkVariableOneToOneMappingUiProvider_linkLabel;
}
-
- public String getKey() {
- return EclipseLinkMappingKeys.VARIABLE_ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY;
- }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLink2_4ProjectFlagModel.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLink2_4ProjectFlagModel.java
index 48265eae68..73c5624d43 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLink2_4ProjectFlagModel.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLink2_4ProjectFlagModel.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 Oracle. All rights reserved.
+ * Copyright (c) 2011, 2012 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.
@@ -12,7 +12,8 @@ package org.eclipse.jpt.jpa.eclipselink.ui.internal.details;
import org.eclipse.jpt.common.utility.internal.model.value.TransformationPropertyValueModel;
import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
import org.eclipse.jpt.jpa.core.JpaNode;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLink2_4JpaPlatformFactory;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaPlatformFactory.EclipseLinkJpaPlatformVersion;
/**
* Flag indicating whether the JPA project supports EclipseLink 2.4
@@ -26,6 +27,7 @@ public class EclipseLink2_4ProjectFlagModel<T extends JpaNode>
@Override
protected Boolean transform_(T value) {
- return Boolean.valueOf(JptJpaEclipseLinkCorePlugin.nodeIsEclipseLink2_4Compatible(value));
+ EclipseLinkJpaPlatformVersion jpaVersion = (EclipseLinkJpaPlatformVersion) value.getJpaPlatform().getJpaVersion();
+ return Boolean.valueOf(jpaVersion.isCompatibleWithEclipseLinkVersion(EclipseLink2_4JpaPlatformFactory.VERSION));
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkMultitenancyComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkMultitenancyComposite.java
index 559fc0ac03..fd4b101a4c 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkMultitenancyComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkMultitenancyComposite.java
@@ -20,7 +20,7 @@ import org.eclipse.jpt.common.utility.internal.iterables.SuperListIterableWrappe
import org.eclipse.jpt.common.utility.internal.model.value.ListAspectAdapter;
import org.eclipse.jpt.common.utility.internal.model.value.ListPropertyValueModelAdapter;
import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.common.utility.internal.model.value.ReadOnlyWritablePropertyValueModelWrapper;
+import org.eclipse.jpt.common.utility.internal.model.value.ReadOnlyModifiablePropertyValueModelWrapper;
import org.eclipse.jpt.common.utility.internal.model.value.TransformationPropertyValueModel;
import org.eclipse.jpt.common.utility.internal.model.value.ValueListAdapter;
import org.eclipse.jpt.common.utility.model.event.StateChangeEvent;
@@ -354,7 +354,7 @@ public class EclipseLinkMultitenancyComposite extends Pane<EclipseLinkMultitenan
TenantDiscriminatorColumnPaneEnablerHolder() {
super(
new ValueListAdapter<EclipseLinkMultitenancy2_3>(
- new ReadOnlyWritablePropertyValueModelWrapper<EclipseLinkMultitenancy2_3>(getSubjectHolder()),
+ new ReadOnlyModifiablePropertyValueModelWrapper<EclipseLinkMultitenancy2_3>(getSubjectHolder()),
EclipseLinkMultitenancy2_3.SPECIFIED_TENANT_DISCRIMINATOR_COLUMNS_LIST
)
);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/java/DefaultJavaEclipseLinkOneToManyMappingUiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/java/DefaultJavaEclipseLinkOneToManyMappingUiDefinition.java
index 0a99951a98..bcd47819bc 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/java/DefaultJavaEclipseLinkOneToManyMappingUiDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/java/DefaultJavaEclipseLinkOneToManyMappingUiDefinition.java
@@ -18,9 +18,7 @@ import org.eclipse.jpt.jpa.eclipselink.ui.internal.details.EclipseLinkUiDetailsM
import org.eclipse.jpt.jpa.ui.details.JpaComposite;
import org.eclipse.jpt.jpa.ui.details.java.DefaultJavaAttributeMappingUiDefinition;
import org.eclipse.jpt.jpa.ui.details.java.JavaUiFactory;
-import org.eclipse.jpt.jpa.ui.internal.JpaMappingImageHelper;
import org.eclipse.jpt.jpa.ui.internal.details.AbstractOneToManyMappingUiDefinition;
-import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
public class DefaultJavaEclipseLinkOneToManyMappingUiDefinition
@@ -28,10 +26,8 @@ public class DefaultJavaEclipseLinkOneToManyMappingUiDefinition
implements DefaultJavaAttributeMappingUiDefinition<JavaOneToManyMapping>
{
// singleton
- private static final DefaultJavaEclipseLinkOneToManyMappingUiDefinition INSTANCE =
- new DefaultJavaEclipseLinkOneToManyMappingUiDefinition();
-
-
+ private static final DefaultJavaEclipseLinkOneToManyMappingUiDefinition INSTANCE = new DefaultJavaEclipseLinkOneToManyMappingUiDefinition();
+
/**
* Return the singleton.
*/
@@ -67,18 +63,7 @@ public class DefaultJavaEclipseLinkOneToManyMappingUiDefinition
return EclipseLinkUiDetailsMessages.DefaultEclipseLinkOneToManyMappingUiProvider_linkLabel;
}
- @Override
- public Image getImage() {
- return JpaMappingImageHelper.imageForAttributeMapping(getDefaultKey());
- }
-
- public JpaComposite buildAttributeMappingComposite(
- JavaUiFactory factory,
- PropertyValueModel<JavaOneToManyMapping> subjectHolder,
- PropertyValueModel<Boolean> enabledModel,
- Composite parent,
- WidgetFactory widgetFactory) {
-
+ public JpaComposite buildAttributeMappingComposite(JavaUiFactory factory, PropertyValueModel<JavaOneToManyMapping> subjectHolder, PropertyValueModel<Boolean> enabledModel, Composite parent, WidgetFactory widgetFactory) {
return factory.createJavaOneToManyMappingComposite(subjectHolder, enabledModel, parent, widgetFactory);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/java/DefaultJavaEclipseLinkOneToOneMappingUiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/java/DefaultJavaEclipseLinkOneToOneMappingUiDefinition.java
index e29c0a2ff8..2e873f5958 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/java/DefaultJavaEclipseLinkOneToOneMappingUiDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/java/DefaultJavaEclipseLinkOneToOneMappingUiDefinition.java
@@ -18,9 +18,7 @@ import org.eclipse.jpt.jpa.eclipselink.ui.internal.details.EclipseLinkUiDetailsM
import org.eclipse.jpt.jpa.ui.details.JpaComposite;
import org.eclipse.jpt.jpa.ui.details.java.DefaultJavaAttributeMappingUiDefinition;
import org.eclipse.jpt.jpa.ui.details.java.JavaUiFactory;
-import org.eclipse.jpt.jpa.ui.internal.JpaMappingImageHelper;
import org.eclipse.jpt.jpa.ui.internal.details.AbstractOneToOneMappingUiDefinition;
-import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
public class DefaultJavaEclipseLinkOneToOneMappingUiDefinition
@@ -28,10 +26,8 @@ public class DefaultJavaEclipseLinkOneToOneMappingUiDefinition
implements DefaultJavaAttributeMappingUiDefinition<JavaOneToOneMapping>
{
// singleton
- private static final DefaultJavaEclipseLinkOneToOneMappingUiDefinition INSTANCE =
- new DefaultJavaEclipseLinkOneToOneMappingUiDefinition();
-
-
+ private static final DefaultJavaEclipseLinkOneToOneMappingUiDefinition INSTANCE = new DefaultJavaEclipseLinkOneToOneMappingUiDefinition();
+
/**
* Return the singleton.
*/
@@ -67,18 +63,7 @@ public class DefaultJavaEclipseLinkOneToOneMappingUiDefinition
return EclipseLinkUiDetailsMessages.DefaultEclipseLinkOneToOneMappingUiProvider_linkLabel;
}
- @Override
- public Image getImage() {
- return JpaMappingImageHelper.imageForAttributeMapping(getDefaultKey());
- }
-
- public JpaComposite buildAttributeMappingComposite(
- JavaUiFactory factory,
- PropertyValueModel<JavaOneToOneMapping> subjectHolder,
- PropertyValueModel<Boolean> enabledModel,
- Composite parent,
- WidgetFactory widgetFactory) {
-
+ public JpaComposite buildAttributeMappingComposite(JavaUiFactory factory, PropertyValueModel<JavaOneToOneMapping> subjectHolder, PropertyValueModel<Boolean> enabledModel, Composite parent, WidgetFactory widgetFactory) {
return factory.createJavaOneToOneMappingComposite(subjectHolder, enabledModel, parent, widgetFactory);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/java/DefaultJavaEclipseLinkVariableOneToOneMappingUiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/java/DefaultJavaEclipseLinkVariableOneToOneMappingUiDefinition.java
index 573a937a64..832bb9d71e 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/java/DefaultJavaEclipseLinkVariableOneToOneMappingUiDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/java/DefaultJavaEclipseLinkVariableOneToOneMappingUiDefinition.java
@@ -16,13 +16,10 @@ import org.eclipse.jpt.jpa.eclipselink.core.EclipseLinkMappingKeys;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkVariableOneToOneMapping;
import org.eclipse.jpt.jpa.eclipselink.ui.internal.details.EclipseLinkUiDetailsMessages;
import org.eclipse.jpt.jpa.eclipselink.ui.internal.details.EclipseLinkVariableOneToOneMappingComposite;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
import org.eclipse.jpt.jpa.ui.details.JpaComposite;
import org.eclipse.jpt.jpa.ui.details.java.DefaultJavaAttributeMappingUiDefinition;
import org.eclipse.jpt.jpa.ui.details.java.JavaUiFactory;
-import org.eclipse.jpt.jpa.ui.internal.JptUiIcons;
import org.eclipse.jpt.jpa.ui.internal.details.AbstractMappingUiDefinition;
-import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
public class DefaultJavaEclipseLinkVariableOneToOneMappingUiDefinition
@@ -30,9 +27,8 @@ public class DefaultJavaEclipseLinkVariableOneToOneMappingUiDefinition
implements DefaultJavaAttributeMappingUiDefinition<EclipseLinkVariableOneToOneMapping>
{
// singleton
- private static final DefaultJavaEclipseLinkVariableOneToOneMappingUiDefinition INSTANCE =
- new DefaultJavaEclipseLinkVariableOneToOneMappingUiDefinition();
-
+ private static final DefaultJavaEclipseLinkVariableOneToOneMappingUiDefinition INSTANCE = new DefaultJavaEclipseLinkVariableOneToOneMappingUiDefinition();
+
/**
* Return the singleton.
*/
@@ -56,10 +52,6 @@ public class DefaultJavaEclipseLinkVariableOneToOneMappingUiDefinition
return EclipseLinkMappingKeys.VARIABLE_ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY;
}
- public Image getImage() {
- return JptJpaUiPlugin.getImage(JptUiIcons.JPA_CONTENT);
- }
-
public String getLabel() {
return EclipseLinkUiDetailsMessages.DefaultEclipseLinkVariableOneToOneMappingUiProvider_label;
}
@@ -68,12 +60,7 @@ public class DefaultJavaEclipseLinkVariableOneToOneMappingUiDefinition
return EclipseLinkUiDetailsMessages.DefaultEclipseLinkVariableOneToOneMappingUiProvider_linkLabel;
}
- public JpaComposite buildAttributeMappingComposite(
- JavaUiFactory factory,
- PropertyValueModel<EclipseLinkVariableOneToOneMapping> subjectHolder,
- PropertyValueModel<Boolean> enabledModel,
- Composite parent,
- WidgetFactory widgetFactory) {
+ public JpaComposite buildAttributeMappingComposite(JavaUiFactory factory, PropertyValueModel<EclipseLinkVariableOneToOneMapping> subjectHolder, PropertyValueModel<Boolean> enabledModel, Composite parent, WidgetFactory widgetFactory) {
return new EclipseLinkVariableOneToOneMappingComposite(subjectHolder, enabledModel, parent, widgetFactory);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/java/EclipseLink1_2JavaResourceUiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/java/EclipseLink1_2JavaResourceUiDefinition.java
index ef11d76788..fab2a72210 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/java/EclipseLink1_2JavaResourceUiDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/java/EclipseLink1_2JavaResourceUiDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2012 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.
@@ -35,7 +35,8 @@ import org.eclipse.jpt.jpa.ui.internal.details.java.JavaTransientMappingUiDefini
import org.eclipse.jpt.jpa.ui.internal.details.java.JavaVersionMappingUiDefinition;
import org.eclipse.jpt.jpa.ui.internal.details.java.NullJavaAttributeMappingUiDefinition;
-public class EclipseLink1_2JavaResourceUiDefinition extends AbstractJavaResourceUiDefinition
+public class EclipseLink1_2JavaResourceUiDefinition
+ extends AbstractJavaResourceUiDefinition
{
// singleton
private static final ResourceUiDefinition INSTANCE = new EclipseLink1_2JavaResourceUiDefinition();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkEntityMappings2_0DetailsProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkEntityMappings2_0DetailsProvider.java
index 24cc9f6e46..b872475860 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkEntityMappings2_0DetailsProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkEntityMappings2_0DetailsProvider.java
@@ -12,7 +12,9 @@ package org.eclipse.jpt.jpa.eclipselink.ui.internal.details.orm;
import org.eclipse.jpt.common.core.JptResourceType;
import org.eclipse.jpt.common.ui.WidgetFactory;
import org.eclipse.jpt.jpa.core.JpaStructureNode;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml2_0Definition;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml2_1Definition;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml2_2Definition;
import org.eclipse.jpt.jpa.ui.details.JpaDetailsPageManager;
import org.eclipse.jpt.jpa.ui.details.JpaDetailsProvider;
import org.eclipse.jpt.jpa.ui.internal.details.AbstractEntityMappingsDetailsProvider;
@@ -51,9 +53,9 @@ public class EclipseLinkEntityMappings2_0DetailsProvider
@Override
protected boolean providesDetails(JptResourceType resourceType) {
- return resourceType.equals(JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_2_0_RESOURCE_TYPE) ||
- resourceType.equals(JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_2_1_RESOURCE_TYPE) ||
- resourceType.equals(JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_2_2_RESOURCE_TYPE);
+ return resourceType.equals(EclipseLinkOrmXml2_0Definition.instance().getResourceType()) ||
+ resourceType.equals(EclipseLinkOrmXml2_1Definition.instance().getResourceType()) ||
+ resourceType.equals(EclipseLinkOrmXml2_2Definition.instance().getResourceType());
}
public JpaDetailsPageManager<? extends JpaStructureNode> buildDetailsPageManager(
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkEntityMappings2_3DetailsProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkEntityMappings2_3DetailsProvider.java
index fa2e449002..f69cda9e88 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkEntityMappings2_3DetailsProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkEntityMappings2_3DetailsProvider.java
@@ -12,7 +12,8 @@ package org.eclipse.jpt.jpa.eclipselink.ui.internal.details.orm;
import org.eclipse.jpt.common.core.JptResourceType;
import org.eclipse.jpt.common.ui.WidgetFactory;
import org.eclipse.jpt.jpa.core.JpaStructureNode;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml2_3Definition;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml2_4Definition;
import org.eclipse.jpt.jpa.ui.details.JpaDetailsPageManager;
import org.eclipse.jpt.jpa.ui.details.JpaDetailsProvider;
import org.eclipse.jpt.jpa.ui.internal.details.AbstractEntityMappingsDetailsProvider;
@@ -51,8 +52,8 @@ public class EclipseLinkEntityMappings2_3DetailsProvider
@Override
protected boolean providesDetails(JptResourceType resourceType) {
- return resourceType.equals(JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_2_3_RESOURCE_TYPE) ||
- resourceType.equals(JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_2_4_RESOURCE_TYPE);
+ return resourceType.equals(EclipseLinkOrmXml2_3Definition.instance().getResourceType()) ||
+ resourceType.equals(EclipseLinkOrmXml2_4Definition.instance().getResourceType());
}
public JpaDetailsPageManager<? extends JpaStructureNode> buildDetailsPageManager(
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkEntityMappingsDetailsProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkEntityMappingsDetailsProvider.java
index 92305d4a4a..6ddf201262 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkEntityMappingsDetailsProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkEntityMappingsDetailsProvider.java
@@ -12,7 +12,9 @@ package org.eclipse.jpt.jpa.eclipselink.ui.internal.details.orm;
import org.eclipse.jpt.common.core.JptResourceType;
import org.eclipse.jpt.common.ui.WidgetFactory;
import org.eclipse.jpt.jpa.core.JpaStructureNode;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml1_1Definition;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml1_2Definition;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXmlDefinition;
import org.eclipse.jpt.jpa.ui.details.JpaDetailsPageManager;
import org.eclipse.jpt.jpa.ui.details.JpaDetailsProvider;
import org.eclipse.jpt.jpa.ui.internal.details.AbstractEntityMappingsDetailsProvider;
@@ -51,9 +53,9 @@ public class EclipseLinkEntityMappingsDetailsProvider
@Override
protected boolean providesDetails(JptResourceType resourceType) {
- return resourceType.equals(JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_1_0_RESOURCE_TYPE)
- || resourceType.equals(JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_1_1_RESOURCE_TYPE)
- || resourceType.equals(JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_1_2_RESOURCE_TYPE);
+ return resourceType.equals(EclipseLinkOrmXmlDefinition.instance().getResourceType())
+ || resourceType.equals(EclipseLinkOrmXml1_1Definition.instance().getResourceType())
+ || resourceType.equals(EclipseLinkOrmXml1_2Definition.instance().getResourceType());
}
public JpaDetailsPageManager<? extends JpaStructureNode> buildDetailsPageManager(
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkEntityMappingsTenantDiscriminatorColumnsComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkEntityMappingsTenantDiscriminatorColumnsComposite.java
index 7778aff0ad..bd80b1a599 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkEntityMappingsTenantDiscriminatorColumnsComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkEntityMappingsTenantDiscriminatorColumnsComposite.java
@@ -14,7 +14,7 @@ import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.common.utility.internal.iterables.SuperListIterableWrapper;
import org.eclipse.jpt.common.utility.internal.model.value.ListAspectAdapter;
import org.eclipse.jpt.common.utility.internal.model.value.ListPropertyValueModelAdapter;
-import org.eclipse.jpt.common.utility.internal.model.value.ReadOnlyWritablePropertyValueModelWrapper;
+import org.eclipse.jpt.common.utility.internal.model.value.ReadOnlyModifiablePropertyValueModelWrapper;
import org.eclipse.jpt.common.utility.internal.model.value.TransformationPropertyValueModel;
import org.eclipse.jpt.common.utility.internal.model.value.ValueListAdapter;
import org.eclipse.jpt.common.utility.model.event.StateChangeEvent;
@@ -185,7 +185,7 @@ public class EclipseLinkEntityMappingsTenantDiscriminatorColumnsComposite extend
TenantDiscriminatorColumnPaneEnablerHolder() {
super(
new ValueListAdapter<EntityMappings>(
- new ReadOnlyWritablePropertyValueModelWrapper<EntityMappings>(getSubjectHolder()),
+ new ReadOnlyModifiablePropertyValueModelWrapper<EntityMappings>(getSubjectHolder()),
EclipseLinkEntityMappings.SPECIFIED_TENANT_DISCRIMINATOR_COLUMNS_LIST
)
);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkOrmXml1_1UiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkOrmXml1_1UiDefinition.java
index 3c1553efac..e08fe99dc6 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkOrmXml1_1UiDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkOrmXml1_1UiDefinition.java
@@ -14,7 +14,7 @@ import org.eclipse.jpt.common.core.JptResourceType;
import org.eclipse.jpt.common.ui.jface.ItemTreeStateProviderFactoryProvider;
import org.eclipse.jpt.jpa.core.context.AttributeMapping;
import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml1_1Definition;
import org.eclipse.jpt.jpa.ui.ResourceUiDefinition;
import org.eclipse.jpt.jpa.ui.details.orm.OrmAttributeMappingUiDefinition;
import org.eclipse.jpt.jpa.ui.details.orm.OrmTypeMappingUiDefinition;
@@ -64,7 +64,7 @@ public class EclipseLinkOrmXml1_1UiDefinition
}
public boolean providesUi(JptResourceType resourceType) {
- return resourceType.equals(JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_1_1_RESOURCE_TYPE);
+ return resourceType.equals(EclipseLinkOrmXml1_1Definition.instance().getResourceType());
}
public ItemTreeStateProviderFactoryProvider getStructureViewFactoryProvider() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkOrmXml1_2UiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkOrmXml1_2UiDefinition.java
index 46d56c8b9e..348eee902a 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkOrmXml1_2UiDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkOrmXml1_2UiDefinition.java
@@ -14,7 +14,7 @@ import org.eclipse.jpt.common.core.JptResourceType;
import org.eclipse.jpt.common.ui.jface.ItemTreeStateProviderFactoryProvider;
import org.eclipse.jpt.jpa.core.context.AttributeMapping;
import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml1_2Definition;
import org.eclipse.jpt.jpa.ui.ResourceUiDefinition;
import org.eclipse.jpt.jpa.ui.details.orm.OrmAttributeMappingUiDefinition;
import org.eclipse.jpt.jpa.ui.details.orm.OrmTypeMappingUiDefinition;
@@ -64,7 +64,7 @@ public class EclipseLinkOrmXml1_2UiDefinition
}
public boolean providesUi(JptResourceType resourceType) {
- return resourceType.equals(JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_1_2_RESOURCE_TYPE);
+ return resourceType.equals(EclipseLinkOrmXml1_2Definition.instance().getResourceType());
}
public ItemTreeStateProviderFactoryProvider getStructureViewFactoryProvider() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkOrmXml2_0UiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkOrmXml2_0UiDefinition.java
index b82cbf9f36..d1d0000027 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkOrmXml2_0UiDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkOrmXml2_0UiDefinition.java
@@ -14,7 +14,7 @@ import org.eclipse.jpt.common.core.JptResourceType;
import org.eclipse.jpt.common.ui.jface.ItemTreeStateProviderFactoryProvider;
import org.eclipse.jpt.jpa.core.context.AttributeMapping;
import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml2_0Definition;
import org.eclipse.jpt.jpa.ui.ResourceUiDefinition;
import org.eclipse.jpt.jpa.ui.details.orm.OrmAttributeMappingUiDefinition;
import org.eclipse.jpt.jpa.ui.details.orm.OrmTypeMappingUiDefinition;
@@ -65,7 +65,7 @@ public class EclipseLinkOrmXml2_0UiDefinition
}
public boolean providesUi(JptResourceType resourceType) {
- return resourceType.equals(JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_2_0_RESOURCE_TYPE);
+ return resourceType.equals(EclipseLinkOrmXml2_0Definition.instance().getResourceType());
}
public ItemTreeStateProviderFactoryProvider getStructureViewFactoryProvider() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkOrmXml2_1UiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkOrmXml2_1UiDefinition.java
index c6ac7d7062..6220a67202 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkOrmXml2_1UiDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkOrmXml2_1UiDefinition.java
@@ -14,7 +14,7 @@ import org.eclipse.jpt.common.core.JptResourceType;
import org.eclipse.jpt.common.ui.jface.ItemTreeStateProviderFactoryProvider;
import org.eclipse.jpt.jpa.core.context.AttributeMapping;
import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml2_1Definition;
import org.eclipse.jpt.jpa.ui.ResourceUiDefinition;
import org.eclipse.jpt.jpa.ui.details.orm.OrmAttributeMappingUiDefinition;
import org.eclipse.jpt.jpa.ui.details.orm.OrmTypeMappingUiDefinition;
@@ -65,7 +65,7 @@ public class EclipseLinkOrmXml2_1UiDefinition
}
public boolean providesUi(JptResourceType resourceType) {
- return resourceType.equals(JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_2_1_RESOURCE_TYPE);
+ return resourceType.equals(EclipseLinkOrmXml2_1Definition.instance().getResourceType());
}
public ItemTreeStateProviderFactoryProvider getStructureViewFactoryProvider() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkOrmXml2_2UiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkOrmXml2_2UiDefinition.java
index 56eb710775..39a651f2e3 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkOrmXml2_2UiDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkOrmXml2_2UiDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 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.
@@ -10,10 +10,11 @@
package org.eclipse.jpt.jpa.eclipselink.ui.internal.details.orm;
import org.eclipse.jpt.common.core.JptResourceType;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml2_2Definition;
import org.eclipse.jpt.jpa.ui.ResourceUiDefinition;
-public class EclipseLinkOrmXml2_2UiDefinition extends EclipseLinkOrmXml2_1UiDefinition
+public class EclipseLinkOrmXml2_2UiDefinition
+ extends EclipseLinkOrmXml2_1UiDefinition
{
// singleton
private static final ResourceUiDefinition INSTANCE = new EclipseLinkOrmXml2_2UiDefinition();
@@ -37,6 +38,6 @@ public class EclipseLinkOrmXml2_2UiDefinition extends EclipseLinkOrmXml2_1UiDefi
@Override
public boolean providesUi(JptResourceType resourceType) {
- return resourceType.equals(JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_2_2_RESOURCE_TYPE);
+ return resourceType.equals(EclipseLinkOrmXml2_2Definition.instance().getResourceType());
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkOrmXml2_3UiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkOrmXml2_3UiDefinition.java
index 3d59de59ef..63bdf294b1 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkOrmXml2_3UiDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkOrmXml2_3UiDefinition.java
@@ -12,7 +12,7 @@ package org.eclipse.jpt.jpa.eclipselink.ui.internal.details.orm;
import java.util.List;
import org.eclipse.jpt.common.core.JptResourceType;
import org.eclipse.jpt.jpa.core.context.AttributeMapping;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml2_3Definition;
import org.eclipse.jpt.jpa.ui.ResourceUiDefinition;
import org.eclipse.jpt.jpa.ui.details.orm.OrmAttributeMappingUiDefinition;
import org.eclipse.jpt.jpa.ui.details.orm.OrmXmlUiFactory;
@@ -30,8 +30,8 @@ import org.eclipse.jpt.jpa.ui.internal.jpa2.details.orm.OrmElementCollectionMapp
public class EclipseLinkOrmXml2_3UiDefinition
- extends EclipseLinkOrmXml2_1UiDefinition {
-
+ extends EclipseLinkOrmXml2_1UiDefinition
+{
// singleton
private static final ResourceUiDefinition INSTANCE = new EclipseLinkOrmXml2_3UiDefinition();
@@ -58,7 +58,7 @@ public class EclipseLinkOrmXml2_3UiDefinition
@Override
public boolean providesUi(JptResourceType resourceType) {
- return resourceType.equals(JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_2_3_RESOURCE_TYPE);
+ return resourceType.equals(EclipseLinkOrmXml2_3Definition.instance().getResourceType());
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkOrmXml2_4UiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkOrmXml2_4UiDefinition.java
index ffcf0a78d0..336386ba9c 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkOrmXml2_4UiDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkOrmXml2_4UiDefinition.java
@@ -1,18 +1,18 @@
/*******************************************************************************
- * Copyright (c) 2011 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
- *******************************************************************************/
+ * Copyright (c) 2011, 2012 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.jpa.eclipselink.ui.internal.details.orm;
import java.util.List;
import org.eclipse.jpt.common.core.JptResourceType;
import org.eclipse.jpt.jpa.core.context.AttributeMapping;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml2_4Definition;
import org.eclipse.jpt.jpa.ui.ResourceUiDefinition;
import org.eclipse.jpt.jpa.ui.details.orm.OrmAttributeMappingUiDefinition;
import org.eclipse.jpt.jpa.ui.details.orm.OrmXmlUiFactory;
@@ -30,8 +30,8 @@ import org.eclipse.jpt.jpa.ui.internal.jpa2.details.orm.OrmElementCollectionMapp
public class EclipseLinkOrmXml2_4UiDefinition
- extends EclipseLinkOrmXml2_1UiDefinition {
-
+ extends EclipseLinkOrmXml2_1UiDefinition
+{
// singleton
private static final ResourceUiDefinition INSTANCE = new EclipseLinkOrmXml2_4UiDefinition();
@@ -58,7 +58,7 @@ public class EclipseLinkOrmXml2_4UiDefinition
@Override
public boolean providesUi(JptResourceType resourceType) {
- return resourceType.equals(JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_2_4_RESOURCE_TYPE);
+ return resourceType.equals(EclipseLinkOrmXml2_4Definition.instance().getResourceType());
}
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkOrmXmlUiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkOrmXmlUiDefinition.java
index 47da418dcb..8612f21bd7 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkOrmXmlUiDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkOrmXmlUiDefinition.java
@@ -14,7 +14,7 @@ import org.eclipse.jpt.common.core.JptResourceType;
import org.eclipse.jpt.common.ui.jface.ItemTreeStateProviderFactoryProvider;
import org.eclipse.jpt.jpa.core.context.AttributeMapping;
import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXmlDefinition;
import org.eclipse.jpt.jpa.ui.ResourceUiDefinition;
import org.eclipse.jpt.jpa.ui.details.orm.OrmAttributeMappingUiDefinition;
import org.eclipse.jpt.jpa.ui.details.orm.OrmTypeMappingUiDefinition;
@@ -64,7 +64,7 @@ public class EclipseLinkOrmXmlUiDefinition
}
public boolean providesUi(JptResourceType resourceType) {
- return resourceType.equals(JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_1_0_RESOURCE_TYPE);
+ return resourceType.equals(EclipseLinkOrmXmlDefinition.instance().getResourceType());
}
public ItemTreeStateProviderFactoryProvider getStructureViewFactoryProvider() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/dialogs/AddVirtualAttributeDialog.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/dialogs/AddVirtualAttributeDialog.java
index 1c70aa055d..c0738c31cc 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/dialogs/AddVirtualAttributeDialog.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/dialogs/AddVirtualAttributeDialog.java
@@ -42,8 +42,8 @@ import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition;
import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
import org.eclipse.jpt.jpa.core.context.orm.OrmXmlDefinition;
import org.eclipse.jpt.jpa.eclipselink.core.context.orm.EclipseLinkOrmPersistentType;
-import org.eclipse.jpt.jpa.eclipselink.ui.JptJpaEclipseLinkUiPlugin;
import org.eclipse.jpt.jpa.eclipselink.ui.internal.EclipseLinkUiMessages;
+import org.eclipse.jpt.jpa.eclipselink.ui.internal.plugin.JptJpaEclipseLinkUiPlugin;
import org.eclipse.jpt.jpa.ui.JpaPlatformUi;
import org.eclipse.jpt.jpa.ui.details.MappingUiDefinition;
import org.eclipse.jpt.jpa.ui.internal.JptUiMessages;
@@ -203,7 +203,7 @@ public class AddVirtualAttributeDialog extends StatusDialog {
public Object[] getElements(Object inputElement) {
return ArrayTools.array(
CollectionTools.sort(
- ((JpaPlatformUi) inputElement).attributeMappingUiDefinitions(AddVirtualAttributeDialog.this.getJptResourceType()),
+ ((JpaPlatformUi) inputElement).getAttributeMappingUiDefinitions(AddVirtualAttributeDialog.this.getJptResourceType()),
getProvidersComparator()));
}
@@ -287,7 +287,7 @@ public class AddVirtualAttributeDialog extends StatusDialog {
try {
return this.getJpaProject().getJavaProject().getPackageFragmentRoots()[0];
} catch (JavaModelException ex) {
- JptJpaEclipseLinkUiPlugin.log(ex);
+ JptJpaEclipseLinkUiPlugin.instance().logError(ex);
return null;
}
}
@@ -339,7 +339,7 @@ public class AddVirtualAttributeDialog extends StatusDialog {
false, type);
}
catch (JavaModelException e) {
- JptJpaEclipseLinkUiPlugin.log(e);
+ JptJpaEclipseLinkUiPlugin.instance().logError(e);
throw new RuntimeException(e);
}
typeSelectionDialog.setTitle(JptUiMessages.AddPersistentClassDialog_classDialog_title);
@@ -353,34 +353,22 @@ public class AddVirtualAttributeDialog extends StatusDialog {
private void validate() {
if (StringTools.stringIsEmpty(this.getAttributeName())) {
- updateStatus(
- new Status(
- IStatus.ERROR, JptJpaEclipseLinkUiPlugin.PLUGIN_ID,
- EclipseLinkUiMessages.AddVirtualAttributeDialog_noNameError));
+ updateStatus(JptJpaEclipseLinkUiPlugin.instance().buildErrorStatus(EclipseLinkUiMessages.AddVirtualAttributeDialog_noNameError));
return;
}
if (this.getMappingKey() == null) {
- updateStatus(
- new Status(
- IStatus.ERROR, JptJpaEclipseLinkUiPlugin.PLUGIN_ID,
- EclipseLinkUiMessages.AddVirtualAttributeDialog_noMappingKeyError));
+ updateStatus(JptJpaEclipseLinkUiPlugin.instance().buildErrorStatus(EclipseLinkUiMessages.AddVirtualAttributeDialog_noMappingKeyError));
return;
}
if (!this.getAttributeMappingDefinition(this.getMappingKey()).isSingleRelationshipMapping() &&
StringTools.stringIsEmpty(this.getAttributeType())) {
- updateStatus(
- new Status(
- IStatus.ERROR, JptJpaEclipseLinkUiPlugin.PLUGIN_ID,
- EclipseLinkUiMessages.AddVirtualAttributeDialog_noAttributeTypeError));
+ updateStatus(JptJpaEclipseLinkUiPlugin.instance().buildErrorStatus(EclipseLinkUiMessages.AddVirtualAttributeDialog_noAttributeTypeError));
return;
}
if ((this.getAttributeMappingDefinition(this.getMappingKey()).isSingleRelationshipMapping() ||
this.getAttributeMappingDefinition(this.getMappingKey()).isCollectionMapping()) &&
StringTools.stringIsEmpty(this.getTargetType())) {
- updateStatus(
- new Status(
- IStatus.ERROR, JptJpaEclipseLinkUiPlugin.PLUGIN_ID,
- EclipseLinkUiMessages.AddVirtualAttributeDialog_noTargetTypeError));
+ updateStatus(JptJpaEclipseLinkUiPlugin.instance().buildErrorStatus(EclipseLinkUiMessages.AddVirtualAttributeDialog_noTargetTypeError));
return;
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/entity/data/model/DynamicEntityDataModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/entity/data/model/DynamicEntityDataModelProvider.java
index 5a95ce7740..bd36d9bfa7 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/entity/data/model/DynamicEntityDataModelProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/entity/data/model/DynamicEntityDataModelProvider.java
@@ -13,7 +13,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.ListIterator;
import java.util.Set;
-
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
@@ -29,10 +28,10 @@ import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.Signature;
import org.eclipse.jpt.common.core.JptResourceType;
+import org.eclipse.jpt.common.core.internal.utility.ProjectTools;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.jpa.core.JpaFacet;
import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.JpaRootContextNode;
@@ -43,21 +42,17 @@ import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceUnit;
-import org.eclipse.jpt.jpa.eclipselink.ui.JptJpaEclipseLinkUiPlugin;
import org.eclipse.jpt.jpa.eclipselink.ui.internal.EclipseLinkUiMessages;
import org.eclipse.jpt.jpa.eclipselink.ui.internal.entity.data.operation.NewDynamicEntityClassOperation;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
+import org.eclipse.jpt.jpa.eclipselink.ui.internal.plugin.JptJpaEclipseLinkUiPlugin;
import org.eclipse.jpt.jpa.ui.internal.wizards.entity.data.model.IEntityDataModelProperties;
import org.eclipse.jst.j2ee.internal.common.J2EECommonMessages;
import org.eclipse.jst.j2ee.internal.common.operations.NewJavaClassDataModelProvider;
-import org.eclipse.osgi.util.NLS;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider;
import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin;
-import com.ibm.icu.text.MessageFormat;
-
public class DynamicEntityDataModelProvider extends NewJavaClassDataModelProvider implements IEntityDataModelProperties {
private static final String DOT = "."; //$NON-NLS-1$
@@ -154,7 +149,7 @@ public class DynamicEntityDataModelProvider extends NewJavaClassDataModelProvide
rootList.toArray(packRoots);
} catch (JavaModelException e) {
// fall through
- JptJpaEclipseLinkUiPlugin.log(e);
+ JptJpaEclipseLinkUiPlugin.instance().logError(e);
}
}
}
@@ -191,9 +186,7 @@ public class DynamicEntityDataModelProvider extends NewJavaClassDataModelProvide
*/
private IStatus validateJavaPackage(String packName) {
if (packName == null || packName.equals(EMPTY_STRING)) {
- return new Status(
- IStatus.WARNING, JptJpaEclipseLinkUiPlugin.PLUGIN_ID,
- EclipseLinkUiMessages.DynamicEntityClassWizardPage_defaultPackageWarning);
+ return JptJpaEclipseLinkUiPlugin.instance().buildStatus(IStatus.WARNING, EclipseLinkUiMessages.DynamicEntityClassWizardPage_defaultPackageWarning);
}
// Use standard java conventions to validate the package name
IStatus javaStatus = JavaConventions.validatePackageName(packName, JavaCore.VERSION_1_5, JavaCore.VERSION_1_5);
@@ -223,14 +216,10 @@ public class DynamicEntityDataModelProvider extends NewJavaClassDataModelProvide
if (project != null) {
JpaXmlResource ormXmlResource = StringTools.stringIsEmpty(xmlName) ? null : getOrmXmlResource(xmlName);
if (ormXmlResource == null) {
- return new Status(
- IStatus.ERROR, JptJpaEclipseLinkUiPlugin.PLUGIN_ID,
- EclipseLinkUiMessages.DynamicEntityClassWizardPage_invalidXMLName);
+ return JptJpaEclipseLinkUiPlugin.instance().buildErrorStatus(EclipseLinkUiMessages.DynamicEntityClassWizardPage_invalidXMLName);
}
else if (this.getJpaProject().getJpaFile(ormXmlResource.getFile()).getRootStructureNodesSize() == 0) {
- return new Status(
- IStatus.ERROR, JptJpaEclipseLinkUiPlugin.PLUGIN_ID,
- EclipseLinkUiMessages.DynamicEntityClassWizardPage_xmlNotListedError);
+ return JptJpaEclipseLinkUiPlugin.instance().buildErrorStatus(EclipseLinkUiMessages.DynamicEntityClassWizardPage_xmlNotListedError);
}
}
return Status.OK_STATUS;
@@ -257,35 +246,33 @@ public class DynamicEntityDataModelProvider extends NewJavaClassDataModelProvide
// Ensure there are no dynamic entity fields that have the same name in the table
boolean hasDuplicates = hasDuplicatesInEntityFields(fields);
if (hasDuplicates) {
- return new Status(
- IStatus.ERROR, JptJpaEclipseLinkUiPlugin.PLUGIN_ID,
- EclipseLinkUiMessages.DynamicEntityFieldsWizardPage_duplicateEntityFieldsError);
+ return JptJpaEclipseLinkUiPlugin.instance().buildErrorStatus(EclipseLinkUiMessages.DynamicEntityFieldsWizardPage_duplicateEntityFieldsError);
}
// Ensure ID and EmbeddedID mapping are not defined at the same time
// and also ensure there's no multiple EmbeddedID mappings defined
String errorMsg1 = checkInputFieldsMappingTypes(fields);
if (errorMsg1 != null) {
- return new Status(IStatus.ERROR, JptJpaEclipseLinkUiPlugin.PLUGIN_ID, errorMsg1);
+ return JptJpaEclipseLinkUiPlugin.instance().buildErrorStatus(errorMsg1);
}
// Ensure that the given attribute type of the dynamic entity fields in the table are valid
String errorMsg2 = checkInputFieldsAttributeTypeValidity(fields);
if (errorMsg2 != null) {
- return new Status(IStatus.ERROR, JptJpaEclipseLinkUiPlugin.PLUGIN_ID, errorMsg2);
+ return JptJpaEclipseLinkUiPlugin.instance().buildErrorStatus(errorMsg2);
}
// Ensure that the given target type of the dynamic entity fields in the table are valid
- String errorMsg3 = checkInputFieldsTargetTypeValidity(fields);
+ String errorMsg3 = checkInputFieldsAttributeTypeExistence(fields);
if (errorMsg3 != null) {
- return new Status(IStatus.ERROR, JptJpaEclipseLinkUiPlugin.PLUGIN_ID, errorMsg3);
+ return JptJpaEclipseLinkUiPlugin.instance().buildErrorStatus(errorMsg3);
}
// Ensure that the given attribute type of the dynamic entity fields in the table exist
String warningMsg1 = checkInputFieldsAttributeTypeExistence(fields);
if (warningMsg1 != null) {
- return new Status(IStatus.WARNING, JptJpaEclipseLinkUiPlugin.PLUGIN_ID, warningMsg1);
+ return JptJpaEclipseLinkUiPlugin.instance().buildWarningStatus(warningMsg1);
}
// Ensure that the given target type of the dynamic entity fields in the table exist
String warningMsg2 = checkInputFieldsTargetTypeExistence(fields);
if (warningMsg2 != null) {
- return new Status(IStatus.WARNING, JptJpaEclipseLinkUiPlugin.PLUGIN_ID, warningMsg2);
+ return JptJpaEclipseLinkUiPlugin.instance().buildWarningStatus(warningMsg2);
}
}
return Status.OK_STATUS;
@@ -295,11 +282,9 @@ public class DynamicEntityDataModelProvider extends NewJavaClassDataModelProvide
IStatus validateFieldMappingTypeStatus = Status.OK_STATUS;
Iterable<String> mappingKeys = this.getMappingKeys(fields);
if (hasIDAndEmbeddedIDMappingDefined(mappingKeys)) {
- validateFieldMappingTypeStatus = new Status(IStatus.ERROR, JptJpaUiPlugin.PLUGIN_ID,
- EclipseLinkUiMessages.EclipseLinkDynamicEntityWizard_bothIDAndEmbeddedIDDefinedError);
+ validateFieldMappingTypeStatus = JptJpaEclipseLinkUiPlugin.instance().buildErrorStatus(EclipseLinkUiMessages.EclipseLinkDynamicEntityWizard_bothIDAndEmbeddedIDDefinedError);
} else if (hasMultipleEmbeddedIDMappings(mappingKeys)) {
- validateFieldMappingTypeStatus = new Status(IStatus.ERROR, JptJpaUiPlugin.PLUGIN_ID,
- EclipseLinkUiMessages.EclipseLinkDynamicEntityWizard_multipleEmbeddedIDsDefinedError);
+ validateFieldMappingTypeStatus = JptJpaEclipseLinkUiPlugin.instance().buildErrorStatus(EclipseLinkUiMessages.EclipseLinkDynamicEntityWizard_multipleEmbeddedIDsDefinedError);
}
if (!validateFieldMappingTypeStatus.isOK()) {
return validateFieldMappingTypeStatus.getMessage();
@@ -340,17 +325,14 @@ public class DynamicEntityDataModelProvider extends NewJavaClassDataModelProvide
continue;
}
if (field.isKey() && !field.couldTypeBePKType()) {
- String message = MessageFormat.format(
- EclipseLinkUiMessages.EclipseLinkDynamicEntityWizard_invalidPKType, new Object[]{field.getFqnAttributeType()});
- validateFieldTypeStatus = new Status(IStatus.ERROR, JptJpaEclipseLinkUiPlugin.PLUGIN_ID, message);
+ validateFieldTypeStatus = JptJpaEclipseLinkUiPlugin.instance().buildErrorStatus(EclipseLinkUiMessages.EclipseLinkDynamicEntityWizard_invalidPKType, field.getFqnAttributeType());
break;
}
String sig = null;
try {
sig = Signature.createTypeSignature(field.getFqnAttributeType(), true);
} catch (IllegalArgumentException e) {
- String message = MessageFormat.format(EclipseLinkUiMessages.EclipseLinkDynamicEntityWizard_invalidArgument, new Object[]{e.getLocalizedMessage()});
- validateFieldTypeStatus = new Status(IStatus.ERROR, JptJpaEclipseLinkUiPlugin.PLUGIN_ID, message);
+ validateFieldTypeStatus = JptJpaEclipseLinkUiPlugin.instance().buildErrorStatus(EclipseLinkUiMessages.EclipseLinkDynamicEntityWizard_invalidArgument, e.getLocalizedMessage());
break;
}
if (sig == null) {
@@ -383,9 +365,7 @@ public class DynamicEntityDataModelProvider extends NewJavaClassDataModelProvide
}
String sig = Signature.createTypeSignature(field.getFqnAttributeType(), true);
if (sig == null) {
- String message = MessageFormat.format(
- EclipseLinkUiMessages.EclipseLinkDynamicEntityWizard_typeNotInProjectClasspath, new Object[]{field.getFqnAttributeType()});
- validateFieldTypeStatus = new Status(IStatus.ERROR, JptJpaEclipseLinkUiPlugin.PLUGIN_ID, message);
+ validateFieldTypeStatus = JptJpaEclipseLinkUiPlugin.instance().buildErrorStatus(EclipseLinkUiMessages.EclipseLinkDynamicEntityWizard_typeNotInProjectClasspath, field.getFqnAttributeType());
break;
}
int sigType = Signature.getTypeSignatureKind(sig);
@@ -407,9 +387,7 @@ public class DynamicEntityDataModelProvider extends NewJavaClassDataModelProvide
break;
}
if (type == null) {
- String message = MessageFormat.format(
- EclipseLinkUiMessages.EclipseLinkDynamicEntityWizard_typeNotInProjectClasspath, new Object[]{field.getFqnAttributeType()});
- validateFieldTypeStatus = new Status(IStatus.ERROR, JptJpaEclipseLinkUiPlugin.PLUGIN_ID, message);
+ validateFieldTypeStatus = JptJpaEclipseLinkUiPlugin.instance().buildErrorStatus(EclipseLinkUiMessages.EclipseLinkDynamicEntityWizard_typeNotInProjectClasspath, field.getFqnAttributeType());
break;
}
} else {
@@ -423,9 +401,7 @@ public class DynamicEntityDataModelProvider extends NewJavaClassDataModelProvide
break;
}
if (type == null) {
- String message = MessageFormat.format(
- EclipseLinkUiMessages.EclipseLinkDynamicEntityWizard_typeNotInProjectClasspath, new Object[]{field.getFqnAttributeType()});
- validateFieldTypeStatus = new Status(IStatus.ERROR, JptJpaEclipseLinkUiPlugin.PLUGIN_ID, message);
+ validateFieldTypeStatus = JptJpaEclipseLinkUiPlugin.instance().buildErrorStatus(EclipseLinkUiMessages.EclipseLinkDynamicEntityWizard_typeNotInProjectClasspath, field.getFqnAttributeType());
break;
}
}
@@ -435,7 +411,7 @@ public class DynamicEntityDataModelProvider extends NewJavaClassDataModelProvide
}
return null;
}
-
+
private String checkInputFieldsTargetTypeValidity(List<DynamicEntityField> fields) {
IStatus validateFieldTypeStatus = Status.OK_STATUS;
for (DynamicEntityField field: fields) {
@@ -448,8 +424,7 @@ public class DynamicEntityDataModelProvider extends NewJavaClassDataModelProvide
try {
sig = Signature.createTypeSignature(field.getFqnTargetType(), true);
} catch (IllegalArgumentException e) {
- String message = MessageFormat.format(EclipseLinkUiMessages.EclipseLinkDynamicEntityWizard_invalidArgument, new Object[]{e.getLocalizedMessage()});
- validateFieldTypeStatus = new Status(IStatus.ERROR, JptJpaEclipseLinkUiPlugin.PLUGIN_ID, message);
+ validateFieldTypeStatus = JptJpaEclipseLinkUiPlugin.instance().buildErrorStatus(EclipseLinkUiMessages.EclipseLinkDynamicEntityWizard_invalidArgument, e.getLocalizedMessage());
break;
}
if (sig == null){
@@ -483,9 +458,7 @@ public class DynamicEntityDataModelProvider extends NewJavaClassDataModelProvide
}
String sig = Signature.createTypeSignature(field.getFqnTargetType(), true);
if (sig == null) {
- String message = MessageFormat.format(
- EclipseLinkUiMessages.EclipseLinkDynamicEntityWizard_typeNotInProjectClasspath, new Object[]{field.getFqnTargetType()});
- validateFieldTypeStatus = new Status(IStatus.ERROR, JptJpaEclipseLinkUiPlugin.PLUGIN_ID, message);
+ validateFieldTypeStatus = JptJpaEclipseLinkUiPlugin.instance().buildErrorStatus(EclipseLinkUiMessages.EclipseLinkDynamicEntityWizard_typeNotInProjectClasspath, field.getFqnTargetType());
break;
}
int sigType = Signature.getTypeSignatureKind(sig);
@@ -507,9 +480,7 @@ public class DynamicEntityDataModelProvider extends NewJavaClassDataModelProvide
break;
}
if (type == null) {
- String message = MessageFormat.format(
- EclipseLinkUiMessages.EclipseLinkDynamicEntityWizard_typeNotInProjectClasspath, new Object[]{field.getFqnTargetType()});
- validateFieldTypeStatus = new Status(IStatus.ERROR, JptJpaEclipseLinkUiPlugin.PLUGIN_ID, message);
+ validateFieldTypeStatus = JptJpaEclipseLinkUiPlugin.instance().buildErrorStatus(EclipseLinkUiMessages.EclipseLinkDynamicEntityWizard_typeNotInProjectClasspath, field.getFqnTargetType());
break;
}
} else {
@@ -523,9 +494,7 @@ public class DynamicEntityDataModelProvider extends NewJavaClassDataModelProvide
break;
}
if (type == null) {
- String message = MessageFormat.format(
- EclipseLinkUiMessages.EclipseLinkDynamicEntityWizard_typeNotInProjectClasspath, new Object[]{field.getFqnTargetType()});
- validateFieldTypeStatus = new Status(IStatus.ERROR, JptJpaEclipseLinkUiPlugin.PLUGIN_ID, message);
+ validateFieldTypeStatus = JptJpaEclipseLinkUiPlugin.instance().buildErrorStatus(EclipseLinkUiMessages.EclipseLinkDynamicEntityWizard_typeNotInProjectClasspath, field.getFqnTargetType());
break;
}
}
@@ -572,12 +541,9 @@ public class DynamicEntityDataModelProvider extends NewJavaClassDataModelProvide
* @return boolean true if duplicate fields exist; otherwise, false
*/
private IStatus validatePrimaryKeyFieldsList(ArrayList<DynamicEntityField> pkFields) {
- if (pkFields.size() > 1) {
- return new Status(
- IStatus.INFO, JptJpaEclipseLinkUiPlugin.PLUGIN_ID,
- EclipseLinkUiMessages.EclipseLinkDynamicEntityWizard_applyEmbeddedIdMappingInfo);
- }
- return null;
+ return (pkFields.size() > 1) ?
+ JptJpaEclipseLinkUiPlugin.instance().buildStatus(IStatus.INFO, EclipseLinkUiMessages.EclipseLinkDynamicEntityWizard_applyEmbeddedIdMappingInfo) :
+ null;
}
/**
@@ -606,37 +572,24 @@ public class DynamicEntityDataModelProvider extends NewJavaClassDataModelProvide
//there is no need for a separate validation of it.
for (String name : this.getJavaTypeNames()) {
if (StringTools.stringsAreEqual(name, fullyQualifiedName)) {
- String message = NLS.bind(
- EclipseLinkUiMessages.EclipseLinkDynamicEntityWizard_typeExistsWarning,
- new Object[] { fullyQualifiedName });
- return new Status(IStatus.WARNING, JptJpaEclipseLinkUiPlugin.PLUGIN_ID, message);
+ return JptJpaEclipseLinkUiPlugin.instance().buildStatus(IStatus.WARNING, EclipseLinkUiMessages.EclipseLinkDynamicEntityWizard_typeExistsWarning, fullyQualifiedName);
} else if (StringTools.stringsAreEqualIgnoreCase(name, fullyQualifiedName)) {
- String message = NLS.bind(
- EclipseLinkUiMessages.EclipseLinkDynamicEntityWizard_typeWithDiffCaseExistsWarning,
- new Object[] { fullyQualifiedName });
- return new Status(IStatus.WARNING, JptJpaEclipseLinkUiPlugin.PLUGIN_ID, message);
+ return JptJpaEclipseLinkUiPlugin.instance().buildStatus(IStatus.WARNING, EclipseLinkUiMessages.EclipseLinkDynamicEntityWizard_typeWithDiffCaseExistsWarning, fullyQualifiedName);
}
}
PersistenceUnit pu = this.getPersistenceUnit();
if (pu != null) {
for (String name : ((EclipseLinkPersistenceUnit)this.getPersistenceUnit()).getEclipseLinkDynamicPersistentTypeNames()) {
if (StringTools.stringsAreEqual(name, fullyQualifiedName)) {
- String message = NLS.bind(
- EclipseLinkUiMessages.EclipseLinkDynamicEntityWizard_dynamicTypeExistsError,
- new Object[] { fullyQualifiedName });
- return new Status(IStatus.ERROR, JptJpaEclipseLinkUiPlugin.PLUGIN_ID, message);
+ return JptJpaEclipseLinkUiPlugin.instance().buildErrorStatus(EclipseLinkUiMessages.EclipseLinkDynamicEntityWizard_dynamicTypeExistsError, fullyQualifiedName);
} else if (StringTools.stringsAreEqualIgnoreCase(name, fullyQualifiedName)) {
- String message = NLS.bind(
- EclipseLinkUiMessages.EclipseLinkDynamicEntityWizard_dynamicTypeWithDiffCaseExistsError,
- new Object[] { fullyQualifiedName });
- return new Status(IStatus.ERROR, JptJpaEclipseLinkUiPlugin.PLUGIN_ID, message);
+ return JptJpaEclipseLinkUiPlugin.instance().buildErrorStatus(EclipseLinkUiMessages.EclipseLinkDynamicEntityWizard_dynamicTypeWithDiffCaseExistsError, fullyQualifiedName);
}
}
} else {
- return new Status(IStatus.ERROR, JptJpaEclipseLinkUiPlugin.PLUGIN_ID,
- EclipseLinkUiMessages.EclipseLinkDynamicEntityWizard_persistenceUnitNotFoundError);
+ return JptJpaEclipseLinkUiPlugin.instance().buildErrorStatus(EclipseLinkUiMessages.EclipseLinkDynamicEntityWizard_persistenceUnitNotFoundError);
}
return Status.OK_STATUS;
}
@@ -672,7 +625,7 @@ public class DynamicEntityDataModelProvider extends NewJavaClassDataModelProvide
}
} catch (JavaModelException e) {
// fall through
- JptJpaEclipseLinkUiPlugin.log(e);
+ JptJpaEclipseLinkUiPlugin.instance().logError(e);
}
}
return typesList;
@@ -682,7 +635,7 @@ public class DynamicEntityDataModelProvider extends NewJavaClassDataModelProvide
protected JpaProject getJpaProject() {
IProject project = getTargetProject();
- return ((project != null) && JpaFacet.isInstalled(project)) ?
+ return ((project != null) && ProjectTools.hasFacet(project, JpaProject.FACET)) ?
this.getJpaProject(project) :
null;
}
@@ -702,7 +655,7 @@ public class DynamicEntityDataModelProvider extends NewJavaClassDataModelProvide
protected Persistence getPersistence() {
PersistenceXml pxml = this.getPersistenceXml();
- return (pxml == null) ? null : pxml.getPersistence();
+ return (pxml == null) ? null : pxml.getRoot();
}
protected PersistenceXml getPersistenceXml() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/entity/data/model/DynamicEntityTemplateModel.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/entity/data/model/DynamicEntityTemplateModel.java
index 8eeaeed5d0..4affc2ea51 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/entity/data/model/DynamicEntityTemplateModel.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/entity/data/model/DynamicEntityTemplateModel.java
@@ -18,7 +18,7 @@ import org.eclipse.core.resources.IProject;
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.ui.internal.wizards.entity.data.model.IEntityDataModelProperties;
import org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties;
import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
@@ -78,7 +78,7 @@ public class DynamicEntityTemplateModel {
if (getMappingXMLName().equals(IEntityDataModelProperties.EMPTY_STRING)) {
return true;
}
- return getMappingXMLName().equals(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ return getMappingXMLName().equals(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
}
public String getMappingXMLName() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/entity/data/operation/NewDynamicEntityClassOperation.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/entity/data/operation/NewDynamicEntityClassOperation.java
index f50b2ec976..6b14c3a95f 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/entity/data/operation/NewDynamicEntityClassOperation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/entity/data/operation/NewDynamicEntityClassOperation.java
@@ -24,9 +24,9 @@ import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkAccessType;
import org.eclipse.jpt.jpa.eclipselink.core.context.orm.EclipseLinkEntityMappings;
import org.eclipse.jpt.jpa.eclipselink.core.context.orm.EclipseLinkOrmPersistentType;
import org.eclipse.jpt.jpa.eclipselink.core.context.orm.EclipseLinkOrmTypeMapping;
-import org.eclipse.jpt.jpa.eclipselink.ui.JptJpaEclipseLinkUiPlugin;
import org.eclipse.jpt.jpa.eclipselink.ui.internal.entity.data.model.DynamicEntityField;
import org.eclipse.jpt.jpa.eclipselink.ui.internal.entity.data.model.DynamicEntityTemplateModel;
+import org.eclipse.jpt.jpa.eclipselink.ui.internal.plugin.JptJpaEclipseLinkUiPlugin;
import org.eclipse.jpt.jpa.ui.internal.wizards.entity.data.operation.NewEntityClassOperation;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin;
@@ -81,7 +81,7 @@ public class NewDynamicEntityClassOperation extends NewEntityClassOperation {
try {
xmlResource.saveIfNecessary();
} catch (Exception e) {
- JptJpaEclipseLinkUiPlugin.log(e);
+ JptJpaEclipseLinkUiPlugin.instance().logError(e);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/EclipseLinkPersistenceXmlUiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/EclipseLinkPersistenceXmlUiDefinition.java
index 300867d931..c56f51830e 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/EclipseLinkPersistenceXmlUiDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/EclipseLinkPersistenceXmlUiDefinition.java
@@ -12,7 +12,7 @@ package org.eclipse.jpt.jpa.eclipselink.ui.internal.persistence;
import org.eclipse.jpt.common.core.JptResourceType;
import org.eclipse.jpt.common.ui.internal.jface.SimpleItemTreeStateProviderFactoryProvider;
import org.eclipse.jpt.common.ui.jface.ItemTreeStateProviderFactoryProvider;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.GenericPersistenceXmlDefinition;
import org.eclipse.jpt.jpa.eclipselink.ui.internal.structure.EclipseLinkPersistenceStructureItemContentProviderFactory;
import org.eclipse.jpt.jpa.ui.ResourceUiDefinition;
import org.eclipse.jpt.jpa.ui.internal.persistence.AbstractPersistenceXmlResourceUiDefinition;
@@ -48,7 +48,7 @@ public class EclipseLinkPersistenceXmlUiDefinition
}
public boolean providesUi(JptResourceType resourceType) {
- return resourceType.equals(JptJpaCorePlugin.PERSISTENCE_XML_1_0_RESOURCE_TYPE);
+ return resourceType.equals(GenericPersistenceXmlDefinition.instance().getResourceType());
}
public ItemTreeStateProviderFactoryProvider getStructureViewFactoryProvider() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/caching/EntityListComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/caching/EntityListComposite.java
index 24cb4d4cdd..7c83a707b6 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/caching/EntityListComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/caching/EntityListComposite.java
@@ -1,12 +1,12 @@
/*******************************************************************************
-* Copyright (c) 2007, 2012 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
-*******************************************************************************/
+ * Copyright (c) 2007, 2012 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.jpa.eclipselink.ui.internal.persistence.caching;
import org.eclipse.jdt.core.IJavaElement;
@@ -33,9 +33,9 @@ import org.eclipse.jpt.common.utility.model.value.ModifiableCollectionValueModel
import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.Caching;
import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.CachingEntity;
-import org.eclipse.jpt.jpa.eclipselink.ui.JptJpaEclipseLinkUiPlugin;
import org.eclipse.jpt.jpa.eclipselink.ui.internal.EclipseLinkHelpContextIds;
import org.eclipse.jpt.jpa.eclipselink.ui.internal.EclipseLinkUiMessages;
+import org.eclipse.jpt.jpa.eclipselink.ui.internal.plugin.JptJpaEclipseLinkUiPlugin;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.SelectionDialog;
@@ -170,7 +170,7 @@ public class EntityListComposite<T extends Caching> extends Pane<T>
);
}
catch (JavaModelException e) {
- JptJpaEclipseLinkUiPlugin.log(e);
+ JptJpaEclipseLinkUiPlugin.instance().logError(e);
return null;
}
typeSelectionDialog.setTitle(EclipseLinkUiMessages.CachingEntityListComposite_dialogTitle);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/connection/JdbcConnectionPropertiesComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/connection/JdbcConnectionPropertiesComposite.java
index bcd4d2cdd9..1da50d3a0d 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/connection/JdbcConnectionPropertiesComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/connection/JdbcConnectionPropertiesComposite.java
@@ -1,15 +1,16 @@
/*******************************************************************************
-* Copyright (c) 2008, 2012 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
-*******************************************************************************/
+ * Copyright (c) 2008, 2012 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.jpa.eclipselink.ui.internal.persistence.connection;
import java.util.Comparator;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
@@ -32,10 +33,9 @@ import org.eclipse.jpt.common.utility.model.value.ModifiablePropertyValueModel;
import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
import org.eclipse.jpt.jpa.db.ConnectionProfile;
import org.eclipse.jpt.jpa.db.ConnectionProfileFactory;
-import org.eclipse.jpt.jpa.db.JptJpaDbPlugin;
import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.Connection;
-import org.eclipse.jpt.jpa.eclipselink.ui.JptJpaEclipseLinkUiPlugin;
import org.eclipse.jpt.jpa.eclipselink.ui.internal.EclipseLinkUiMessages;
+import org.eclipse.jpt.jpa.eclipselink.ui.internal.plugin.JptJpaEclipseLinkUiPlugin;
import org.eclipse.jpt.jpa.ui.internal.JpaHelpContextIds;
import org.eclipse.jpt.jpa.ui.internal.jpa2.persistence.JptUiPersistence2_0Messages;
import org.eclipse.osgi.util.NLS;
@@ -279,7 +279,7 @@ public class JdbcConnectionPropertiesComposite<T extends Connection>
// take the settings from it (user, password, etc.) and give them
// to the EclipseLink connection, so we go
// to the db plug-in directly to get the factory
- return JptJpaDbPlugin.getConnectionProfileFactory();
+ return (ConnectionProfileFactory) ResourcesPlugin.getWorkspace().getAdapter(ConnectionProfileFactory.class);
}
// broaden access a bit
@@ -318,25 +318,16 @@ public class JdbcConnectionPropertiesComposite<T extends Connection>
};
}
- /*
- * (non-Javadoc)
- */
@Override
protected Control createExtendedContentArea(Composite parent) {
return null;
}
- /*
- * (non-Javadoc)
- */
@Override
protected ItemsFilter createFilter() {
return new ConnectionItemsFilter();
}
- /*
- * (non-Javadoc)
- */
@Override
protected void fillContentProvider(AbstractContentProvider provider,
ItemsFilter itemsFilter,
@@ -356,9 +347,6 @@ public class JdbcConnectionPropertiesComposite<T extends Connection>
return JdbcConnectionPropertiesComposite.this.getConnectionProfileFactory().getConnectionProfileNames();
}
- /*
- * (non-Javadoc)
- */
@Override
protected IDialogSettings getDialogSettings() {
@@ -372,17 +360,11 @@ public class JdbcConnectionPropertiesComposite<T extends Connection>
return settings;
}
- /*
- * (non-Javadoc)
- */
@Override
public String getElementName(Object object) {
return object.toString();
}
- /*
- * (non-Javadoc)
- */
@Override
protected Comparator<String> getItemsComparator() {
return new Comparator<String>() {
@@ -392,17 +374,11 @@ public class JdbcConnectionPropertiesComposite<T extends Connection>
};
}
- /*
- * (non-Javadoc)
- */
@Override
protected IStatus validateItem(Object item) {
-
- if (item == null) {
- return new Status(IStatus.ERROR, JptJpaEclipseLinkUiPlugin.PLUGIN_ID, IStatus.ERROR, "", null);
- }
-
- return Status.OK_STATUS;
+ return (item == null) ?
+ JptJpaEclipseLinkUiPlugin.instance().buildErrorStatus() :
+ Status.OK_STATUS;
}
/**
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/customization/EntityListComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/customization/EntityListComposite.java
index 64a281e0f3..4171b0ac40 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/customization/EntityListComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/customization/EntityListComposite.java
@@ -1,12 +1,12 @@
/*******************************************************************************
-* Copyright (c) 2007, 2012 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
-*******************************************************************************/
+ * Copyright (c) 2007, 2012 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.jpa.eclipselink.ui.internal.persistence.customization;
import org.eclipse.jdt.core.IJavaElement;
@@ -38,9 +38,9 @@ import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkCustomizer;
import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.Customization;
import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.CustomizationEntity;
-import org.eclipse.jpt.jpa.eclipselink.ui.JptJpaEclipseLinkUiPlugin;
import org.eclipse.jpt.jpa.eclipselink.ui.internal.EclipseLinkHelpContextIds;
import org.eclipse.jpt.jpa.eclipselink.ui.internal.EclipseLinkUiMessages;
+import org.eclipse.jpt.jpa.eclipselink.ui.internal.plugin.JptJpaEclipseLinkUiPlugin;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.SelectionDialog;
@@ -170,7 +170,7 @@ public class EntityListComposite extends Pane<Customization>
);
}
catch (JavaModelException e) {
- JptJpaEclipseLinkUiPlugin.log(e);
+ JptJpaEclipseLinkUiPlugin.instance().logError(e);
return null;
}
typeSelectionDialog.setTitle(EclipseLinkUiMessages.CustomizationEntityListComposite_dialogTitle);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/customization/SessionCustomizersComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/customization/SessionCustomizersComposite.java
index 7e04146227..eb92947e5c 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/customization/SessionCustomizersComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/customization/SessionCustomizersComposite.java
@@ -32,8 +32,8 @@ import org.eclipse.jpt.common.utility.model.value.ListValueModel;
import org.eclipse.jpt.common.utility.model.value.ModifiableCollectionValueModel;
import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.Customization;
-import org.eclipse.jpt.jpa.eclipselink.ui.JptJpaEclipseLinkUiPlugin;
import org.eclipse.jpt.jpa.eclipselink.ui.internal.EclipseLinkUiMessages;
+import org.eclipse.jpt.jpa.eclipselink.ui.internal.plugin.JptJpaEclipseLinkUiPlugin;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.SelectionDialog;
@@ -147,7 +147,7 @@ public class SessionCustomizersComposite extends Pane<Customization>
);
}
catch (JavaModelException e) {
- JptJpaEclipseLinkUiPlugin.log(e);
+ JptJpaEclipseLinkUiPlugin.instance().logError(e);
return null;
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/general/EclipseLinkPersistenceUnitJarFilesComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/general/EclipseLinkPersistenceUnitJarFilesComposite.java
index 52913277ca..89b9b89088 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/general/EclipseLinkPersistenceUnitJarFilesComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/general/EclipseLinkPersistenceUnitJarFilesComposite.java
@@ -1,18 +1,17 @@
/*******************************************************************************
- * Copyright (c) 2009, 2012 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
- *******************************************************************************/
+ * Copyright (c) 2009, 2012 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.jpa.eclipselink.ui.internal.persistence.general;
import org.eclipse.core.resources.IFile;
+import org.eclipse.jpt.common.core.internal.utility.ProjectTools;
import org.eclipse.jpt.common.ui.internal.widgets.Pane;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.jpa.ui.internal.persistence.ArchiveFileSelectionDialog;
import org.eclipse.jpt.jpa.ui.internal.persistence.PersistenceUnitJarFilesComposite;
@@ -36,16 +35,16 @@ public class EclipseLinkPersistenceUnitJarFilesComposite
}
- private static class EclipseLinkDeploymentPathCalculator
+ static class EclipseLinkDeploymentPathCalculator
extends ArchiveFileSelectionDialog.ModuleDeploymentPathCalculator
{
@Override
public String calculateDeploymentPath(IFile file) {
- String baseDeploymentPath = super.calculateDeploymentPath(file);
- if (JptJpaCorePlugin.projectHasWebFacet(file.getProject())) {
- return "../" + baseDeploymentPath;
+ String path = super.calculateDeploymentPath(file);
+ if (ProjectTools.hasWebFacet(file.getProject())) {
+ path = "../" + path; //$NON-NLS-1$
}
- return baseDeploymentPath;
+ return path;
}
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/plugin/JptJpaEclipseLinkUiPlugin.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/plugin/JptJpaEclipseLinkUiPlugin.java
new file mode 100644
index 0000000000..24dffae532
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/plugin/JptJpaEclipseLinkUiPlugin.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2012 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.jpa.eclipselink.ui.internal.plugin;
+
+import org.eclipse.jpt.common.core.internal.utility.JptPlugin;
+import org.eclipse.jpt.common.ui.internal.JptUIPlugin;
+
+/**
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public class JptJpaEclipseLinkUiPlugin
+ extends JptUIPlugin
+{
+ // ********** singleton **********
+
+ private static volatile JptJpaEclipseLinkUiPlugin INSTANCE;
+
+ public static JptJpaEclipseLinkUiPlugin instance() {
+ return INSTANCE;
+ }
+
+
+ // ********** Dali plug-in **********
+
+ public JptJpaEclipseLinkUiPlugin() {
+ super();
+ }
+
+ @Override
+ protected void setInstance(JptPlugin plugin) {
+ INSTANCE = (JptJpaEclipseLinkUiPlugin) plugin;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/persistence/EclipseLinkPersistenceXml2_0UiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/persistence/EclipseLinkPersistenceXml2_0UiDefinition.java
index 92bb31464a..fa38e9e159 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/persistence/EclipseLinkPersistenceXml2_0UiDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/persistence/EclipseLinkPersistenceXml2_0UiDefinition.java
@@ -11,7 +11,7 @@ package org.eclipse.jpt.jpa.eclipselink.ui.internal.v2_0.persistence;
import org.eclipse.jpt.common.core.JptResourceType;
import org.eclipse.jpt.common.ui.jface.ItemTreeStateProviderFactoryProvider;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence.GenericPersistenceXml2_0Definition;
import org.eclipse.jpt.jpa.eclipselink.ui.internal.persistence.EclipseLinkPersistenceXmlUiDefinition;
import org.eclipse.jpt.jpa.ui.ResourceUiDefinition;
import org.eclipse.jpt.jpa.ui.internal.persistence.AbstractPersistenceXmlResourceUiDefinition;
@@ -22,8 +22,7 @@ public class EclipseLinkPersistenceXml2_0UiDefinition
{
// singleton
private static final ResourceUiDefinition INSTANCE = new EclipseLinkPersistenceXml2_0UiDefinition();
-
-
+
/**
* Return the singleton
*/
@@ -39,14 +38,13 @@ public class EclipseLinkPersistenceXml2_0UiDefinition
super();
}
-
@Override
protected PersistenceXmlUiFactory buildPersistenceXmlUiFactory() {
return new EclipseLink2_0PersistenceXmlUiFactory();
}
public boolean providesUi(JptResourceType resourceType) {
- return resourceType.equals(JptJpaCorePlugin.PERSISTENCE_XML_2_0_RESOURCE_TYPE);
+ return resourceType.equals(GenericPersistenceXml2_0Definition.instance().getResourceType());
}
public ItemTreeStateProviderFactoryProvider getStructureViewFactoryProvider() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/persistence/EclipseLinkPersistenceXml2_4UiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/persistence/EclipseLinkPersistenceXml2_4UiDefinition.java
index 55842c0807..dc3c3dbe74 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/persistence/EclipseLinkPersistenceXml2_4UiDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/persistence/EclipseLinkPersistenceXml2_4UiDefinition.java
@@ -1,29 +1,28 @@
/*******************************************************************************
-* Copyright (c) 2012 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
-*******************************************************************************/
+ * Copyright (c) 2012 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.jpa.eclipselink.ui.internal.v2_0.persistence;
import org.eclipse.jpt.common.core.JptResourceType;
import org.eclipse.jpt.common.ui.jface.ItemTreeStateProviderFactoryProvider;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence.GenericPersistenceXml2_0Definition;
import org.eclipse.jpt.jpa.eclipselink.ui.internal.persistence.EclipseLinkPersistenceXmlUiDefinition;
import org.eclipse.jpt.jpa.ui.ResourceUiDefinition;
import org.eclipse.jpt.jpa.ui.internal.persistence.AbstractPersistenceXmlResourceUiDefinition;
import org.eclipse.jpt.jpa.ui.internal.persistence.PersistenceXmlUiFactory;
-public class EclipseLinkPersistenceXml2_4UiDefinition extends
- AbstractPersistenceXmlResourceUiDefinition {
-
+public class EclipseLinkPersistenceXml2_4UiDefinition
+ extends AbstractPersistenceXmlResourceUiDefinition
+{
// singleton
private static final ResourceUiDefinition INSTANCE = new EclipseLinkPersistenceXml2_4UiDefinition();
-
-
+
/**
* Return the singleton
*/
@@ -45,7 +44,7 @@ public class EclipseLinkPersistenceXml2_4UiDefinition extends
}
public boolean providesUi(JptResourceType resourceType) {
- return resourceType.equals(JptJpaCorePlugin.PERSISTENCE_XML_2_0_RESOURCE_TYPE);
+ return resourceType.equals(GenericPersistenceXml2_0Definition.instance().getResourceType());
}
public ItemTreeStateProviderFactoryProvider getStructureViewFactoryProvider() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/persistence/PersistenceXmlOptions2_0Tab.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/persistence/PersistenceXmlOptions2_0Tab.java
index c789f7a0d9..044c8241d5 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/persistence/PersistenceXmlOptions2_0Tab.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/persistence/PersistenceXmlOptions2_0Tab.java
@@ -45,10 +45,10 @@ import org.eclipse.jpt.jpa.core.jpa2.context.persistence.options.ValidationMode;
import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceUnit;
import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.Logging2_0;
import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.Options2_0;
-import org.eclipse.jpt.jpa.eclipselink.ui.JptJpaEclipseLinkUiPlugin;
import org.eclipse.jpt.jpa.eclipselink.ui.internal.EclipseLinkHelpContextIds;
import org.eclipse.jpt.jpa.eclipselink.ui.internal.EclipseLinkUiMessages;
import org.eclipse.jpt.jpa.eclipselink.ui.internal.persistence.options.PersistenceXmlOptionsTab;
+import org.eclipse.jpt.jpa.eclipselink.ui.internal.plugin.JptJpaEclipseLinkUiPlugin;
import org.eclipse.jpt.jpa.ui.internal.jpa2.persistence.JptUiPersistence2_0Messages;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
@@ -470,7 +470,7 @@ public class PersistenceXmlOptions2_0Tab extends PersistenceXmlOptionsTab<Persis
);
}
catch (JavaModelException e) {
- JptJpaEclipseLinkUiPlugin.log(e);
+ JptJpaEclipseLinkUiPlugin.instance().logError(e);
return null;
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/weave/EclipselinkPreferencePage.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/weave/EclipselinkPreferencePage.java
index e6b6d9349a..9832c32dec 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/weave/EclipselinkPreferencePage.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/weave/EclipselinkPreferencePage.java
@@ -1,20 +1,21 @@
/*******************************************************************************
-* Copyright (c) 2012 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
-*******************************************************************************/
+ * Copyright (c) 2012 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.jpa.eclipselink.ui.internal.weave;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
+import org.eclipse.jpt.common.core.internal.utility.ProjectTools;
import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.jpa.core.JpaFacet;
+import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.eclipselink.core.builder.EclipseLinkStaticWeavingBuilderConfigurator;
import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.LoggingLevel;
import org.eclipse.jpt.jpa.eclipselink.ui.internal.EclipseLinkUiMessages;
@@ -51,7 +52,7 @@ public class EclipselinkPreferencePage extends PropertyPage {
public boolean performOk() {
super.performOk();
- if(JpaFacet.isInstalled(this.getProject()) && this.staticWeaveClasses()) {
+ if(ProjectTools.hasFacet(this.getProject(), JpaProject.FACET) && this.staticWeaveClasses()) {
if( ! this.projectHasStaticWeavingBuilder()) {
this.configurator.addBuilder();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/DynamicEntityClassWizardPage.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/DynamicEntityClassWizardPage.java
index 532cc997a2..5eeacbfb40 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/DynamicEntityClassWizardPage.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/DynamicEntityClassWizardPage.java
@@ -41,16 +41,18 @@ import org.eclipse.jface.viewers.TreePath;
import org.eclipse.jface.viewers.TreeSelection;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.jface.window.Window;
+import org.eclipse.jpt.common.core.internal.utility.ProjectTools;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.jpa.core.JpaFacet;
import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
-import org.eclipse.jpt.jpa.eclipselink.ui.JptJpaEclipseLinkUiPlugin;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLink2_1JpaPlatformFactory;
+import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaPlatformFactory.EclipseLinkJpaPlatformVersion;
+import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.eclipselink.ui.internal.EclipseLinkHelpContextIds;
import org.eclipse.jpt.jpa.eclipselink.ui.internal.EclipseLinkUiMessages;
+import org.eclipse.jpt.jpa.eclipselink.ui.internal.plugin.JptJpaEclipseLinkUiPlugin;
import org.eclipse.jpt.jpa.ui.internal.jface.XmlMappingFileViewerFilter;
import org.eclipse.jpt.jpa.ui.internal.wizards.SelectMappingFileDialog;
import org.eclipse.jpt.jpa.ui.internal.wizards.entity.data.model.IEntityDataModelProperties;
@@ -273,7 +275,7 @@ public class DynamicEntityClassWizardPage extends DataModelWizardPage{
private void addMappingXMLGroup(Composite parent) {
Group group = createGroup(parent, EclipseLinkUiMessages.DynamicEntityClassWizardPage_xmlGroup);
createBrowseGroup(group, EclipseLinkUiMessages.DynamicEntityClassWizardPage_xmlNameLabel, IEntityDataModelProperties.XML_NAME);
- this.ormXmlNameText.setText(JptJpaEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH.toString());
+ this.ormXmlNameText.setText(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
}
/**
@@ -414,7 +416,7 @@ public class DynamicEntityClassWizardPage extends DataModelWizardPage{
* @return new instance of viewer filter for the SelectEcliplseLinkMappingFileDialog
*/
protected ViewerFilter getDialogViewerFilter(JpaProject jpaProject) {
- return new XmlMappingFileViewerFilter(jpaProject, JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE);
+ return new XmlMappingFileViewerFilter(jpaProject, XmlEntityMappings.CONTENT_TYPE);
}
protected JpaProject getJpaProject(IProject project) {
@@ -434,17 +436,19 @@ public class DynamicEntityClassWizardPage extends DataModelWizardPage{
* JPA project with 2.1 or above version, <code>false</code> - otherwise.
*/
protected boolean isProjectValid(IProject project) {
- return (project.isAccessible() && JpaFacet.isInstalled(project) && this.getJpaPlatformGroupId(project).equals("eclipselink")
- && this.projectIsJpa2_1Compatible(project));
+ return (project.isAccessible() && ProjectTools.hasFacet(project, JpaProject.FACET) && this.getJpaPlatformGroupId(project).equals("eclipselink")
+ && this.projectIsEclipseLink2_1Compatible(project));
}
protected String getJpaPlatformGroupId(IProject project) {
JpaPlatformDescription desc = (JpaPlatformDescription) project.getAdapter(JpaPlatformDescription.class);
- return desc.getGroup().getId();
+ return desc.getGroupDescription().getId();
}
- private boolean projectIsJpa2_1Compatible(IProject project) {
- return JptJpaEclipseLinkCorePlugin.nodeIsEclipseLinkVersionCompatible(this.getJpaProject(project), "2.1");
+ private boolean projectIsEclipseLink2_1Compatible(IProject project) {
+ JpaProject jpaProject = this.getJpaProject(project);
+ EclipseLinkJpaPlatformVersion jpaVersion = (EclipseLinkJpaPlatformVersion) jpaProject.getJpaPlatform().getJpaVersion();
+ return jpaVersion.isCompatibleWithEclipseLinkVersion(EclipseLink2_1JpaPlatformFactory.VERSION);
}
private void initializeProjectList() {
@@ -666,7 +670,7 @@ public class DynamicEntityClassWizardPage extends DataModelWizardPage{
jelem = projects[0];
}
} catch (JavaModelException e) {
- JptJpaEclipseLinkUiPlugin.log(e);
+ JptJpaEclipseLinkUiPlugin.instance().logError(e);
}
}
return jelem;
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/DynamicEntityFieldTableSection.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/DynamicEntityFieldTableSection.java
index b6da932d4e..899234f3a6 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/DynamicEntityFieldTableSection.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/DynamicEntityFieldTableSection.java
@@ -31,6 +31,7 @@ import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.window.Window;
import org.eclipse.jpt.common.core.JptResourceType;
+import org.eclipse.jpt.common.utility.internal.Tools;
import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
@@ -372,10 +373,9 @@ public class DynamicEntityFieldTableSection extends Composite {
return false;
}
public Object[] getElements(Object element) {
- if (element instanceof List) {
- return ((List) element).toArray();
- }
- return new Object[0];
+ return (element instanceof List) ?
+ ((List<?>) element).toArray() :
+ Tools.EMPTY_OBJECT_ARRAY;
}
public void inputChanged(Viewer aViewer, Object oldInput, Object newInput) {
//Default nothing
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/DynamicEntityFieldsWizardPage.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/DynamicEntityFieldsWizardPage.java
index eb7dae400f..295829e9aa 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/DynamicEntityFieldsWizardPage.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/DynamicEntityFieldsWizardPage.java
@@ -12,9 +12,9 @@ package org.eclipse.jpt.jpa.eclipselink.ui.internal.wizards;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jpt.jpa.eclipselink.ui.JptJpaEclipseLinkUiPlugin;
import org.eclipse.jpt.jpa.eclipselink.ui.internal.EclipseLinkHelpContextIds;
import org.eclipse.jpt.jpa.eclipselink.ui.internal.EclipseLinkUiMessages;
+import org.eclipse.jpt.jpa.eclipselink.ui.internal.plugin.JptJpaEclipseLinkUiPlugin;
import org.eclipse.jpt.jpa.ui.internal.wizards.entity.data.model.IEntityDataModelProperties;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
@@ -85,9 +85,7 @@ public class DynamicEntityFieldsWizardPage extends DataModelWizardPage {
protected IStatus validateProjectName() {
// check for empty
if (model.getStringProperty(IArtifactEditOperationDataModelProperties.PROJECT_NAME) == null || model.getStringProperty(IArtifactEditOperationDataModelProperties.PROJECT_NAME).trim().length() == 0) {
- return new Status(
- IStatus.ERROR, JptJpaEclipseLinkUiPlugin.PLUGIN_ID,
- EclipseLinkUiMessages.DynamicEntityFieldsWizardPage_noJpaProjects);
+ return JptJpaEclipseLinkUiPlugin.instance().buildErrorStatus(EclipseLinkUiMessages.DynamicEntityFieldsWizardPage_noJpaProjects);
}
return Status.OK_STATUS;
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/EclipseLinkDynamicEntityWizard.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/EclipseLinkDynamicEntityWizard.java
index d94a597fd6..473122c714 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/EclipseLinkDynamicEntityWizard.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/EclipseLinkDynamicEntityWizard.java
@@ -10,7 +10,6 @@
package org.eclipse.jpt.jpa.eclipselink.ui.internal.wizards;
import java.lang.reflect.InvocationTargetException;
-
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
@@ -18,17 +17,16 @@ import org.eclipse.core.runtime.Path;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
+import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.context.JpaContextNode;
import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
-import org.eclipse.jpt.jpa.eclipselink.ui.JptJpaEclipseLinkUiPlugin;
import org.eclipse.jpt.jpa.eclipselink.ui.internal.EclipseLinkUiMessages;
import org.eclipse.jpt.jpa.eclipselink.ui.internal.entity.data.model.DynamicEntityDataModelProvider;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
+import org.eclipse.jpt.jpa.eclipselink.ui.internal.plugin.JptJpaEclipseLinkUiPlugin;
import org.eclipse.jpt.jpa.ui.internal.JptUiIcons;
import org.eclipse.jpt.jpa.ui.internal.wizards.entity.data.model.IEntityDataModelProperties;
import org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.INewWizard;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
@@ -48,7 +46,7 @@ public class EclipseLinkDynamicEntityWizard extends DataModelWizard implements I
public EclipseLinkDynamicEntityWizard(IDataModel model) {
super(model);
setWindowTitle(EclipseLinkUiMessages.EclipseLinkDynamicEntityWizard_title);
- setDefaultPageImageDescriptor(JptJpaUiPlugin.getImageDescriptor(JptUiIcons.ENTITY_WIZ_BANNER));
+ setDefaultPageImageDescriptor(JptJpaEclipseLinkUiPlugin.instance().buildImageDescriptor(JptUiIcons.ENTITY_WIZ_BANNER));
}
/**
@@ -102,7 +100,7 @@ public class EclipseLinkDynamicEntityWizard extends DataModelWizard implements I
JpaXmlResource xmlResource = jpaProject.getMappingFileXmlResource(new Path(xmlRuntimePath));
openEditor(xmlResource);
} catch (Exception cantOpen) {
- JptJpaEclipseLinkUiPlugin.log(cantOpen);
+ JptJpaEclipseLinkUiPlugin.instance().logError(cantOpen);
}
}
@@ -110,7 +108,7 @@ public class EclipseLinkDynamicEntityWizard extends DataModelWizard implements I
* Open the EclipseLink mapping file where the dynamic entity is created
*/
protected void openEditor(final JpaXmlResource xmlResource) {
- Display.getDefault().asyncExec(new Runnable() {
+ SWTUtil.asyncExec(new Runnable() {
public void run() {
IFile file = xmlResource.getFile();
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/conversion/java/EclipseLinkJavaConverterConversionWizardPage.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/conversion/java/EclipseLinkJavaConverterConversionWizardPage.java
index 6f51cb1cab..7194f5241a 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/conversion/java/EclipseLinkJavaConverterConversionWizardPage.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/conversion/java/EclipseLinkJavaConverterConversionWizardPage.java
@@ -13,9 +13,9 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.context.orm.EntityMappings;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
import org.eclipse.jpt.jpa.eclipselink.core.context.orm.EclipseLinkEntityMappings;
import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceUnit;
+import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.eclipselink.ui.internal.EclipseLinkUiMessages;
public class EclipseLinkJavaConverterConversionWizardPage
@@ -40,7 +40,7 @@ public class EclipseLinkJavaConverterConversionWizardPage
*/
@Override
protected IContentType getMappingFileContentType() {
- return JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE;
+ return XmlEntityMappings.CONTENT_TYPE;
}
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/conversion/java/EclipseLinkJavaMetadataConversionWizardPage.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/conversion/java/EclipseLinkJavaMetadataConversionWizardPage.java
index 277d4c7396..5486a97c0c 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/conversion/java/EclipseLinkJavaMetadataConversionWizardPage.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/conversion/java/EclipseLinkJavaMetadataConversionWizardPage.java
@@ -17,9 +17,8 @@ import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.jpt.common.ui.internal.dialogs.OptionalMessageDialog;
import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceUnit;
+import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.eclipselink.ui.internal.wizards.EmbeddedEclipseLinkMappingFileWizard;
import org.eclipse.jpt.jpa.eclipselink.ui.internal.wizards.SelectEclipseLinkMappingFileDialog;
import org.eclipse.jpt.jpa.ui.internal.jface.XmlMappingFileViewerFilter;
@@ -37,7 +36,7 @@ public abstract class EclipseLinkJavaMetadataConversionWizardPage
@Override
protected ViewerFilter buildSelectMappingFileDialogViewerFilter() {
- return new XmlMappingFileViewerFilter(this.jpaProject, JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE);
+ return new XmlMappingFileViewerFilter(this.jpaProject, XmlEntityMappings.CONTENT_TYPE);
}
@Override
@@ -56,12 +55,12 @@ public abstract class EclipseLinkJavaMetadataConversionWizardPage
@Override
protected IPath getDefaultMappingFileRuntimPath() {
- return JptJpaEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH;
+ return XmlEntityMappings.DEFAULT_RUNTIME_PATH;
}
@Override
protected IContentType getMappingFileContentType() {
- return JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE;
+ return XmlEntityMappings.CONTENT_TYPE;
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/gen/DynamicDefaultTableGenerationWizardPage.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/gen/DynamicDefaultTableGenerationWizardPage.java
index 46c38f9062..f6080a292e 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/gen/DynamicDefaultTableGenerationWizardPage.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/gen/DynamicDefaultTableGenerationWizardPage.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2012 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
- *******************************************************************************/
+ * Copyright (c) 2012 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.jpa.eclipselink.ui.internal.wizards.gen;
import org.eclipse.core.resources.IFile;
@@ -17,7 +17,7 @@ import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.jface.window.Window;
import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
+import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.eclipselink.ui.internal.wizards.SelectEclipseLinkMappingFileDialog;
import org.eclipse.jpt.jpa.ui.internal.JpaHelpContextIds;
import org.eclipse.jpt.jpa.ui.internal.JptUiMessages;
@@ -153,7 +153,7 @@ public class DynamicDefaultTableGenerationWizardPage extends
}
protected ViewerFilter getDialogViewerFilter(JpaProject jpaProject) {
- return new XmlMappingFileViewerFilter(jpaProject, JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE);
+ return new XmlMappingFileViewerFilter(jpaProject, XmlEntityMappings.CONTENT_TYPE);
}
public void setVisible(boolean visible){
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/gen/GenerateDynamicEntitiesFromSchemaWizard.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/gen/GenerateDynamicEntitiesFromSchemaWizard.java
index 89af2563e9..caf9063af8 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/gen/GenerateDynamicEntitiesFromSchemaWizard.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/gen/GenerateDynamicEntitiesFromSchemaWizard.java
@@ -7,11 +7,9 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-
package org.eclipse.jpt.jpa.eclipselink.ui.internal.wizards.gen;
import java.lang.reflect.InvocationTargetException;
-
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
@@ -31,9 +29,8 @@ import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
import org.eclipse.jpt.jpa.db.ConnectionProfile;
import org.eclipse.jpt.jpa.db.Schema;
import org.eclipse.jpt.jpa.eclipselink.core.platform.EclipseLinkPlatform;
-import org.eclipse.jpt.jpa.eclipselink.ui.JptJpaEclipseLinkUiPlugin;
+import org.eclipse.jpt.jpa.eclipselink.ui.internal.plugin.JptJpaEclipseLinkUiPlugin;
import org.eclipse.jpt.jpa.gen.internal.ORMGenCustomizer;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
import org.eclipse.jpt.jpa.ui.internal.wizards.gen.GenerateEntitiesFromSchemaWizard;
import org.eclipse.jpt.jpa.ui.internal.wizards.gen.PromptJPAProjectWizardPage;
import org.eclipse.jpt.jpa.ui.internal.wizards.gen.TableAssociationsWizardPage;
@@ -48,7 +45,7 @@ import org.eclipse.ui.ide.IDE;
public class GenerateDynamicEntitiesFromSchemaWizard extends GenerateEntitiesFromSchemaWizard
implements INewWizard {
- public static final String HELP_CONTEXT_ID = JptJpaUiPlugin.PLUGIN_ID + ".GenerateEntitiesFromSchemaWizard"; //$NON-NLS-1$
+ public static final String HELP_CONTEXT_ID = JptJpaEclipseLinkUiPlugin.instance().getPluginID() + ".GenerateEntitiesFromSchemaWizard"; //$NON-NLS-1$
// ********** constructor **********
@@ -130,7 +127,7 @@ public class GenerateDynamicEntitiesFromSchemaWizard extends GenerateEntitiesFro
if(jpaProject == null) {
return false;
}
- return jpaProject.getJpaPlatform().getDescription().getGroup().getId().
+ return jpaProject.getJpaPlatform().getDescription().getGroupDescription().getId().
equals(EclipseLinkPlatform.GROUP.getId());
}
@@ -161,7 +158,7 @@ public class GenerateDynamicEntitiesFromSchemaWizard extends GenerateEntitiesFro
try {
postGeneration(this.jpaProject,this.mappingFile);
} catch (InvocationTargetException e) {
- throw new CoreException(new Status(IStatus.ERROR, JptJpaEclipseLinkUiPlugin.PLUGIN_ID, "error", e));
+ throw new CoreException(JptJpaEclipseLinkUiPlugin.instance().buildErrorStatus());
}
return Status.OK_STATUS;
}
@@ -184,7 +181,7 @@ public class GenerateDynamicEntitiesFromSchemaWizard extends GenerateEntitiesFro
IDE.openEditor(page, file, true);
}
catch (PartInitException e) {
- JptJpaUiPlugin.log(e);
+ JptJpaEclipseLinkUiPlugin.instance().logError(e);
}
}
});
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/gen/PromptEclipseLinkProjectWizardPage.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/gen/PromptEclipseLinkProjectWizardPage.java
index 479382d689..f154a40cd0 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/gen/PromptEclipseLinkProjectWizardPage.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/gen/PromptEclipseLinkProjectWizardPage.java
@@ -1,12 +1,12 @@
/*******************************************************************************
-* Copyright (c) 2012 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
-*******************************************************************************/
+ * Copyright (c) 2012 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.jpa.eclipselink.ui.internal.wizards.gen;
import org.eclipse.jpt.jpa.core.JpaProject;
@@ -28,7 +28,7 @@ public class PromptEclipseLinkProjectWizardPage extends PromptJPAProjectWizardPa
if(jpaProject == null) {
return false;
}
- return jpaProject.getJpaPlatform().getDescription().getGroup().getId().
+ return jpaProject.getJpaPlatform().getDescription().getGroupDescription().getId().
equals(EclipseLinkPlatform.GROUP.getId());
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.gen/META-INF/MANIFEST.MF b/jpa/plugins/org.eclipse.jpt.jpa.gen/META-INF/MANIFEST.MF
index 32afdc659e..11fbd1c711 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.gen/META-INF/MANIFEST.MF
+++ b/jpa/plugins/org.eclipse.jpt.jpa.gen/META-INF/MANIFEST.MF
@@ -2,12 +2,13 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
-Bundle-SymbolicName: org.eclipse.jpt.jpa.gen
+Bundle-SymbolicName: org.eclipse.jpt.jpa.gen;singleton:=true
Bundle-Version: 2.2.0.qualifier
+Bundle-Activator: org.eclipse.jpt.jpa.gen.internal.plugin.JptJpaGenPlugin
+Bundle-ActivationPolicy: lazy
+Bundle-ClassPath: .
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Export-Package: org.eclipse.jpt.jpa.gen.internal;x-internal:=true,
- org.eclipse.jpt.jpa.gen.internal.util;x-internal:=true
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)",
org.eclipse.jdt.core;bundle-version="[3.4.0,4.0.0)",
org.eclipse.jpt.common.utility;bundle-version="[2.0.0,3.0.0)",
@@ -23,3 +24,5 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)",
org.eclipse.wst.common.emf;bundle-version="[1.2.0,2.0.0)",
org.eclipse.emf.ecore.xmi;bundle-version="[2.5.0,3.0.0)"
Import-Package: com.ibm.icu.text;version="4.0.1"
+Export-Package: org.eclipse.jpt.jpa.gen.internal;x-internal:=true,
+ org.eclipse.jpt.jpa.gen.internal.util;x-internal:=true
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.gen/property_files/jpt_gen.properties b/jpa/plugins/org.eclipse.jpt.jpa.gen/property_files/jpt_gen.properties
index db907a2472..edcf95a951 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.gen/property_files/jpt_gen.properties
+++ b/jpa/plugins/org.eclipse.jpt.jpa.gen/property_files/jpt_gen.properties
@@ -1,5 +1,5 @@
################################################################################
-# Copyright (c) 2008, 2009 Oracle. All rights reserved.
+# Copyright (c) 2008, 2012 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.
@@ -17,4 +17,4 @@ Delete_Folder_Error = "The directory {0} could not be deleted."
Delete_File_Error = "The file {0} could not be deleted."
File_Read_Only_Error= "The file {0} could not be modified because write access is denied.\nPlease make sure that the file is not marked as readonly in the file system."
-Templates_notFound = Unable to find JPA entities generation templates in plugin \ No newline at end of file
+Templates_notFound = Unable to find JPA entities generation templates in plugin: {0} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.gen/src/org/eclipse/jpt/jpa/gen/internal/BaseEntityGenCustomizer.java b/jpa/plugins/org.eclipse.jpt.jpa.gen/src/org/eclipse/jpt/jpa/gen/internal/BaseEntityGenCustomizer.java
index 79abf3d86b..48600db695 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.gen/src/org/eclipse/jpt/jpa/gen/internal/BaseEntityGenCustomizer.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.gen/src/org/eclipse/jpt/jpa/gen/internal/BaseEntityGenCustomizer.java
@@ -12,8 +12,6 @@ package org.eclipse.jpt.jpa.gen.internal;
import java.io.File;
import java.util.List;
import java.util.Set;
-
-import org.eclipse.jpt.jpa.core.prefs.JpaEntityGenPreferencesManager;
import org.eclipse.jpt.jpa.db.Column;
import org.eclipse.jpt.jpa.db.Schema;
import org.eclipse.jpt.jpa.gen.internal.util.DTPUtil;
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.gen/src/org/eclipse/jpt/jpa/gen/internal/JptJpaGenPlugin.java b/jpa/plugins/org.eclipse.jpt.jpa.gen/src/org/eclipse/jpt/jpa/gen/internal/JptJpaGenPlugin.java
deleted file mode 100644
index d99645f6b0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.gen/src/org/eclipse/jpt/jpa/gen/internal/JptJpaGenPlugin.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.jpa.gen.internal;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.ILog;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.osgi.framework.Bundle;
-
-public class JptJpaGenPlugin {
- public static final String PLUGIN_ID = "org.eclipse.jpt.jpa.gen";
- public static void logException ( String msg, Throwable e ) {
- Bundle bundle = Platform.getBundle(PLUGIN_ID);
- ILog log = Platform.getLog(bundle);
- log.log(new Status(IStatus.ERROR, PLUGIN_ID, msg, e ));
- }
-
- public static void logException( CoreException ce ) {
- IStatus status = ce.getStatus();
- Bundle bundle = Platform.getBundle(PLUGIN_ID);
- ILog log = Platform.getLog(bundle);
- log.log(new Status(IStatus.ERROR, PLUGIN_ID, status.getMessage(), ce));
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.gen/src/org/eclipse/jpt/jpa/gen/internal/ORMGenCustomizer.java b/jpa/plugins/org.eclipse.jpt.jpa.gen/src/org/eclipse/jpt/jpa/gen/internal/ORMGenCustomizer.java
index cb76bdd3a8..dcbeb7edb3 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.gen/src/org/eclipse/jpt/jpa/gen/internal/ORMGenCustomizer.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.gen/src/org/eclipse/jpt/jpa/gen/internal/ORMGenCustomizer.java
@@ -21,15 +21,11 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.jpa.core.prefs.JpaEntityGenPreferencesManager;
import org.eclipse.jpt.jpa.db.Column;
import org.eclipse.jpt.jpa.db.Schema;
import org.eclipse.jpt.jpa.db.Table;
+import org.eclipse.jpt.jpa.gen.internal.plugin.JptJpaGenPlugin;
import org.eclipse.jpt.jpa.gen.internal.util.DTPUtil;
import org.eclipse.jpt.jpa.gen.internal.util.FileUtil;
import org.eclipse.jpt.jpa.gen.internal.util.ForeignKeyInfo;
@@ -202,7 +198,7 @@ public abstract class ORMGenCustomizer implements java.io.Serializable
restore(customizer);
}
} catch (Exception ex) {
- JptJpaGenPlugin.logException("***ORMGenCustomizer.load failed "+file, ex);
+ JptJpaGenPlugin.instance().logError(ex, "***ORMGenCustomizer.load failed {0}", file); //$NON-NLS-1$
}
finally
{
@@ -266,9 +262,7 @@ public abstract class ORMGenCustomizer implements java.io.Serializable
deleteIt = false;
} catch (Exception ex) {
//deleteIt is true, so the cache is not saved.
- CoreException ce = new CoreException(new Status(IStatus.ERROR, JptJpaGenPlugin.PLUGIN_ID,
- "Unable to save the ORMGenCustomizer file: "+mFile,ex));
- JptJpaGenPlugin.logException( ce );
+ JptJpaGenPlugin.instance().logError(ex, "Unable to save the ORMGenCustomizer file: {0}", mFile); //$NON-NLS-1$
} finally {
try {
if (oos!=null) oos.close();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.gen/src/org/eclipse/jpt/jpa/gen/internal/PackageGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.gen/src/org/eclipse/jpt/jpa/gen/internal/PackageGenerator.java
index b7c5b33c9b..11e4ebe3ef 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.gen/src/org/eclipse/jpt/jpa/gen/internal/PackageGenerator.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.gen/src/org/eclipse/jpt/jpa/gen/internal/PackageGenerator.java
@@ -7,7 +7,6 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-
package org.eclipse.jpt.jpa.gen.internal;
import java.io.ByteArrayInputStream;
@@ -48,6 +47,7 @@ import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef;
import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
+import org.eclipse.jpt.jpa.gen.internal.plugin.JptJpaGenPlugin;
import org.eclipse.jpt.jpa.gen.internal.util.CompilationUnitModifier;
import org.eclipse.jpt.jpa.gen.internal.util.FileUtil;
import org.eclipse.jpt.jpa.gen.internal.util.UrlUtil;
@@ -76,7 +76,7 @@ public class PackageGenerator {
generator.doGenerate(sm.newChild(19));
}
} catch (Exception e) {
- throw new CoreException(new Status(IStatus.ERROR, JptJpaGenPlugin.PLUGIN_ID, JptGenMessages.Error_Generating_Entities, e));
+ throw new CoreException(JptJpaGenPlugin.instance().buildErrorStatus(JptGenMessages.Error_Generating_Entities, e));
}
}
@@ -153,7 +153,7 @@ public class PackageGenerator {
return;
}
- Persistence persistence = this.jpaProject.getRootContextNode().getPersistenceXml().getPersistence();
+ Persistence persistence = this.jpaProject.getRootContextNode().getPersistenceXml().getRoot();
if (persistence == null) {
// invalid content, do not attempt to update
return;
@@ -200,11 +200,11 @@ public class PackageGenerator {
//If the plug-in is packaged as a JAR, we need extract the template
//folder into the plug-in state location. This is required by Velocity
//since we use included templates.
- Bundle bundle = Platform.getBundle(JptJpaGenPlugin.PLUGIN_ID);
+ Bundle bundle = JptJpaGenPlugin.instance().getBundle();
Path path = new Path( templatesPath);
URL url = FileLocator.find(bundle, path, null);
if (url == null) {
- throw new CoreException(new Status(IStatus.ERROR, JptJpaGenPlugin.PLUGIN_ID, JptGenMessages.Templates_notFound + " "+ JptJpaGenPlugin.PLUGIN_ID + "/" + templatesPath) );//$NON-NLS-1$
+ throw new CoreException(JptJpaGenPlugin.instance().buildErrorStatus(JptGenMessages.Templates_notFound, JptJpaGenPlugin.instance().getPluginID() + '/' + templatesPath));
}
URL templUrl = FileLocator.resolve(url);
@@ -218,7 +218,7 @@ public class PackageGenerator {
if (templDir == null || !templDir.exists()) {
- throw new CoreException(new Status(IStatus.ERROR, JptJpaGenPlugin.PLUGIN_ID, JptGenMessages.Templates_notFound + " "+ JptJpaGenPlugin.PLUGIN_ID ) );//$NON-NLS-1$
+ throw new CoreException(JptJpaGenPlugin.instance().buildErrorStatus(JptGenMessages.Templates_notFound, JptJpaGenPlugin.instance().getPluginID()));
}
return templDir;
}
@@ -231,7 +231,7 @@ public class PackageGenerator {
return;
}
- Persistence persistence = this.jpaProject.getRootContextNode().getPersistenceXml().getPersistence();
+ Persistence persistence = this.jpaProject.getRootContextNode().getPersistenceXml().getRoot();
if (persistence == null) {
// invalid content, do not attempt to update
return;
@@ -305,8 +305,7 @@ public class PackageGenerator {
javaFile.refreshLocal(1, sm.newChild(1));
} catch (Throwable e) {
- CoreException ce = new CoreException(new Status(IStatus.ERROR, JptJpaGenPlugin.PLUGIN_ID, JptGenMessages.Templates_notFound + "" + JptJpaGenPlugin.PLUGIN_ID , e) );//$NON-NLS-1$
- JptJpaGenPlugin.logException( ce );
+ JptJpaGenPlugin.instance().logError(e, JptGenMessages.Templates_notFound, JptJpaGenPlugin.instance().getPluginID());
}
}
@@ -384,7 +383,7 @@ public class PackageGenerator {
}
}
} catch (JavaModelException e) {
- JptJpaGenPlugin.logException(e);
+ JptJpaGenPlugin.instance().logError(e);
}
}
return defaultSrcPath;
@@ -466,8 +465,7 @@ public class PackageGenerator {
xmlFile.refreshLocal(1, null);
} catch (Throwable e) {
- CoreException ce = new CoreException(new Status(IStatus.ERROR, JptJpaGenPlugin.PLUGIN_ID, JptGenMessages.Templates_notFound + "" + JptJpaGenPlugin.PLUGIN_ID , e) );//$NON-NLS-1$
- JptJpaGenPlugin.logException( ce );
+ JptJpaGenPlugin.instance().logError(e, JptGenMessages.Templates_notFound, JptJpaGenPlugin.instance().getPluginID());
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.gen/src/org/eclipse/jpt/jpa/gen/internal/plugin/JptJpaGenPlugin.java b/jpa/plugins/org.eclipse.jpt.jpa.gen/src/org/eclipse/jpt/jpa/gen/internal/plugin/JptJpaGenPlugin.java
new file mode 100644
index 0000000000..4f156df4e7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.jpa.gen/src/org/eclipse/jpt/jpa/gen/internal/plugin/JptJpaGenPlugin.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2012 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.jpa.gen.internal.plugin;
+
+import org.eclipse.jpt.common.core.internal.utility.JptPlugin;
+
+public class JptJpaGenPlugin
+ extends JptPlugin
+{
+ // ********** singleton **********
+
+ private static volatile JptJpaGenPlugin INSTANCE;
+
+ /**
+ * Return the singleton Dali common core plug-in.
+ */
+ public static JptJpaGenPlugin instance() {
+ return INSTANCE;
+ }
+
+
+ // ********** Dali plug-in **********
+
+ public JptJpaGenPlugin() {
+ super();
+ }
+
+ @Override
+ protected void setInstance(JptPlugin plugin) {
+ INSTANCE = (JptJpaGenPlugin) plugin;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.gen/src/org/eclipse/jpt/jpa/gen/internal/util/EntityGenTools.java b/jpa/plugins/org.eclipse.jpt.jpa.gen/src/org/eclipse/jpt/jpa/gen/internal/util/EntityGenTools.java
index faa48c38e6..76732ee325 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.gen/src/org/eclipse/jpt/jpa/gen/internal/util/EntityGenTools.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.gen/src/org/eclipse/jpt/jpa/gen/internal/util/EntityGenTools.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2012 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.
@@ -38,18 +38,23 @@ public class EntityGenTools {
/**
* Convert the specified (database) identifier to a unique "Java style"
- * identifier:
- * - if the identifier is all-caps, convert underscores to "camel case"
- * - if the identifier is not all-caps, leave it unchanged (except, possibly, for the first letter)
- * - convert to a legal Java identifier
- * - eliminate illegal characters
- * - if the result is a reserved word, modify it slightly
+ * identifier:<ul>
+ * <li>if the identifier is all-caps, convert underscores to "camel case"
+ * <li>if the identifier is not all-caps, leave it unchanged
+ * (except, possibly, for the first letter)
+ * <li>convert to a legal Java identifier
+ * <li>eliminate illegal characters
+ * <li>if the result is a reserved word, modify it slightly
+ * </ul>
* If the result is already one of the specified existing identifiers
* (ignoring case so we don't have filename collisions on Windows),
* modify it slightly again.
- * "FOO" => "Foo" or "foo"
- * "FOO_BAR" => "FooBar" or "fooBar"
- * "PACKAGE" => "Package" or "package_"
+ * <p>
+ * For example:<ul><code>
+ * <li>"FOO" => "Foo" or "foo"
+ * <li>"FOO_BAR" => "FooBar" or "fooBar"
+ * <li>"PACKAGE" => "Package" or "package_"
+ * </code><ul>
*/
public static String convertToUniqueJavaStyleIdentifier(String identifier, boolean capitalizeFirstLetter, Collection<String> identifiers) {
String result = identifier;
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/.classpath b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/.classpath
index fe3e03bba0..8d413dcc02 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/.classpath
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/.classpath
@@ -4,8 +4,10 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
<accessrules>
+ <accessrule kind="nonaccessible" pattern="org/eclipse/jpt/**/plugin/**"/>
<accessrule kind="accessible" pattern="org/eclipse/jpt/jpa/ui/**"/>
<accessrule kind="accessible" pattern="org/eclipse/jpt/jpa/core/**"/>
+ <accessrule kind="accessible" pattern="org/eclipse/jpt/common/core/**"/>
<accessrule kind="accessible" pattern="org/eclipse/jpt/common/utility/**"/>
</accessrules>
</classpathentry>
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/META-INF/MANIFEST.MF b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/META-INF/MANIFEST.MF
index 4ebad85e7b..177bb5c07a 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/META-INF/MANIFEST.MF
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/META-INF/MANIFEST.MF
@@ -4,8 +4,9 @@ Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.jpt.jpa.core.tests.extension.resource;singleton:=true
Bundle-Version: 3.2.0.qualifier
-Bundle-Activator: org.eclipse.jpt.jpa.core.tests.extension.resource.ExtensionTestPlugin
+Bundle-Activator: org.eclipse.jpt.jpa.core.tests.extension.resource.TestExtensionPlugin
Bundle-ActivationPolicy: lazy
+Bundle-ClassPath: .
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Require-Bundle: org.eclipse.core.resources,
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/ExtensionTestPlugin.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/ExtensionTestPlugin.java
deleted file mode 100644
index ae5cd6e783..0000000000
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/ExtensionTestPlugin.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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.jpa.core.tests.extension.resource;
-
-import org.eclipse.core.runtime.Plugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class ExtensionTestPlugin extends Plugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.jpt.jpa.core.tests.extension.resource"; //$NON-NLS-1$
-
- // The shared instance
- private static ExtensionTestPlugin plugin;
-
- /**
- * The constructor
- */
- public ExtensionTestPlugin() {
- super();
- }
-
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- @Override
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static ExtensionTestPlugin getDefault() {
- return plugin;
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestExtensionPlugin.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestExtensionPlugin.java
new file mode 100644
index 0000000000..a6145e85d9
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestExtensionPlugin.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2012 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.jpa.core.tests.extension.resource;
+
+import org.eclipse.jpt.common.core.internal.utility.JptPlugin;
+
+public class TestExtensionPlugin
+ extends JptPlugin
+{
+ // ********** singleton **********
+
+ private static volatile TestExtensionPlugin INSTANCE;
+
+ /**
+ * Return the singleton test extension plug-in.
+ */
+ public static TestExtensionPlugin instance() {
+ return INSTANCE;
+ }
+
+
+ // ********** Dali plug-in **********
+
+ public TestExtensionPlugin() {
+ super();
+ }
+
+ @Override
+ protected void setInstance(JptPlugin plugin) {
+ INSTANCE = (TestExtensionPlugin) plugin;
+ }
+}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestJpaPlatformFactory.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestJpaPlatformFactory.java
index d148ddcbc5..e7a29f6be2 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestJpaPlatformFactory.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestJpaPlatformFactory.java
@@ -10,14 +10,14 @@
package org.eclipse.jpt.jpa.core.tests.extension.resource;
import org.eclipse.jpt.common.core.JptResourceType;
-import org.eclipse.jpt.jpa.core.JpaFacet;
import org.eclipse.jpt.jpa.core.JpaPlatform;
import org.eclipse.jpt.jpa.core.JpaPlatformFactory;
import org.eclipse.jpt.jpa.core.JpaPlatformVariation;
+import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.context.AccessType;
import org.eclipse.jpt.jpa.core.internal.GenericJpaAnnotationDefinitionProvider;
import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatform;
-import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatformFactory.SimpleVersion;
+import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatformFactory.GenericJpaPlatformVersion;
import org.eclipse.jpt.jpa.core.internal.JpaAnnotationProvider;
import org.eclipse.persistence.jpa.jpql.parser.DefaultJPQLGrammar;
@@ -48,7 +48,7 @@ public class TestJpaPlatformFactory
}
private JpaPlatform.Version buildJpaVersion() {
- return new SimpleVersion(JpaFacet.VERSION_1_0.getVersionString()) {
+ return new GenericJpaPlatformVersion(JpaProject.FACET_VERSION_STRING) {
@Override
public String getVersion() {
return "BOOOYAH!";
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestJpaPlatformProvider.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestJpaPlatformProvider.java
index 5a072bf5b1..d8ab48da57 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestJpaPlatformProvider.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestJpaPlatformProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2012 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.
@@ -10,13 +10,10 @@
package org.eclipse.jpt.jpa.core.tests.extension.resource;
import java.util.ArrayList;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
import org.eclipse.jpt.common.core.JptResourceType;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.jpa.core.JpaPlatformProvider;
import org.eclipse.jpt.jpa.core.JpaResourceModelProvider;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.ResourceDefinition;
import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition;
import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
@@ -26,6 +23,7 @@ import org.eclipse.jpt.jpa.core.internal.JarResourceModelProvider;
import org.eclipse.jpt.jpa.core.internal.JavaResourceModelProvider;
import org.eclipse.jpt.jpa.core.internal.OrmResourceModelProvider;
import org.eclipse.jpt.jpa.core.internal.PersistenceResourceModelProvider;
+import org.eclipse.jpt.jpa.core.internal.context.java.JarDefinition;
import org.eclipse.jpt.jpa.core.internal.context.java.JavaBasicMappingDefinition;
import org.eclipse.jpt.jpa.core.internal.context.java.JavaEmbeddableDefinition;
import org.eclipse.jpt.jpa.core.internal.context.java.JavaEmbeddedIdMappingDefinition;
@@ -37,12 +35,14 @@ import org.eclipse.jpt.jpa.core.internal.context.java.JavaManyToOneMappingDefini
import org.eclipse.jpt.jpa.core.internal.context.java.JavaMappedSuperclassDefinition;
import org.eclipse.jpt.jpa.core.internal.context.java.JavaOneToManyMappingDefinition;
import org.eclipse.jpt.jpa.core.internal.context.java.JavaOneToOneMappingDefinition;
+import org.eclipse.jpt.jpa.core.internal.context.java.JavaSourceFileDefinition;
import org.eclipse.jpt.jpa.core.internal.context.java.JavaTransientMappingDefinition;
import org.eclipse.jpt.jpa.core.internal.context.java.JavaVersionMappingDefinition;
import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmXmlDefinition;
import org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.GenericPersistenceXmlDefinition;
-public class TestJpaPlatformProvider extends AbstractJpaPlatformProvider
+public class TestJpaPlatformProvider
+ extends AbstractJpaPlatformProvider
{
public static final String ID = "core.testJpaPlatform"; //$NON-NLS-1$
@@ -68,24 +68,19 @@ public class TestJpaPlatformProvider extends AbstractJpaPlatformProvider
// ********** resource models **********
- public JptResourceType getMostRecentSupportedResourceType(IContentType contentType) {
- if (contentType.equals(JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE)) {
- return JptCommonCorePlugin.JAVA_SOURCE_RESOURCE_TYPE;
- }
- else if (contentType.equals(JptCommonCorePlugin.JAR_CONTENT_TYPE)) {
- return JptCommonCorePlugin.JAR_RESOURCE_TYPE;
- }
- else if (contentType.equals(JptJpaCorePlugin.PERSISTENCE_XML_CONTENT_TYPE)) {
- return JptJpaCorePlugin.PERSISTENCE_XML_1_0_RESOURCE_TYPE;
- }
- else if (contentType.equals(JptJpaCorePlugin.ORM_XML_CONTENT_TYPE)) {
- return JptJpaCorePlugin.ORM_XML_1_0_RESOURCE_TYPE;
- }
- else {
- throw new IllegalArgumentException(contentType.toString());
- }
+ @Override
+ protected void addMostRecentSupportedResourceTypesTo(ArrayList<JptResourceType> types) {
+ CollectionTools.addAll(types, MOST_RECENT_SUPPORTED_RESOURCE_TYPES);
}
+ // order should not be important here
+ protected static final JptResourceType[] MOST_RECENT_SUPPORTED_RESOURCE_TYPES = new JptResourceType[] {
+ JavaSourceFileDefinition.instance().getResourceType(),
+ JarDefinition.instance().getResourceType(),
+ GenericPersistenceXmlDefinition.instance().getResourceType(),
+ GenericOrmXmlDefinition.instance().getResourceType()
+ };
+
@Override
protected void addResourceModelProvidersTo(ArrayList<JpaResourceModelProvider> providers) {
CollectionTools.addAll(providers, RESOURCE_MODEL_PROVIDERS);
@@ -157,6 +152,8 @@ public class TestJpaPlatformProvider extends AbstractJpaPlatformProvider
}
protected static final ResourceDefinition[] RESOURCE_DEFINITIONS = new ResourceDefinition[] {
+ JavaSourceFileDefinition.instance(),
+ JarDefinition.instance(),
GenericPersistenceXmlDefinition.instance(),
GenericOrmXmlDefinition.instance()
};
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/META-INF/MANIFEST.MF b/jpa/tests/org.eclipse.jpt.jpa.core.tests/META-INF/MANIFEST.MF
index b8929c287b..ffc8c06994 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/META-INF/MANIFEST.MF
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/META-INF/MANIFEST.MF
@@ -4,6 +4,9 @@ Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.jpt.jpa.core.tests;singleton:=true
Bundle-Version: 3.2.0.qualifier
+Bundle-Activator: org.eclipse.jpt.jpa.core.tests.internal.plugin.JptJpaCoreTestsPlugin
+Bundle-ActivationPolicy: lazy
+Bundle-ClassPath: .
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Require-Bundle: org.eclipse.core.commands;bundle-version="[3.4.0,4.0.0)",
@@ -26,8 +29,7 @@ Require-Bundle: org.eclipse.core.commands;bundle-version="[3.4.0,4.0.0)",
org.eclipse.wst.common.modulecore;bundle-version="[1.1.200,2.0.0)",
org.eclipse.wst.common.project.facet.core;bundle-version="[1.3.0,2.0.0)",
org.junit;bundle-version="[4.0.0,5.0.0)"
-Export-Package: org.eclipse.jpt.jpa.core.tests;x-internal:=true,
- org.eclipse.jpt.jpa.core.tests.internal;x-internal:=true,
+Export-Package: org.eclipse.jpt.jpa.core.tests.internal;x-internal:=true,
org.eclipse.jpt.jpa.core.tests.internal.context;x-internal:=true,
org.eclipse.jpt.jpa.core.tests.internal.context.java;x-internal:=true,
org.eclipse.jpt.jpa.core.tests.internal.context.orm;x-internal:=true,
@@ -37,11 +39,8 @@ Export-Package: org.eclipse.jpt.jpa.core.tests;x-internal:=true,
org.eclipse.jpt.jpa.core.tests.internal.jpa2.context.orm;x-internal:=true,
org.eclipse.jpt.jpa.core.tests.internal.jpa2.context.persistence;x-internal:=true,
org.eclipse.jpt.jpa.core.tests.internal.jpa2.resource.java;x-internal:=true,
- org.eclipse.jpt.jpa.core.tests.internal.metadata;x-internal:=true,
org.eclipse.jpt.jpa.core.tests.internal.model;x-internal:=true,
org.eclipse.jpt.jpa.core.tests.internal.platform;x-internal:=true,
org.eclipse.jpt.jpa.core.tests.internal.projects;x-internal:=true,
org.eclipse.jpt.jpa.core.tests.internal.resource;x-internal:=true,
org.eclipse.jpt.jpa.core.tests.internal.resource.java;x-internal:=true
-Bundle-Activator: org.eclipse.jpt.jpa.core.tests.JptJpaCoreTestsPlugin
-Bundle-ActivationPolicy: lazy
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/JpaPreferencesTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/JpaPreferencesTests.java
new file mode 100644
index 0000000000..718d9aab2f
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/JpaPreferencesTests.java
@@ -0,0 +1,153 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.jpa.core.tests.internal;
+
+import org.eclipse.jpt.common.core.tests.PreferencesTests;
+import org.eclipse.jpt.jpa.core.JpaPreferences;
+import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
+
+/**
+ * <strong>NB:</strong> These tests are to test for backward-compatibility!
+ * That is, there are testing to make sure preferences are stored in their
+ * <em>original</em> location from release to release. Thus the hard-coded
+ * file names, preference keys, etc.
+ */
+@SuppressWarnings("nls")
+public class JpaPreferencesTests
+ extends PreferencesTests
+{
+ // DO NOT CHANGE THIS CONSTANT - as it is testing backward-compatibility
+ private static final String WORKSPACE_PREFS_FILE_NAME = "org.eclipse.jpt.core.prefs";
+
+ // DO NOT CHANGE THIS CONSTANT - as it is testing backward-compatibility
+ private static final String PROJECT_PREFS_FILE_NAME = "org.eclipse.jpt.core.prefs";
+
+
+ public JpaPreferencesTests(String name) {
+ super(name);
+ }
+
+
+ // ********** overrides **********
+
+ @Override
+ protected String getWorkspacePrefsFileName() {
+ return WORKSPACE_PREFS_FILE_NAME;
+ }
+
+ @Override
+ protected String getProjectPrefsFileName() {
+ return PROJECT_PREFS_FILE_NAME;
+ }
+
+ @Override
+ protected Class<?> getPreferencesClass() {
+ return JpaPreferences.class;
+ }
+
+
+ // ********** tests **********
+
+ public void testJpaPlatformID() throws Exception {
+ String value = "FOO";
+ JpaPreferences.setJpaPlatformID(this.getProject(), value);
+ this.flushProjectPrefs();
+ assertEquals(value, JpaPreferences.getJpaPlatformID(this.getProject()));
+ assertEquals(value, this.readProjectPrefs().getProperty(JPA_PLATFORM));
+ }
+ // DO NOT CHANGE THIS CONSTANT - as it is testing backward-compatibility
+ private static final String JPA_PLATFORM = "org.eclipse.jpt.core.platform";
+
+ public void testDiscoverAnnotatedClasses() throws Exception {
+ JpaPreferences.setDiscoverAnnotatedClasses(this.getProject(), true);
+ this.flushProjectPrefs();
+ assertTrue(JpaPreferences.getDiscoverAnnotatedClasses(this.getProject()));
+ assertTrue(Boolean.parseBoolean(this.readProjectPrefs().getProperty(DISCOVER_ANNOTATED_CLASSES)));
+ }
+ // DO NOT CHANGE THIS CONSTANT - as it is testing backward-compatibility
+ private static final String DISCOVER_ANNOTATED_CLASSES = "org.eclipse.jpt.jpa.core.discoverAnnotatedClasses";
+
+ public void testMetamodelSourceFolderName() throws Exception {
+ String value = "gen";
+ JpaPreferences.setMetamodelSourceFolderName(this.getProject(), value);
+ this.flushProjectPrefs();
+ assertEquals(value, JpaPreferences.getMetamodelSourceFolderName(this.getProject()));
+ assertEquals(value, this.readProjectPrefs().getProperty(METAMODEL_SOURCE_FOLDER_NAME));
+ }
+ // DO NOT CHANGE THIS CONSTANT - as it is testing backward-compatibility
+ private static final String METAMODEL_SOURCE_FOLDER_NAME = "org.eclipse.jpt.jpa.core.metamodelSourceFolderName";
+
+ public void testEntityGenDefaultPackageName_Project() throws Exception {
+ String value = "entitygen";
+ JpaPreferences.setEntityGenDefaultPackageName(this.getProject(), value);
+ this.flushProjectPrefs();
+ assertEquals(value, JpaPreferences.getEntityGenDefaultPackageName(this.getProject()));
+ assertEquals(value, this.readProjectPrefs().getProperty(ENTITY_GEN_DEFAULT_PACKAGE_NAME));
+ }
+ // DO NOT CHANGE THIS CONSTANT - as it is testing backward-compatibility
+ private static final String ENTITY_GEN_DEFAULT_PACKAGE_NAME = "entitygen.DEFAULT_PACKAGE";
+
+ public void testEntityGenDefaultPackageName_Workspace() throws Exception {
+ String value = "wsentitygen";
+ JpaPreferences.setEntityGenDefaultPackageName(value);
+ this.flushWorkspacePrefs();
+ // verify workspace pref affects project-level pref
+ assertEquals(value, JpaPreferences.getEntityGenDefaultPackageName(this.getProject()));
+ assertEquals(value, JpaPreferences.getEntityGenDefaultPackageName());
+ assertEquals(value, this.readWorkspacePrefs().getProperty(ENTITY_GEN_DEFAULT_PACKAGE_NAME));
+ }
+
+ public void testJpqlIdentifierLowercase() throws Exception {
+ JpaPreferences.setJpqlIdentifierLowercase(false);
+ this.flushWorkspacePrefs();
+ assertFalse(JpaPreferences.getJpqlIdentifierLowercase());
+ assertEquals("uppercase", this.readWorkspacePrefs().getProperty(JPQL_IDENTIFIER_CASE));
+ }
+ // DO NOT CHANGE THIS CONSTANT - as it is testing backward-compatibility
+ private static final String JPQL_IDENTIFIER_CASE = "jpqlIdentifier.CASE";
+
+ public void testJpqlIdentifierMatchFirstCharacterCase() throws Exception {
+ JpaPreferences.setJpqlIdentifierMatchFirstCharacterCase(false);
+ this.flushWorkspacePrefs();
+ assertFalse(JpaPreferences.getJpqlIdentifierMatchFirstCharacterCase());
+ assertFalse(Boolean.parseBoolean(this.readWorkspacePrefs().getProperty(JPQL_IDENTIFIER_MATCH_FIRST_CHARACTER_CASE)));
+ }
+ // DO NOT CHANGE THIS CONSTANT - as it is testing backward-compatibility
+ private static final String JPQL_IDENTIFIER_MATCH_FIRST_CHARACTER_CASE = "jpqlIdentifier.MATCH_FIRST_CHARACTER_CASE";
+
+ public void testWorkspaceValidationPreferencesOverridden() throws Exception {
+ JpaPreferences.setWorkspaceValidationPreferencesOverridden(this.getProject(), true);
+ this.flushProjectPrefs();
+ assertTrue(JpaPreferences.getWorkspaceValidationPreferencesOverridden(this.getProject()));
+ assertTrue(Boolean.parseBoolean(this.readProjectPrefs().getProperty(WORKSPACE_PREFERENCES_OVERRIDDEN)));
+ }
+ // DO NOT CHANGE THIS CONSTANT - as it is testing backward-compatibility
+ private static final String WORKSPACE_PREFERENCES_OVERRIDDEN = "workspace_preferences_overriden";
+
+ public void testProblemSeverity_Project() throws Exception {
+ String value = JpaPreferences.PROBLEM_INFO;
+ JpaPreferences.setProblemSeverity(this.getProject(), JpaValidationMessages.NO_JPA_PROJECT, value);
+ this.flushProjectPrefs();
+ assertEquals(value, JpaPreferences.getProblemSeverity(this.getProject(), JpaValidationMessages.NO_JPA_PROJECT));
+ assertEquals(value, this.readProjectPrefs().getProperty(PROBLEM_NO_JPA_PROJECT));
+ }
+ // DO NOT CHANGE THIS CONSTANT - as it is testing backward-compatibility
+ private static final String PROBLEM_NO_JPA_PROJECT = "problem.NO_JPA_PROJECT";
+
+ public void testProblemSeverity_Workspace() throws Exception {
+ String value = JpaPreferences.PROBLEM_WARNING;
+ JpaPreferences.setProblemSeverity(JpaValidationMessages.NO_JPA_PROJECT, value);
+ this.flushWorkspacePrefs();
+ // verify workspace pref affects project-level pref
+ assertEquals(value, JpaPreferences.getProblemSeverity(this.getProject(), JpaValidationMessages.NO_JPA_PROJECT));
+ assertEquals(value, JpaPreferences.getProblemSeverity(JpaValidationMessages.NO_JPA_PROJECT));
+ assertEquals(value, this.readWorkspacePrefs().getProperty(PROBLEM_NO_JPA_PROJECT));
+ }
+}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/JptJpaCoreMiscTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/JptJpaCoreMiscTests.java
new file mode 100644
index 0000000000..a98ed288cb
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/JptJpaCoreMiscTests.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.jpa.core.tests.internal;
+
+import org.eclipse.jpt.common.core.tests.BundleActivatorTest;
+import org.eclipse.jpt.jpa.core.JpaProject;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class JptJpaCoreMiscTests {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(JptJpaCoreMiscTests.class.getPackage().getName());
+ suite.addTestSuite(JpaPreferencesTests.class);
+ suite.addTest(new BundleActivatorTest(JpaProject.class));
+ return suite;
+ }
+
+ private JptJpaCoreMiscTests() {
+ super();
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/JptJpaCoreTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/JptJpaCoreTests.java
index 85e0c1a8a5..66fc134f96 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/JptJpaCoreTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/JptJpaCoreTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2012 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.
@@ -13,28 +13,30 @@ import java.io.File;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.eclipse.jpt.jpa.core.tests.internal.context.JptJpaCoreContextModelTests;
-import org.eclipse.jpt.jpa.core.tests.internal.metadata.JptJpaCoreMetadataTests;
import org.eclipse.jpt.jpa.core.tests.internal.model.JptJpaCoreModelTests;
import org.eclipse.jpt.jpa.core.tests.internal.projects.TestJpaProject;
import org.eclipse.jpt.jpa.core.tests.internal.resource.JptJpaCoreResourceModelTests;
/**
* decentralize test creation code
- *
- * Required Java system property:
- * -Dorg.eclipse.jpt.jpa.jar=<jpa.jar path>
+ * <p>
+ * Required Java system properties:<code><ul>
+ * <li>-Dorg.eclipse.jpt.jpa.jar=&lt;jpa.jar path&gt;
+ * </ul></code>
*/
@SuppressWarnings("nls")
public class JptJpaCoreTests {
private static final String JPA_JAR_PROPERTY = TestJpaProject.JPA_JAR_NAME_SYSTEM_PROPERTY;
public static Test suite() {
+ // ***** keep test.xml in sync with this list *****
+ // test.xml is split up because this test suite was taking too
+ // long and triggering a time-out during the WTP build
TestSuite suite = new TestSuite(JptJpaCoreTests.class.getPackage().getName());
- //****If you add a new suite, you must update test.xml where they are individually listed.
suite.addTest(JptJpaCoreModelTests.suite());
suite.addTest(JptJpaCoreResourceModelTests.suite());
suite.addTest(JptJpaCoreContextModelTests.suite());
- suite.addTest(JptJpaCoreMetadataTests.suite());
+ suite.addTest(JptJpaCoreMiscTests.suite());
return suite;
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/MiscTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/MiscTests.java
index f0ce85043d..a583665175 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/MiscTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/MiscTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2012 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.jpa.core.tests;
+package org.eclipse.jpt.jpa.core.tests.internal;
import junit.framework.TestCase;
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/ContextModelTestCase.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/ContextModelTestCase.java
index f79ef43756..ffd20dc18a 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/ContextModelTestCase.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/ContextModelTestCase.java
@@ -18,9 +18,9 @@ import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.jpt.common.core.tests.internal.projects.TestJavaProject;
import org.eclipse.jpt.common.core.tests.internal.utility.jdt.AnnotationTestCase;
-import org.eclipse.jpt.jpa.core.JpaFacet;
+import org.eclipse.jpt.jpa.core.JpaPreferences;
import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.JpaWorkspace;
import org.eclipse.jpt.jpa.core.context.JpaRootContextNode;
import org.eclipse.jpt.jpa.core.context.MappingFile;
import org.eclipse.jpt.jpa.core.context.java.JavaEntity;
@@ -28,12 +28,12 @@ import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
import org.eclipse.jpt.jpa.core.context.orm.EntityMappings;
import org.eclipse.jpt.jpa.core.context.persistence.ClassRef;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
+import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatformFactory;
import org.eclipse.jpt.jpa.core.internal.facet.JpaFacetDataModelProperties;
import org.eclipse.jpt.jpa.core.internal.facet.JpaFacetInstallDataModelProperties;
import org.eclipse.jpt.jpa.core.internal.facet.JpaFacetInstallDataModelProvider;
-import org.eclipse.jpt.jpa.core.internal.prefs.JpaPreferencesManager;
-import org.eclipse.jpt.jpa.core.platform.GenericPlatform;
import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
+import org.eclipse.jpt.jpa.core.platform.JpaPlatformManager;
import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlJavaClassRef;
@@ -73,14 +73,14 @@ public abstract class ContextModelTestCase extends AnnotationTestCase
protected void tearDown() throws Exception {
this.persistenceXmlResource = null;
this.ormXmlResource = null;
- JpaPreferencesManager.clearWorkspacePreferences();
+ JpaPreferences.removePreferences();
this.waitForWorkspaceJobsToFinish();
super.tearDown();
}
@Override
protected TestJavaProject buildJavaProject(boolean autoBuild) throws Exception {
- return buildJpaProject(BASE_PROJECT_NAME, autoBuild, buildJpaConfigDataModel());
+ return buildJpaProject(BASE_PROJECT_NAME, autoBuild, this.buildJpaConfigDataModel());
}
protected TestJpaProject buildJpaProject(String projectName, boolean autoBuild, IDataModel jpaConfig)
@@ -96,14 +96,26 @@ public abstract class ContextModelTestCase extends AnnotationTestCase
return dataModel;
}
- // default facet version is 2.0 - most tests use 1.0
+ // default facet version is the latest version - but most tests use 1.0
protected String getJpaFacetVersionString() {
- return JpaFacet.VERSION_1_0.getVersionString();
+ return JpaProject.FACET_VERSION_STRING;
}
// most tests use the basic generic platform
protected JpaPlatformDescription getJpaPlatformDescription() {
- return GenericPlatform.VERSION_1_0;
+ return this.getJpaPlatformManager().getJpaPlatformDescription(this.getJpaPlatformID());
+ }
+
+ protected String getJpaPlatformID() {
+ return GenericJpaPlatformFactory.ID;
+ }
+
+ protected JpaPlatformManager getJpaPlatformManager() {
+ return this.getJpaWorkspace().getJpaPlatformManager();
+ }
+
+ protected JpaWorkspace getJpaWorkspace() {
+ return (JpaWorkspace) ResourcesPlugin.getWorkspace().getAdapter(JpaWorkspace.class);
}
// most tests do use an orm.xml
@@ -175,7 +187,7 @@ public abstract class ContextModelTestCase extends AnnotationTestCase
}
protected PersistenceUnit getPersistenceUnit() {
- return getRootContextNode().getPersistenceXml().getPersistence().getPersistenceUnits().iterator().next();
+ return getRootContextNode().getPersistenceXml().getRoot().getPersistenceUnits().iterator().next();
}
protected ClassRef getSpecifiedClassRef() {
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/JpaFileTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/JpaFileTests.java
index a1f71f623d..392cd9e014 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/JpaFileTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/JpaFileTests.java
@@ -16,7 +16,6 @@ import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
import org.eclipse.jpt.jpa.core.JpaFile;
import org.eclipse.jpt.jpa.core.JpaNode;
import org.eclipse.jpt.jpa.core.JpaStructureNode;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
import org.eclipse.jpt.jpa.core.context.orm.EntityMappings;
@@ -24,6 +23,7 @@ import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
import org.eclipse.jpt.jpa.core.context.persistence.ClassRef;
import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
@@ -40,7 +40,7 @@ public class JpaFileTests
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ mappingFileRef.setFileName(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
@@ -147,7 +147,7 @@ public class JpaFileTests
public void testUpdatePersistenceRootStructureNodePersistenceRemoved() throws Exception {
IFile file = getPersistenceXmlResource().getFile();
JpaFile persistenceXmlJpaFile = this.getJpaFile(file);
- assertEquals(getRootContextNode().getPersistenceXml().getPersistence(), persistenceXmlJpaFile.getRootStructureNodes().iterator().next());
+ assertEquals(getRootContextNode().getPersistenceXml().getRoot(), persistenceXmlJpaFile.getRootStructureNodes().iterator().next());
JpaXmlResource resource = (JpaXmlResource) persistenceXmlJpaFile.getResourceModel();
resource.getContents().remove(resource.getRootObject());
@@ -190,8 +190,8 @@ public class JpaFileTests
public void testPersistenceRootStructureNodeRemovedFromResourceModel() throws Exception {
IFile file = getPersistenceXmlResource().getFile();
JpaFile persistenceXmlJpaFile = this.getJpaFile(file);
- getRootContextNode().getPersistenceXml().getPersistence();
- assertEquals(getRootContextNode().getPersistenceXml().getPersistence(), persistenceXmlJpaFile.getRootStructureNodes().iterator().next());
+ getRootContextNode().getPersistenceXml().getRoot();
+ assertEquals(getRootContextNode().getPersistenceXml().getRoot(), persistenceXmlJpaFile.getRootStructureNodes().iterator().next());
getPersistenceXmlResource().getContents().remove(getXmlPersistence());
@@ -347,7 +347,7 @@ public class JpaFileTests
JavaPersistentType javaPersistentType = ormPersistentType.getJavaPersistentType();
assertEquals(javaPersistentType, javaJpaFile.getRootStructureNodes().iterator().next());
- getJpaProject().getRootContextNode().getPersistenceXml().getPersistence().removePersistenceUnit(0);
+ getJpaProject().getRootContextNode().getPersistenceXml().getRoot().removePersistenceUnit(0);
assertFalse(javaJpaFile.getRootStructureNodes().iterator().hasNext());
assertEquals(0, javaJpaFile.getRootStructureNodesSize());
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/JpaProjectTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/JpaProjectTests.java
index 9d161a60e5..51bf4ffe5c 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/JpaProjectTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/JpaProjectTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2012 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.
@@ -10,17 +10,21 @@
package org.eclipse.jpt.jpa.core.tests.internal.context;
import junit.framework.TestCase;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Path;
import org.eclipse.jpt.common.core.internal.operations.JptFileCreationDataModelProperties;
-import org.eclipse.jpt.jpa.core.JpaFacet;
import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.JpaWorkspace;
+import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatformFactory;
import org.eclipse.jpt.jpa.core.internal.facet.JpaFacetDataModelProperties;
import org.eclipse.jpt.jpa.core.internal.facet.JpaFacetInstallDataModelProperties;
import org.eclipse.jpt.jpa.core.internal.facet.JpaFacetInstallDataModelProvider;
import org.eclipse.jpt.jpa.core.internal.operations.OrmFileCreationDataModelProvider;
import org.eclipse.jpt.jpa.core.internal.operations.PersistenceFileCreationDataModelProvider;
-import org.eclipse.jpt.jpa.core.platform.GenericPlatform;
+import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
+import org.eclipse.jpt.jpa.core.platform.JpaPlatformManager;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
+import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistence;
import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
import org.eclipse.jpt.jpa.core.tests.internal.projects.TestJpaProject;
import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetDataModelProperties;
@@ -28,7 +32,8 @@ import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
@SuppressWarnings("nls")
-public class JpaProjectTests extends TestCase
+public class JpaProjectTests
+ extends TestCase
{
static final String BASE_PROJECT_NAME = JpaProjectTests.class.getSimpleName();
@@ -47,12 +52,24 @@ public class JpaProjectTests extends TestCase
protected IDataModel buildJpaConfigDataModel() {
IDataModel dataModel = DataModelFactory.createDataModel(new JpaFacetInstallDataModelProvider());
- dataModel.setProperty(IFacetDataModelProperties.FACET_VERSION_STR, JpaFacet.VERSION_1_0.getVersionString());
- dataModel.setProperty(JpaFacetDataModelProperties.PLATFORM, GenericPlatform.VERSION_1_0);
+ dataModel.setProperty(IFacetDataModelProperties.FACET_VERSION_STR, JpaProject.FACET_VERSION_STRING);
+ dataModel.setProperty(JpaFacetDataModelProperties.PLATFORM, this.getJpaPlatformDescription());
dataModel.setProperty(JpaFacetInstallDataModelProperties.CREATE_ORM_XML, Boolean.TRUE);
return dataModel;
}
-
+
+ protected JpaPlatformDescription getJpaPlatformDescription() {
+ return this.getJpaPlatformManager().getJpaPlatformDescription(GenericJpaPlatformFactory.ID);
+ }
+
+ protected JpaPlatformManager getJpaPlatformManager() {
+ return this.getJpaWorkspace().getJpaPlatformManager();
+ }
+
+ protected JpaWorkspace getJpaWorkspace() {
+ return (JpaWorkspace) ResourcesPlugin.getWorkspace().getAdapter(JpaWorkspace.class);
+ }
+
@Override
protected void tearDown() throws Exception {
this.jpaProject.getProject().delete(true, true, null);
@@ -67,7 +84,7 @@ public class JpaProjectTests extends TestCase
public void testGetPersistenceXmlResource() throws Exception {
JpaXmlResource resource = this.getJpaProject().getPersistenceXmlResource();
assertNotNull(resource);
- assertEquals(JptJpaCorePlugin.PERSISTENCE_XML_CONTENT_TYPE, resource.getContentType());
+ assertEquals(XmlPersistence.CONTENT_TYPE, resource.getContentType());
assertEquals("src/META-INF/persistence.xml", resource.getFile().getProjectRelativePath().toString());
//delete the persistence.xml file and verify it is not returned from getPersistenceXmlResource()
@@ -79,7 +96,7 @@ public class JpaProjectTests extends TestCase
createPersistenceXmlFile();
resource = this.getJpaProject().getPersistenceXmlResource();
assertNotNull(resource);
- assertEquals(JptJpaCorePlugin.PERSISTENCE_XML_CONTENT_TYPE, resource.getContentType());
+ assertEquals(XmlPersistence.CONTENT_TYPE, resource.getContentType());
assertEquals("src/META-INF/persistence.xml", resource.getFile().getProjectRelativePath().toString());
}
@@ -94,7 +111,7 @@ public class JpaProjectTests extends TestCase
public void testGetDefaultOrmXmlResource() throws Exception {
JpaXmlResource resource = this.getJpaProject().getDefaultOrmXmlResource();
assertNotNull(resource);
- assertEquals(JptJpaCorePlugin.ORM_XML_CONTENT_TYPE, resource.getContentType());
+ assertEquals(XmlEntityMappings.CONTENT_TYPE, resource.getContentType());
assertEquals("src/META-INF/orm.xml", resource.getFile().getProjectRelativePath().toString());
//delete the orm.xml file and verify it is not returned from getDefaultOrmXmlResource()
@@ -106,7 +123,7 @@ public class JpaProjectTests extends TestCase
createDefaultOrmXmlFile();
resource = this.getJpaProject().getDefaultOrmXmlResource();
assertNotNull(resource);
- assertEquals(JptJpaCorePlugin.ORM_XML_CONTENT_TYPE, resource.getContentType());
+ assertEquals(XmlEntityMappings.CONTENT_TYPE, resource.getContentType());
assertEquals("src/META-INF/orm.xml", resource.getFile().getProjectRelativePath().toString());
}
@@ -128,21 +145,21 @@ public class JpaProjectTests extends TestCase
}
public void testGetMappingFileResource() throws Exception {
- JpaXmlResource resource = this.getJpaProject().getMappingFileXmlResource(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH);
+ JpaXmlResource resource = this.getJpaProject().getMappingFileXmlResource(XmlEntityMappings.DEFAULT_RUNTIME_PATH);
assertNotNull(resource);
- assertEquals(JptJpaCorePlugin.ORM_XML_CONTENT_TYPE, resource.getContentType());
+ assertEquals(XmlEntityMappings.CONTENT_TYPE, resource.getContentType());
assertEquals("src/META-INF/orm.xml", resource.getFile().getProjectRelativePath().toString());
//delete the orm.xml file and verify it is not returned from getMappingFileResource()
resource.delete(null);
- resource = this.getJpaProject().getMappingFileXmlResource(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH);
+ resource = this.getJpaProject().getMappingFileXmlResource(XmlEntityMappings.DEFAULT_RUNTIME_PATH);
assertNull(resource);
//add the orm.xml file back
createDefaultOrmXmlFile();
- resource = this.getJpaProject().getMappingFileXmlResource(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH);
+ resource = this.getJpaProject().getMappingFileXmlResource(XmlEntityMappings.DEFAULT_RUNTIME_PATH);
assertNotNull(resource);
- assertEquals(JptJpaCorePlugin.ORM_XML_CONTENT_TYPE, resource.getContentType());
+ assertEquals(XmlEntityMappings.CONTENT_TYPE, resource.getContentType());
assertEquals("src/META-INF/orm.xml", resource.getFile().getProjectRelativePath().toString());
}
@@ -154,7 +171,7 @@ public class JpaProjectTests extends TestCase
createOrmXmlFile("orm2.xml");
resource = this.getJpaProject().getMappingFileXmlResource(new Path("META-INF/orm2.xml"));
assertNotNull(resource);
- assertEquals(JptJpaCorePlugin.ORM_XML_CONTENT_TYPE, resource.getContentType());
+ assertEquals(XmlEntityMappings.CONTENT_TYPE, resource.getContentType());
assertEquals("src/META-INF/orm2.xml", resource.getFile().getProjectRelativePath().toString());
//delete the orm2.xml file and verify it is not returned from getMappingFileResource()
@@ -166,7 +183,7 @@ public class JpaProjectTests extends TestCase
createOrmXmlFile("orm2.xml");
resource = this.getJpaProject().getMappingFileXmlResource(new Path("META-INF/orm2.xml"));
assertNotNull(resource);
- assertEquals(JptJpaCorePlugin.ORM_XML_CONTENT_TYPE, resource.getContentType());
+ assertEquals(XmlEntityMappings.CONTENT_TYPE, resource.getContentType());
assertEquals("src/META-INF/orm2.xml", resource.getFile().getProjectRelativePath().toString());
}
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/GenericJavaPersistentTypeTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/GenericJavaPersistentTypeTests.java
index 1d642c59a4..b8a7c05bac 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/GenericJavaPersistentTypeTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/GenericJavaPersistentTypeTests.java
@@ -21,7 +21,6 @@ import org.eclipse.jpt.common.utility.BooleanReference;
import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
import org.eclipse.jpt.jpa.core.JpaProjectManager;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.AccessType;
import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
@@ -35,6 +34,7 @@ import org.eclipse.jpt.jpa.core.internal.context.java.PropertyAccessor;
import org.eclipse.jpt.jpa.core.resource.java.EmbeddableAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.EntityAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
import org.eclipse.jpt.jpa.core.tests.internal.context.ContextModelTestCase;
@@ -47,7 +47,7 @@ public class GenericJavaPersistentTypeTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ mappingFileRef.setFileName(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaBasicMappingTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaBasicMappingTests.java
index 4675a60f81..bd1a4f1719 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaBasicMappingTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaBasicMappingTests.java
@@ -17,7 +17,6 @@ import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement.Kind;
import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.AccessType;
import org.eclipse.jpt.jpa.core.context.BasicMapping;
@@ -50,6 +49,7 @@ import org.eclipse.jpt.jpa.core.resource.java.OneToOneAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.TemporalAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.TransientAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.VersionAnnotation;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
import org.eclipse.jpt.jpa.core.tests.internal.context.ContextModelTestCase;
@@ -276,7 +276,7 @@ public class JavaBasicMappingTests extends ContextModelTestCase
protected void createOrmXmlFile() throws Exception {
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ mappingFileRef.setFileName(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaEntityTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaEntityTests.java
index 65d1d1bc53..54df198b2e 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaEntityTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaEntityTests.java
@@ -18,7 +18,6 @@ import org.eclipse.jpt.common.core.resource.java.NestableAnnotation;
import org.eclipse.jpt.common.core.tests.internal.projects.TestJavaProject.SourceWriter;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.AccessType;
import org.eclipse.jpt.jpa.core.context.AssociationOverride;
@@ -77,6 +76,7 @@ import org.eclipse.jpt.jpa.core.resource.java.SecondaryTableAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.SequenceGeneratorAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.TableAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.TableGeneratorAnnotation;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
import org.eclipse.jpt.jpa.core.tests.internal.context.ContextModelTestCase;
@@ -511,7 +511,7 @@ public class JavaEntityTests extends ContextModelTestCase
addXmlClassRef(PACKAGE_NAME_ + "AnnotationTestTypeChild");
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ mappingFileRef.setFileName(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
JavaPersistentType childPersistentType = getJavaPersistentType();
@@ -559,7 +559,7 @@ public class JavaEntityTests extends ContextModelTestCase
createTestEntityAnnotationOnProperty();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ mappingFileRef.setFileName(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
assertEquals(AccessType.PROPERTY, getJavaPersistentType().getAccess());
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaTableGeneratorTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaTableGeneratorTests.java
index f76929a311..791091153a 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaTableGeneratorTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaTableGeneratorTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 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.
@@ -16,7 +16,6 @@ import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement.Kind;
import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.Generator;
import org.eclipse.jpt.jpa.core.context.IdMapping;
@@ -29,6 +28,7 @@ import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
import org.eclipse.jpt.jpa.core.resource.java.TableGeneratorAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.UniqueConstraintAnnotation;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
import org.eclipse.jpt.jpa.core.tests.internal.context.ContextModelTestCase;
@@ -177,7 +177,7 @@ public class JavaTableGeneratorTests extends ContextModelTestCase
public void testUpdateDefaultSchemaFromPersistenceUnitDefaults() throws Exception {
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ mappingFileRef.setFileName(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
createTestEntityWithTableGenerator();
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaTableTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaTableTests.java
index bf56915960..8f1046bb41 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaTableTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaTableTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 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.
@@ -16,7 +16,6 @@ import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement.Kind;
import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.Entity;
import org.eclipse.jpt.jpa.core.context.InheritanceType;
@@ -30,6 +29,7 @@ import org.eclipse.jpt.jpa.core.context.persistence.ClassRef;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
import org.eclipse.jpt.jpa.core.resource.java.TableAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.UniqueConstraintAnnotation;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
import org.eclipse.jpt.jpa.core.tests.internal.context.ContextModelTestCase;
@@ -158,7 +158,7 @@ public class JavaTableTests extends ContextModelTestCase
public void testUpdateDefaultSchemaFromPersistenceUnitDefaults() throws Exception {
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ mappingFileRef.setFileName(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
createTestEntity();
@@ -278,7 +278,7 @@ public class JavaTableTests extends ContextModelTestCase
public void testUpdateDefaultCatalogFromPersistenceUnitDefaults() throws Exception {
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ mappingFileRef.setFileName(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
createTestEntity();
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/EntityMappingsTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/EntityMappingsTests.java
index 78e1c50bba..950518de85 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/EntityMappingsTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/EntityMappingsTests.java
@@ -10,7 +10,6 @@
package org.eclipse.jpt.jpa.core.tests.internal.context.orm;
import java.util.ListIterator;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.AccessType;
import org.eclipse.jpt.jpa.core.context.SequenceGenerator;
@@ -22,6 +21,7 @@ import org.eclipse.jpt.jpa.core.context.orm.OrmTableGenerator;
import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbeddable;
import org.eclipse.jpt.jpa.core.resource.orm.XmlEntity;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.orm.XmlMappedSuperclass;
import org.eclipse.jpt.jpa.core.resource.orm.XmlSequenceGenerator;
import org.eclipse.jpt.jpa.core.resource.orm.XmlTableGenerator;
@@ -40,7 +40,7 @@ public class EntityMappingsTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ mappingFileRef.setFileName(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/GenericOrmPersistentAttributeTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/GenericOrmPersistentAttributeTests.java
index 0d507b4a56..fc67e154d8 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/GenericOrmPersistentAttributeTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/GenericOrmPersistentAttributeTests.java
@@ -14,7 +14,6 @@ import java.util.ListIterator;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.AccessType;
import org.eclipse.jpt.jpa.core.context.BasicMapping;
@@ -27,6 +26,7 @@ import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyPersistentAttribute;
import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmIdMapping;
import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmOneToOneMapping;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
import org.eclipse.jpt.jpa.core.tests.internal.context.ContextModelTestCase;
@@ -42,7 +42,7 @@ public class GenericOrmPersistentAttributeTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ mappingFileRef.setFileName(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/GenericOrmPersistentTypeTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/GenericOrmPersistentTypeTests.java
index ecb6e4ad8e..31d9232e42 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/GenericOrmPersistentTypeTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/GenericOrmPersistentTypeTests.java
@@ -11,7 +11,6 @@ package org.eclipse.jpt.jpa.core.tests.internal.context.orm;
import java.util.Iterator;
import org.eclipse.jpt.common.core.tests.internal.projects.TestJavaProject.SourceWriter;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.BaseTemporalConverter;
import org.eclipse.jpt.jpa.core.context.TemporalType;
@@ -25,6 +24,7 @@ import org.eclipse.jpt.jpa.core.resource.orm.XmlBasic;
import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbedded;
import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbeddedId;
import org.eclipse.jpt.jpa.core.resource.orm.XmlEntity;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.orm.XmlId;
import org.eclipse.jpt.jpa.core.resource.orm.XmlManyToMany;
import org.eclipse.jpt.jpa.core.resource.orm.XmlManyToOne;
@@ -55,7 +55,7 @@ public class GenericOrmPersistentTypeTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ mappingFileRef.setFileName(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmAssociationOverrideTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmAssociationOverrideTests.java
index fd8da14991..2f32c0e6c2 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmAssociationOverrideTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmAssociationOverrideTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2012 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.
@@ -10,7 +10,6 @@
package org.eclipse.jpt.jpa.core.tests.internal.context.orm;
import java.util.ListIterator;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverride;
import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverrideContainer;
@@ -21,6 +20,7 @@ import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
import org.eclipse.jpt.jpa.core.resource.orm.XmlAssociationOverride;
import org.eclipse.jpt.jpa.core.resource.orm.XmlEntity;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
import org.eclipse.jpt.jpa.core.tests.internal.context.ContextModelTestCase;
@@ -36,7 +36,7 @@ public class OrmAssociationOverrideTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ mappingFileRef.setFileName(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmAttributeOverrideTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmAttributeOverrideTests.java
index a2879c6303..f498d09200 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmAttributeOverrideTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmAttributeOverrideTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 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.
@@ -9,7 +9,6 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.tests.internal.context.orm;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeOverride;
import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeOverrideContainer;
@@ -18,6 +17,7 @@ import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeOverride;
import org.eclipse.jpt.jpa.core.resource.orm.XmlEntity;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
import org.eclipse.jpt.jpa.core.tests.internal.context.ContextModelTestCase;
@@ -33,7 +33,7 @@ public class OrmAttributeOverrideTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ mappingFileRef.setFileName(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmBasicMappingTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmBasicMappingTests.java
index 90467e1087..a7b411b410 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmBasicMappingTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmBasicMappingTests.java
@@ -12,7 +12,6 @@ package org.eclipse.jpt.jpa.core.tests.internal.context.orm;
import java.util.Iterator;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.BasicMapping;
import org.eclipse.jpt.jpa.core.context.Column;
@@ -38,6 +37,7 @@ import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyPersistentAttribute;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
import org.eclipse.jpt.jpa.core.resource.orm.XmlBasic;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
import org.eclipse.jpt.jpa.core.tests.internal.context.ContextModelTestCase;
@@ -53,7 +53,7 @@ public class OrmBasicMappingTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ mappingFileRef.setFileName(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmCascadeTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmCascadeTests.java
index e22566cfc9..fa71c9d176 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmCascadeTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmCascadeTests.java
@@ -9,13 +9,13 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.tests.internal.context.orm;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.Cascade;
import org.eclipse.jpt.jpa.core.context.orm.OrmOneToOneMapping;
import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.orm.XmlOneToOne;
import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
@@ -33,7 +33,7 @@ public class OrmCascadeTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ mappingFileRef.setFileName(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmColumnTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmColumnTests.java
index a903d3793f..9d5e9cfd3b 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmColumnTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmColumnTests.java
@@ -12,7 +12,6 @@ package org.eclipse.jpt.jpa.core.tests.internal.context.orm;
import java.util.Iterator;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.BasicMapping;
import org.eclipse.jpt.jpa.core.context.Column;
@@ -29,6 +28,7 @@ import org.eclipse.jpt.jpa.core.resource.java.JPA;
import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
import org.eclipse.jpt.jpa.core.resource.orm.XmlBasic;
import org.eclipse.jpt.jpa.core.resource.orm.XmlEntity;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
import org.eclipse.jpt.jpa.core.tests.internal.context.ContextModelTestCase;
@@ -44,7 +44,7 @@ public class OrmColumnTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ mappingFileRef.setFileName(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmDiscriminatorColumnTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmDiscriminatorColumnTests.java
index ba52aa35f2..d8c87d21fd 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmDiscriminatorColumnTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmDiscriminatorColumnTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 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.
@@ -10,7 +10,6 @@
package org.eclipse.jpt.jpa.core.tests.internal.context.orm;
import org.eclipse.jpt.common.core.tests.internal.projects.TestJavaProject.SourceWriter;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.DiscriminatorColumn;
import org.eclipse.jpt.jpa.core.context.DiscriminatorType;
@@ -22,6 +21,7 @@ import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
import org.eclipse.jpt.jpa.core.resource.orm.XmlEntity;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
import org.eclipse.jpt.jpa.core.tests.internal.context.ContextModelTestCase;
@@ -37,7 +37,7 @@ public class OrmDiscriminatorColumnTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ mappingFileRef.setFileName(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmEmbeddableTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmEmbeddableTests.java
index af963c394f..0e554c87dc 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmEmbeddableTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmEmbeddableTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 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.
@@ -10,7 +10,6 @@
package org.eclipse.jpt.jpa.core.tests.internal.context.orm;
import java.util.ListIterator;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.AccessType;
import org.eclipse.jpt.jpa.core.context.orm.OrmEmbeddable;
@@ -20,6 +19,7 @@ import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbeddable;
import org.eclipse.jpt.jpa.core.resource.orm.XmlEntity;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.orm.XmlMappedSuperclass;
import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
@@ -37,7 +37,7 @@ public class OrmEmbeddableTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ mappingFileRef.setFileName(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmEmbeddedIdMappingTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmEmbeddedIdMappingTests.java
index 7ed015db80..c930821437 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmEmbeddedIdMappingTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmEmbeddedIdMappingTests.java
@@ -14,7 +14,6 @@ import java.util.ListIterator;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jpt.common.core.tests.internal.projects.TestJavaProject.SourceWriter;
import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.AttributeOverride;
import org.eclipse.jpt.jpa.core.context.BasicMapping;
@@ -44,6 +43,7 @@ import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualAttributeOverride;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbeddedId;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
import org.eclipse.jpt.jpa.core.tests.internal.context.ContextModelTestCase;
@@ -62,7 +62,7 @@ public class OrmEmbeddedIdMappingTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ mappingFileRef.setFileName(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmEmbeddedMappingTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmEmbeddedMappingTests.java
index 21809cb787..617110fbfd 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmEmbeddedMappingTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmEmbeddedMappingTests.java
@@ -14,7 +14,6 @@ import java.util.ListIterator;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jpt.common.core.tests.internal.projects.TestJavaProject.SourceWriter;
import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.AttributeOverride;
import org.eclipse.jpt.jpa.core.context.BasicMapping;
@@ -44,6 +43,7 @@ import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualAttributeOverride;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbedded;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
import org.eclipse.jpt.jpa.core.tests.internal.context.ContextModelTestCase;
@@ -62,7 +62,7 @@ public class OrmEmbeddedMappingTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ mappingFileRef.setFileName(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmEntityTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmEntityTests.java
index dc697f1239..6faa9c0414 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmEntityTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmEntityTests.java
@@ -15,7 +15,6 @@ import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jpt.common.core.tests.internal.projects.TestJavaProject.SourceWriter;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.AccessType;
import org.eclipse.jpt.jpa.core.context.BasicMapping;
@@ -60,6 +59,7 @@ import org.eclipse.jpt.jpa.core.resource.java.JPA;
import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbeddable;
import org.eclipse.jpt.jpa.core.resource.orm.XmlEntity;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.orm.XmlMappedSuperclass;
import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
@@ -81,7 +81,7 @@ public class OrmEntityTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ mappingFileRef.setFileName(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmGeneratedValueTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmGeneratedValueTests.java
index aab3848225..1371f72ae8 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmGeneratedValueTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmGeneratedValueTests.java
@@ -12,7 +12,6 @@ package org.eclipse.jpt.jpa.core.tests.internal.context.orm;
import java.util.Iterator;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.GeneratedValue;
import org.eclipse.jpt.jpa.core.context.GenerationType;
@@ -23,6 +22,7 @@ import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyPersistentAttribute;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.orm.XmlGeneratedValue;
import org.eclipse.jpt.jpa.core.resource.orm.XmlId;
import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
@@ -40,7 +40,7 @@ import org.eclipse.jpt.jpa.core.tests.internal.context.ContextModelTestCase;
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ mappingFileRef.setFileName(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmIdMappingTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmIdMappingTests.java
index 9f8e6a8197..2fe0b2ccb2 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmIdMappingTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmIdMappingTests.java
@@ -12,7 +12,6 @@ package org.eclipse.jpt.jpa.core.tests.internal.context.orm;
import java.util.Iterator;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.BasicMapping;
import org.eclipse.jpt.jpa.core.context.Column;
@@ -38,6 +37,7 @@ import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyPersistentAttribute;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.orm.XmlId;
import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
@@ -55,7 +55,7 @@ public class OrmIdMappingTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ mappingFileRef.setFileName(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmJoinColumnTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmJoinColumnTests.java
index 10a3c111c4..e7c10b406a 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmJoinColumnTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmJoinColumnTests.java
@@ -9,13 +9,13 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.tests.internal.context.orm;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumn;
import org.eclipse.jpt.jpa.core.context.orm.OrmJoinTable;
import org.eclipse.jpt.jpa.core.context.orm.OrmManyToManyMapping;
import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinColumn;
import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinTable;
import org.eclipse.jpt.jpa.core.resource.orm.XmlManyToMany;
@@ -34,7 +34,7 @@ public class OrmJoinColumnTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ mappingFileRef.setFileName(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmJoinTableTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmJoinTableTests.java
index b689dc22b6..9021492b81 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmJoinTableTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmJoinTableTests.java
@@ -14,7 +14,6 @@ import java.util.ListIterator;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jpt.common.core.tests.internal.projects.TestJavaProject.SourceWriter;
import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.IdMapping;
import org.eclipse.jpt.jpa.core.context.JoinColumn;
@@ -38,6 +37,7 @@ import org.eclipse.jpt.jpa.core.context.orm.OrmUniqueConstraint;
import org.eclipse.jpt.jpa.core.internal.context.orm.VirtualOrmPersistentAttribute;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinTable;
import org.eclipse.jpt.jpa.core.resource.orm.XmlManyToMany;
import org.eclipse.jpt.jpa.core.resource.orm.XmlUniqueConstraint;
@@ -56,7 +56,7 @@ public class OrmJoinTableTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ mappingFileRef.setFileName(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmManyToManyMappingTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmManyToManyMappingTests.java
index 883ca5cd2e..31039452b0 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmManyToManyMappingTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmManyToManyMappingTests.java
@@ -13,7 +13,6 @@ import java.util.Iterator;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jpt.common.core.tests.internal.projects.TestJavaProject.SourceWriter;
import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.AttributeMapping;
import org.eclipse.jpt.jpa.core.context.BasicMapping;
@@ -41,6 +40,7 @@ import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyPersistentAttribute;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
import org.eclipse.jpt.jpa.core.resource.orm.XmlEntity;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.orm.XmlManyToMany;
import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
@@ -251,7 +251,7 @@ public class OrmManyToManyMappingTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ mappingFileRef.setFileName(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmManyToOneMappingTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmManyToOneMappingTests.java
index 45c19e442b..37df6bb250 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmManyToOneMappingTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmManyToOneMappingTests.java
@@ -14,7 +14,6 @@ import java.util.ListIterator;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jpt.common.core.tests.internal.projects.TestJavaProject.SourceWriter;
import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.Cascade;
import org.eclipse.jpt.jpa.core.context.FetchType;
@@ -30,6 +29,7 @@ import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyPersistentAttribute;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
import org.eclipse.jpt.jpa.core.resource.orm.XmlEntity;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.orm.XmlManyToOne;
import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
@@ -46,7 +46,7 @@ public class OrmManyToOneMappingTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ mappingFileRef.setFileName(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmMappedSuperclassTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmMappedSuperclassTests.java
index f778dc33ec..048045c7a9 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmMappedSuperclassTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmMappedSuperclassTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 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.
@@ -11,7 +11,6 @@ package org.eclipse.jpt.jpa.core.tests.internal.context.orm;
import java.util.ListIterator;
import org.eclipse.jpt.common.core.tests.internal.projects.TestJavaProject.SourceWriter;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.AccessType;
import org.eclipse.jpt.jpa.core.context.IdClassReference;
@@ -22,6 +21,7 @@ import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbeddable;
import org.eclipse.jpt.jpa.core.resource.orm.XmlEntity;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.orm.XmlMappedSuperclass;
import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
@@ -39,7 +39,7 @@ public class OrmMappedSuperclassTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ mappingFileRef.setFileName(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmNamedNativeQueryTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmNamedNativeQueryTests.java
index f5bcbe0f55..177f75721a 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmNamedNativeQueryTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmNamedNativeQueryTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 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.
@@ -10,13 +10,13 @@
package org.eclipse.jpt.jpa.core.tests.internal.context.orm;
import java.util.ListIterator;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.orm.OrmEntity;
import org.eclipse.jpt.jpa.core.context.orm.OrmNamedNativeQuery;
import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
import org.eclipse.jpt.jpa.core.context.orm.OrmQueryHint;
import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.orm.XmlNamedNativeQuery;
import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
@@ -34,7 +34,7 @@ public class OrmNamedNativeQueryTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ mappingFileRef.setFileName(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmNamedQueryTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmNamedQueryTests.java
index 61c3126611..c86db54fd7 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmNamedQueryTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmNamedQueryTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 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.
@@ -10,13 +10,13 @@
package org.eclipse.jpt.jpa.core.tests.internal.context.orm;
import java.util.ListIterator;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.orm.OrmEntity;
import org.eclipse.jpt.jpa.core.context.orm.OrmNamedQuery;
import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
import org.eclipse.jpt.jpa.core.context.orm.OrmQueryHint;
import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.orm.XmlNamedQuery;
import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
@@ -34,7 +34,7 @@ public class OrmNamedQueryTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ mappingFileRef.setFileName(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmOneToManyMappingTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmOneToManyMappingTests.java
index 251000ad4c..a4dff8f2f7 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmOneToManyMappingTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmOneToManyMappingTests.java
@@ -13,7 +13,6 @@ import java.util.Iterator;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jpt.common.core.tests.internal.projects.TestJavaProject.SourceWriter;
import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.AttributeMapping;
import org.eclipse.jpt.jpa.core.context.BasicMapping;
@@ -41,6 +40,7 @@ import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyPersistentAttribute;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
import org.eclipse.jpt.jpa.core.resource.orm.XmlEntity;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.orm.XmlOneToMany;
import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
@@ -226,7 +226,7 @@ public class OrmOneToManyMappingTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ mappingFileRef.setFileName(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmOneToOneMappingTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmOneToOneMappingTests.java
index 39b5f335ed..0e5067269a 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmOneToOneMappingTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmOneToOneMappingTests.java
@@ -14,7 +14,6 @@ import java.util.ListIterator;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jpt.common.core.tests.internal.projects.TestJavaProject.SourceWriter;
import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.AttributeMapping;
import org.eclipse.jpt.jpa.core.context.BasicMapping;
@@ -44,6 +43,7 @@ import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyPersistentAttribute;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
import org.eclipse.jpt.jpa.core.resource.orm.XmlEntity;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.orm.XmlOneToOne;
import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
@@ -60,7 +60,7 @@ public class OrmOneToOneMappingTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ mappingFileRef.setFileName(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmPrimaryKeyJoinColumnTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmPrimaryKeyJoinColumnTests.java
index 429125de57..abe638cfd4 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmPrimaryKeyJoinColumnTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmPrimaryKeyJoinColumnTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 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.
@@ -9,12 +9,12 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.tests.internal.context.orm;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.orm.OrmEntity;
import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
import org.eclipse.jpt.jpa.core.context.orm.OrmPrimaryKeyJoinColumn;
import org.eclipse.jpt.jpa.core.resource.orm.XmlEntity;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.orm.XmlPrimaryKeyJoinColumn;
import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
@@ -31,7 +31,7 @@ public class OrmPrimaryKeyJoinColumnTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ mappingFileRef.setFileName(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmQueryHintTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmQueryHintTests.java
index 9a96d1436a..f9ab8cccee 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmQueryHintTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmQueryHintTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 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.
@@ -9,11 +9,11 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.tests.internal.context.orm;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.orm.OrmEntity;
import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
import org.eclipse.jpt.jpa.core.context.orm.OrmQueryHint;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.orm.XmlQueryHint;
import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
@@ -31,7 +31,7 @@ public class OrmQueryHintTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ mappingFileRef.setFileName(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmSecondaryTableTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmSecondaryTableTests.java
index f9c29b218a..e50a360b7f 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmSecondaryTableTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmSecondaryTableTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 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.
@@ -16,7 +16,6 @@ import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jpt.common.core.tests.internal.projects.TestJavaProject.SourceWriter;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.InheritanceType;
import org.eclipse.jpt.jpa.core.context.ReadOnlySecondaryTable;
@@ -33,6 +32,7 @@ import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualSecondaryTable;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
import org.eclipse.jpt.jpa.core.resource.orm.XmlEntity;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.orm.XmlSecondaryTable;
import org.eclipse.jpt.jpa.core.resource.orm.XmlUniqueConstraint;
import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
@@ -50,7 +50,7 @@ public class OrmSecondaryTableTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ mappingFileRef.setFileName(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmSequenceGeneratorTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmSequenceGeneratorTests.java
index e345249de2..097d6b2b9e 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmSequenceGeneratorTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmSequenceGeneratorTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 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.
@@ -9,8 +9,8 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.tests.internal.context.orm;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.SequenceGenerator;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.orm.XmlSequenceGenerator;
import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
@@ -27,7 +27,7 @@ public class OrmSequenceGeneratorTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ mappingFileRef.setFileName(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmTableGeneratorTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmTableGeneratorTests.java
index d063949658..d9160663b8 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmTableGeneratorTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmTableGeneratorTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 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.
@@ -13,7 +13,6 @@ import java.util.Iterator;
import java.util.ListIterator;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.IdMapping;
import org.eclipse.jpt.jpa.core.context.TableGenerator;
@@ -27,6 +26,7 @@ import org.eclipse.jpt.jpa.core.context.orm.OrmTableGenerator;
import org.eclipse.jpt.jpa.core.context.orm.OrmUniqueConstraint;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.orm.XmlTableGenerator;
import org.eclipse.jpt.jpa.core.resource.orm.XmlUniqueConstraint;
import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
@@ -44,7 +44,7 @@ public class OrmTableGeneratorTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ mappingFileRef.setFileName(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmTableTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmTableTests.java
index ca9d06d9c4..c81a94df28 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmTableTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmTableTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 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.
@@ -14,7 +14,6 @@ import java.util.ListIterator;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jpt.common.core.tests.internal.projects.TestJavaProject.SourceWriter;
import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.InheritanceType;
import org.eclipse.jpt.jpa.core.context.orm.OrmEntity;
@@ -24,6 +23,7 @@ import org.eclipse.jpt.jpa.core.context.orm.OrmUniqueConstraint;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
import org.eclipse.jpt.jpa.core.resource.orm.XmlEntity;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.orm.XmlTable;
import org.eclipse.jpt.jpa.core.resource.orm.XmlUniqueConstraint;
import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
@@ -41,7 +41,7 @@ public class OrmTableTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ mappingFileRef.setFileName(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmTransientMappingTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmTransientMappingTests.java
index 3e894c7236..dcbde648cc 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmTransientMappingTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmTransientMappingTests.java
@@ -12,7 +12,6 @@ package org.eclipse.jpt.jpa.core.tests.internal.context.orm;
import java.util.Iterator;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.EmbeddedIdMapping;
import org.eclipse.jpt.jpa.core.context.EmbeddedMapping;
@@ -28,6 +27,7 @@ import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyPersistentAttribute;
import org.eclipse.jpt.jpa.core.context.orm.OrmTransientMapping;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.orm.XmlTransient;
import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
@@ -44,7 +44,7 @@ public class OrmTransientMappingTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ mappingFileRef.setFileName(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmVersionMappingTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmVersionMappingTests.java
index 4ab3647e4e..b85c81a073 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmVersionMappingTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmVersionMappingTests.java
@@ -12,7 +12,6 @@ package org.eclipse.jpt.jpa.core.tests.internal.context.orm;
import java.util.Iterator;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.BasicMapping;
import org.eclipse.jpt.jpa.core.context.Column;
@@ -33,6 +32,7 @@ import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyPersistentAttribute;
import org.eclipse.jpt.jpa.core.context.orm.OrmVersionMapping;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.orm.XmlVersion;
import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
@@ -49,7 +49,7 @@ public class OrmVersionMappingTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ mappingFileRef.setFileName(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmXmlTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmXmlTests.java
index a3bb91a275..9c73b83212 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmXmlTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmXmlTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 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.
@@ -9,7 +9,6 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.tests.internal.context.orm;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.orm.OrmXml;
import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
@@ -30,7 +29,7 @@ public class OrmXmlTests extends ContextModelTestCase
super.setUp();
getXmlPersistenceUnit().setName("foo");
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ mappingFileRef.setFileName(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/PersistenceUnitDefaultsTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/PersistenceUnitDefaultsTests.java
index 0ce25c36e7..fdf1667e06 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/PersistenceUnitDefaultsTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/PersistenceUnitDefaultsTests.java
@@ -9,10 +9,10 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.tests.internal.context.orm;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.AccessType;
import org.eclipse.jpt.jpa.core.context.orm.OrmPersistenceUnitDefaults;
import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitMetadata;
import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
@@ -30,7 +30,7 @@ public class PersistenceUnitDefaultsTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ mappingFileRef.setFileName(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/PersistenceUnitMetadataTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/PersistenceUnitMetadataTests.java
index 42d6c8c41a..922aa75032 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/PersistenceUnitMetadataTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/PersistenceUnitMetadataTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 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.
@@ -9,9 +9,9 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.tests.internal.context.orm;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.orm.OrmPersistenceUnitMetadata;
import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
import org.eclipse.jpt.jpa.core.tests.internal.context.ContextModelTestCase;
@@ -27,7 +27,7 @@ public class PersistenceUnitMetadataTests extends ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ mappingFileRef.setFileName(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/persistence/PersistenceTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/persistence/PersistenceTests.java
index 32f258e6c5..b4b908f8f2 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/persistence/PersistenceTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/persistence/PersistenceTests.java
@@ -23,12 +23,12 @@ public class PersistenceTests extends ContextModelTestCase
}
protected Persistence persistence() {
- return getRootContextNode().getPersistenceXml().getPersistence();
+ return getRootContextNode().getPersistenceXml().getRoot();
}
public void testUpdateAddPersistenceUnit() throws Exception {
XmlPersistence xmlPersistence = getXmlPersistence();
- Persistence persistence = getRootContextNode().getPersistenceXml().getPersistence();
+ Persistence persistence = getRootContextNode().getPersistenceXml().getRoot();
// clear xml persistence units, test that it's clear in context
xmlPersistence.getPersistenceUnits().clear();
@@ -77,7 +77,7 @@ public class PersistenceTests extends ContextModelTestCase
public void testUpdateRemovePersistenceUnit() throws Exception {
XmlPersistence xmlPersistence = getXmlPersistence();
- Persistence persistence = getRootContextNode().getPersistenceXml().getPersistence();
+ Persistence persistence = getRootContextNode().getPersistenceXml().getRoot();
// add a persistence unit and test that there are two existing xml and
// one context persistence unit
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/persistence/PersistenceUnitTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/persistence/PersistenceUnitTests.java
index 9b9928c7c4..17efa5c01a 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/persistence/PersistenceUnitTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/persistence/PersistenceUnitTests.java
@@ -17,7 +17,6 @@ import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.Tools;
import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.AccessType;
import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
@@ -29,6 +28,7 @@ import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnitTransactionType;
import org.eclipse.jpt.jpa.core.internal.operations.OrmFileCreationDataModelProvider;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlJavaClassRef;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
@@ -1080,7 +1080,7 @@ public class PersistenceUnitTests extends ContextModelTestCase
}
public void testGetDefaultAccess() throws Exception {
- addXmlMappingFileRef(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ addXmlMappingFileRef(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
createOrm2XmlFile();
PersistenceUnit persistenceUnit = getPersistenceUnit();
ListIterator<MappingFileRef> mappingFileRefs = getPersistenceUnit().getMappingFileRefs().iterator();
@@ -1104,7 +1104,7 @@ public class PersistenceUnitTests extends ContextModelTestCase
}
public void testGetDefaultSchema() throws Exception {
- addXmlMappingFileRef(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ addXmlMappingFileRef(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
createOrm2XmlFile();
PersistenceUnit persistenceUnit = getPersistenceUnit();
ListIterator<MappingFileRef> mappingFileRefs = getPersistenceUnit().getMappingFileRefs().iterator();
@@ -1125,7 +1125,7 @@ public class PersistenceUnitTests extends ContextModelTestCase
}
public void testGetDefaultCatalog() throws Exception {
- addXmlMappingFileRef(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ addXmlMappingFileRef(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
createOrm2XmlFile();
PersistenceUnit persistenceUnit = getPersistenceUnit();
ListIterator<MappingFileRef> mappingFileRefs = getPersistenceUnit().getMappingFileRefs().iterator();
@@ -1226,7 +1226,7 @@ public class PersistenceUnitTests extends ContextModelTestCase
//test persistentType from orm.xml file that is specified in the persistence.xml
- addXmlMappingFileRef(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ addXmlMappingFileRef(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
assertNotNull(persistenceUnit.getPersistentType("model.Foo"));
assertEquals(ormPersistentType, persistenceUnit.getPersistentType("model.Foo"));
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/persistence/PersistenceXmlTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/persistence/PersistenceXmlTests.java
index 11bd30a5ef..6f7e9f8a2c 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/persistence/PersistenceXmlTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/persistence/PersistenceXmlTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 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.
@@ -41,14 +41,14 @@ public class PersistenceXmlTests extends ContextModelTestCase
prm.getContents().add(xmlPersistence);
prm.save(null);
- assertNotNull(getPersistenceXml().getPersistence());
+ assertNotNull(getPersistenceXml().getRoot());
assertEquals(2, getJpaProject().getJpaFilesSize());
}
public void testUpdateRemovePersistence() throws Exception {
JpaXmlResource prm = getPersistenceXmlResource();
- assertNotNull(getPersistenceXml().getPersistence());
+ assertNotNull(getPersistenceXml().getRoot());
prm.getContents().clear();
assertNull(getPersistenceXml());
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/Generic2_0ContextModelTestCase.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/Generic2_0ContextModelTestCase.java
index efc6a77229..ea0920b1b6 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/Generic2_0ContextModelTestCase.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/Generic2_0ContextModelTestCase.java
@@ -1,20 +1,22 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 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
- *******************************************************************************/
+ * Copyright (c) 2009, 2012 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.jpa.core.tests.internal.jpa2.context;
-import org.eclipse.jpt.jpa.core.JpaFacet;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.jpt.jpa.core.JpaWorkspace;
import org.eclipse.jpt.jpa.core.internal.facet.JpaFacetDataModelProperties;
import org.eclipse.jpt.jpa.core.internal.facet.JpaFacetInstallDataModelProperties;
-import org.eclipse.jpt.jpa.core.platform.GenericPlatform;
+import org.eclipse.jpt.jpa.core.internal.jpa2.Generic2_0JpaPlatformFactory;
+import org.eclipse.jpt.jpa.core.jpa2.JpaProject2_0;
import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
+import org.eclipse.jpt.jpa.core.platform.JpaPlatformManager;
import org.eclipse.jpt.jpa.core.tests.internal.context.ContextModelTestCase;
import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetDataModelProperties;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
@@ -28,19 +30,27 @@ public abstract class Generic2_0ContextModelTestCase extends ContextModelTestCas
@Override
protected IDataModel buildJpaConfigDataModel() {
IDataModel dataModel = super.buildJpaConfigDataModel();
- dataModel.setProperty(IFacetDataModelProperties.FACET_VERSION_STR, JpaFacet.VERSION_2_0.getVersionString());
- dataModel.setProperty(JpaFacetDataModelProperties.PLATFORM, GenericPlatform.VERSION_2_0);
+ dataModel.setProperty(IFacetDataModelProperties.FACET_VERSION_STR, JpaProject2_0.FACET_VERSION_STRING);
+ dataModel.setProperty(JpaFacetDataModelProperties.PLATFORM, this.getJpaPlatformDescription());
dataModel.setProperty(JpaFacetInstallDataModelProperties.CREATE_ORM_XML, Boolean.TRUE);
return dataModel;
}
@Override
- protected String getJpaFacetVersionString() {
- return JpaFacet.VERSION_2_0.getVersionString();
+ protected JpaPlatformDescription getJpaPlatformDescription() {
+ return this.getJpaPlatformManager().getJpaPlatformDescription(Generic2_0JpaPlatformFactory.ID);
+ }
+
+ protected JpaPlatformManager getJpaPlatformManager() {
+ return this.getJpaWorkspace().getJpaPlatformManager();
+ }
+
+ protected JpaWorkspace getJpaWorkspace() {
+ return (JpaWorkspace) ResourcesPlugin.getWorkspace().getAdapter(JpaWorkspace.class);
}
@Override
- protected JpaPlatformDescription getJpaPlatformDescription() {
- return GenericPlatform.VERSION_2_0;
+ protected String getJpaFacetVersionString() {
+ return JpaProject2_0.FACET_VERSION_STRING;
}
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/java/GenericJavaSequenceGenerator2_0Tests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/java/GenericJavaSequenceGenerator2_0Tests.java
index 2632244b86..c59c1644ab 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/java/GenericJavaSequenceGenerator2_0Tests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/java/GenericJavaSequenceGenerator2_0Tests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2012 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.
@@ -15,7 +15,6 @@ import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement.Kind;
import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.IdMapping;
import org.eclipse.jpt.jpa.core.context.orm.OrmEntity;
@@ -23,6 +22,7 @@ import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
import org.eclipse.jpt.jpa.core.jpa2.context.SequenceGenerator2_0;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.SequenceGenerator2_0Annotation;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
import org.eclipse.jpt.jpa.core.tests.internal.jpa2.context.Generic2_0ContextModelTestCase;
@@ -128,7 +128,7 @@ public class GenericJavaSequenceGenerator2_0Tests extends Generic2_0ContextModel
public void testUpdateDefaultSchemaFromPersistenceUnitDefaults() throws Exception {
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ mappingFileRef.setFileName(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
createTestEntityWithSequenceGenerator();
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/orm/GenericOrmCascade2_0Tests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/orm/GenericOrmCascade2_0Tests.java
index 0d3a2482d4..7d345b690a 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/orm/GenericOrmCascade2_0Tests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/orm/GenericOrmCascade2_0Tests.java
@@ -1,22 +1,21 @@
/*******************************************************************************
- * Copyright (c) 2010, 2012 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
- *******************************************************************************/
+ * Copyright (c) 2010, 2012 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.jpa.core.tests.internal.jpa2.context.orm;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.orm.OrmOneToOneMapping;
import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
import org.eclipse.jpt.jpa.core.jpa2.context.Cascade2_0;
import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.orm.XmlOneToOne;
import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
@@ -34,7 +33,7 @@ public class GenericOrmCascade2_0Tests extends Generic2_0ContextModelTestCase
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ mappingFileRef.setFileName(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/orm/GenericOrmCollectionTable2_0Tests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/orm/GenericOrmCollectionTable2_0Tests.java
index c720e0a1f7..2e7e54d62e 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/orm/GenericOrmCollectionTable2_0Tests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/orm/GenericOrmCollectionTable2_0Tests.java
@@ -13,7 +13,6 @@ import java.util.Iterator;
import java.util.ListIterator;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.JoinColumn;
import org.eclipse.jpt.jpa.core.context.UniqueConstraint;
@@ -37,6 +36,7 @@ import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
import org.eclipse.jpt.jpa.core.resource.orm.XmlCollectionTable;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.orm.XmlUniqueConstraint;
import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0;
import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
@@ -54,7 +54,7 @@ public class GenericOrmCollectionTable2_0Tests extends Generic2_0ContextModelTes
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ mappingFileRef.setFileName(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/orm/GenericOrmElementCollectionMapping2_0Tests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/orm/GenericOrmElementCollectionMapping2_0Tests.java
index 1194bbcd35..130a9aa72e 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/orm/GenericOrmElementCollectionMapping2_0Tests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/orm/GenericOrmElementCollectionMapping2_0Tests.java
@@ -14,7 +14,6 @@ import java.util.ListIterator;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jpt.common.core.tests.internal.projects.TestJavaProject.SourceWriter;
import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.AttributeOverrideContainer;
import org.eclipse.jpt.jpa.core.context.BasicMapping;
@@ -54,6 +53,7 @@ import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
import org.eclipse.jpt.jpa.core.resource.orm.XmlElementCollection;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0;
import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
@@ -73,7 +73,7 @@ public class GenericOrmElementCollectionMapping2_0Tests extends Generic2_0Contex
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ mappingFileRef.setFileName(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/persistence/Generic2_0JpaMetadataConversionTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/persistence/Generic2_0JpaMetadataConversionTests.java
index 8e84da3f7c..cabf76214c 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/persistence/Generic2_0JpaMetadataConversionTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/persistence/Generic2_0JpaMetadataConversionTests.java
@@ -16,7 +16,6 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.JpaNamedContextNode;
import org.eclipse.jpt.jpa.core.context.java.JavaEntity;
import org.eclipse.jpt.jpa.core.context.java.JavaIdMapping;
@@ -33,6 +32,7 @@ import org.eclipse.jpt.jpa.core.jpa2.context.LockModeType2_0;
import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmNamedQuery2_0;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.tests.internal.jpa2.context.Generic2_0ContextModelTestCase;
@SuppressWarnings("nls")
@@ -179,7 +179,7 @@ public class Generic2_0JpaMetadataConversionTests extends
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
JavaEntity entity = getJavaEntity();
- addXmlMappingFileRef(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ addXmlMappingFileRef(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
EntityMappings entityMappings = getEntityMappings();
PersistenceUnit persistenceUnit = getPersistenceUnit();
@@ -233,7 +233,7 @@ public class Generic2_0JpaMetadataConversionTests extends
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
JavaEntity entity = getJavaEntity();
- addXmlMappingFileRef(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ addXmlMappingFileRef(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
EntityMappings entityMappings = getEntityMappings();
PersistenceUnit persistenceUnit = getPersistenceUnit();
@@ -299,7 +299,7 @@ public class Generic2_0JpaMetadataConversionTests extends
PersistenceUnit persistenceUnit = getPersistenceUnit();
- addXmlMappingFileRef(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ addXmlMappingFileRef(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
EntityMappings entityMappings = getEntityMappings();
OrmNamedNativeQuery nnq = entityMappings.getQueryContainer().addNamedNativeQuery();
nnq.setName("nq");
@@ -323,7 +323,7 @@ public class Generic2_0JpaMetadataConversionTests extends
PersistenceUnit persistenceUnit = getPersistenceUnit();
- addXmlMappingFileRef(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ addXmlMappingFileRef(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
EntityMappings entityMappings = getEntityMappings();
persistenceUnit.convertJavaQueries(entityMappings, progressMonitor);
@@ -342,7 +342,7 @@ public class Generic2_0JpaMetadataConversionTests extends
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
JavaMappedSuperclass mappedSuperclass = (JavaMappedSuperclass) getJavaPersistentType().getMapping();
- addXmlMappingFileRef(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ addXmlMappingFileRef(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
EntityMappings entityMappings = getEntityMappings();
PersistenceUnit persistenceUnit = getPersistenceUnit();
@@ -396,7 +396,7 @@ public class Generic2_0JpaMetadataConversionTests extends
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
JavaMappedSuperclass mappedSuperclass = (JavaMappedSuperclass) getJavaPersistentType().getMapping();
- addXmlMappingFileRef(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ addXmlMappingFileRef(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
EntityMappings entityMappings = getEntityMappings();
PersistenceUnit persistenceUnit = getPersistenceUnit();
@@ -524,7 +524,7 @@ public class Generic2_0JpaMetadataConversionTests extends
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
JavaEntity entity = getJavaEntity();
- addXmlMappingFileRef(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ addXmlMappingFileRef(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
EntityMappings entityMappings = getEntityMappings();
PersistenceUnit persistenceUnit = getPersistenceUnit();
@@ -563,7 +563,7 @@ public class Generic2_0JpaMetadataConversionTests extends
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
JavaEntity entity = getJavaEntity();
- addXmlMappingFileRef(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ addXmlMappingFileRef(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
EntityMappings entityMappings = getEntityMappings();
PersistenceUnit persistenceUnit = getPersistenceUnit();
@@ -605,7 +605,7 @@ public class Generic2_0JpaMetadataConversionTests extends
PersistenceUnit persistenceUnit = getPersistenceUnit();
- addXmlMappingFileRef(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ addXmlMappingFileRef(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
EntityMappings entityMappings = getEntityMappings();
OrmSequenceGenerator sequence = entityMappings.addSequenceGenerator();
sequence.setName("gen");
@@ -634,7 +634,7 @@ public class Generic2_0JpaMetadataConversionTests extends
JavaEntity entity = getJavaEntity();
JavaIdMapping mapping = (JavaIdMapping)entity.getIdAttribute().getMapping();
- addXmlMappingFileRef(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ addXmlMappingFileRef(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
EntityMappings entityMappings = getEntityMappings();
persistenceUnit.convertJavaGenerators(entityMappings, progressMonitor);
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/persistence/Generic2_0PersistenceUnitTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/persistence/Generic2_0PersistenceUnitTests.java
index b1158a47d4..7bf7888c28 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/persistence/Generic2_0PersistenceUnitTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/persistence/Generic2_0PersistenceUnitTests.java
@@ -1,29 +1,23 @@
/*******************************************************************************
-* Copyright (c) 2009, 2010 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
-*******************************************************************************/
+ * Copyright (c) 2009, 2012 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.jpa.core.tests.internal.jpa2.context.persistence;
import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel;
import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.jpa.core.JpaFacet;
-import org.eclipse.jpt.jpa.core.internal.facet.JpaFacetDataModelProperties;
-import org.eclipse.jpt.jpa.core.internal.facet.JpaFacetInstallDataModelProperties;
+import org.eclipse.jpt.jpa.core.internal.jpa2.Generic2_0JpaPlatformFactory;
+import org.eclipse.jpt.jpa.core.jpa2.JpaProject2_0;
import org.eclipse.jpt.jpa.core.jpa2.context.persistence.PersistenceUnit2_0;
-import org.eclipse.jpt.jpa.core.platform.GenericPlatform;
import org.eclipse.jpt.jpa.core.tests.internal.context.persistence.PersistenceUnitTestCase;
-import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetDataModelProperties;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-/**
- * GenericPersistenceUnit2_0Tests
- */
-public abstract class Generic2_0PersistenceUnitTests extends PersistenceUnitTestCase
+public abstract class Generic2_0PersistenceUnitTests
+ extends PersistenceUnitTestCase
{
protected PersistenceUnit2_0 subject;
@@ -43,14 +37,15 @@ public abstract class Generic2_0PersistenceUnitTests extends PersistenceUnitTest
}
@Override
- protected IDataModel buildJpaConfigDataModel() {
- IDataModel dataModel = super.buildJpaConfigDataModel();
- dataModel.setProperty(IFacetDataModelProperties.FACET_VERSION_STR, JpaFacet.VERSION_2_0.getVersionString());
- dataModel.setProperty(JpaFacetDataModelProperties.PLATFORM, GenericPlatform.VERSION_2_0);
- dataModel.setProperty(JpaFacetInstallDataModelProperties.CREATE_ORM_XML, Boolean.TRUE);
- return dataModel;
+ protected String getJpaFacetVersionString() {
+ return JpaProject2_0.FACET_VERSION_STRING;
}
-
+
+ @Override
+ protected String getJpaPlatformID() {
+ return Generic2_0JpaPlatformFactory.ID;
+ }
+
@Override
protected PersistenceUnit2_0 getPersistenceUnit() {
return (PersistenceUnit2_0) super.getPersistenceUnit();
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/metadata/JpaEntityGenMetadataTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/metadata/JpaEntityGenMetadataTests.java
deleted file mode 100644
index e21c902e3f..0000000000
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/metadata/JpaEntityGenMetadataTests.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2012 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.jpa.core.tests.internal.metadata;
-
-import junit.framework.Assert;
-
-import org.eclipse.jpt.jpa.core.prefs.JpaEntityGenPreferencesManager;
-
-/**
- * JpaEntityGenMetadataTests
- */
-public class JpaEntityGenMetadataTests extends JpaMetadataTests {
-
- public static final String DEFAULT_PACKAGE_PREF_KEY = "entitygen.DEFAULT_PACKAGE"; //$NON-NLS-1$
-
- public static final String DEFAULT_PACKAGE_TEST_VALUE = "test.model"; //$NON-NLS-1$
-
- protected JpaEntityGenPreferencesManager projectPrefsManager;
-
- // ********** constructor **********
-
- public JpaEntityGenMetadataTests(String name) {
- super(name);
- }
-
- // ********** overrides **********
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
-
- this.projectPrefsManager = new JpaEntityGenPreferencesManager(this.getJavaProject().getProject());
- Assert.assertNotNull(this.projectPrefsManager);
- }
-
- // ********** tests **********
-
- public void testDefaultPackageWorkspaceMetadata() throws Exception {
- JpaEntityGenPreferencesManager.setDefaultPackageWorkspacePreference(DEFAULT_PACKAGE_TEST_VALUE);
- JpaEntityGenPreferencesManager.getLegacyWorkspacePreferences().flush();
-
- String value = this.getWorkspacePrefs().get(DEFAULT_PACKAGE_PREF_KEY);
- Assert.assertNotNull(value);
- Assert.assertTrue(DEFAULT_PACKAGE_TEST_VALUE.equals(value));
-
- JpaEntityGenPreferencesManager.removeLegacyWorkspacePreference(DEFAULT_PACKAGE_PREF_KEY);
- }
-
- public void testDefaultPackageProjectMetadata() throws Exception {
-
- this.projectPrefsManager.setDefaultPackagePreference(DEFAULT_PACKAGE_TEST_VALUE);
- this.projectPrefsManager.getLegacyProjectPreferences().flush();
-
- String value = this.getProjectPrefs().get(DEFAULT_PACKAGE_PREF_KEY);
- Assert.assertNotNull(value);
- Assert.assertTrue(DEFAULT_PACKAGE_TEST_VALUE.equals(value));
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/metadata/JpaJpqlMetadataTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/metadata/JpaJpqlMetadataTests.java
deleted file mode 100644
index df1daea08d..0000000000
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/metadata/JpaJpqlMetadataTests.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2012 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.jpa.core.tests.internal.metadata;
-
-import junit.framework.Assert;
-
-import org.eclipse.jpt.jpa.core.prefs.JpaEntityGenPreferencesManager;
-import org.eclipse.jpt.jpa.core.prefs.JpaJpqlPreferencesManager;
-
-/**
- * JpaJpqlMetadataTests
- */
-public class JpaJpqlMetadataTests extends JpaMetadataTests {
-
- public static final String CASE_PREF_KEY = "jpqlIdentifier.CASE";
- public static final String MATCH_FIRST_CHARACTER_CASE_PREF_KEY = "jpqlIdentifier.MATCH_FIRST_CHARACTER_CASE";
-
- public static final String CASE_TEST_VALUE = JpaJpqlPreferencesManager.JPQL_IDENTIFIER_UPPERCASE_PREF_VALUE;
- public static final boolean MATCH_FIRST_CHARACTER_CASE_TEST_VALUE = ! JpaJpqlPreferencesManager.DEFAULT_MATCH_FIRST_CHARACTER_CASE;
-
- // ********** constructor **********
-
- public JpaJpqlMetadataTests(String name) {
- super(name);
- }
-
- // ********** tests **********
-
- public void testIdentifiersCaseWorkspaceMetadata() throws Exception {
- JpaJpqlPreferencesManager.setIdentifiersCaseWorkspacePreference(CASE_TEST_VALUE);
- JpaJpqlPreferencesManager.getLegacyWorkspacePreferences().flush();
-
- String value = this.getWorkspacePrefs().get(CASE_PREF_KEY);
- Assert.assertNotNull(value);
- Assert.assertTrue(CASE_TEST_VALUE.equals(value));
-
- JpaEntityGenPreferencesManager.removeLegacyWorkspacePreference(CASE_PREF_KEY);
- }
-
- public void testMatchFirstCharacterCaseWorkspaceMetadata() throws Exception {
- JpaJpqlPreferencesManager.setMatchFirstCharacterCaseWorkspacePreference(MATCH_FIRST_CHARACTER_CASE_TEST_VALUE);
- JpaJpqlPreferencesManager.getLegacyWorkspacePreferences().flush();
-
- String stringValue = this.getWorkspacePrefs().get(MATCH_FIRST_CHARACTER_CASE_PREF_KEY);
- Assert.assertNotNull(stringValue);
- boolean value = Boolean.valueOf(stringValue);
- Assert.assertTrue(value == MATCH_FIRST_CHARACTER_CASE_TEST_VALUE);
-
- JpaEntityGenPreferencesManager.removeLegacyWorkspacePreference(MATCH_FIRST_CHARACTER_CASE_PREF_KEY);
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/metadata/JpaMetadataTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/metadata/JpaMetadataTests.java
deleted file mode 100644
index 2997c41acc..0000000000
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/metadata/JpaMetadataTests.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2012 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.jpa.core.tests.internal.metadata;
-
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Properties;
-import java.util.Set;
-
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.preferences.IEclipsePreferences;
-import org.eclipse.jpt.common.core.tests.internal.utility.jdt.AnnotationTestCase;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-
-/**
- * JpaMetadataTests
- */
-public abstract class JpaMetadataTests extends AnnotationTestCase {
-
- private static final String SETTINGS_DIR = ".settings/";
- private static final String ECLIPSE_CORE_SETTINGS_DIR = ".metadata/.plugins/org.eclipse.core.runtime/" + SETTINGS_DIR;
- public static final String PREFS_FILE_NAME = JptJpaCorePlugin.LEGACY_PLUGIN_ID + ".prefs";
-
- protected IEclipsePreferences workspacePreferences;
- private String eclipseCoreSettingsDir;
- private String projectSettingsDir;
-
- // ********** constructor **********
-
- protected JpaMetadataTests(String name) {
- super(name);
- }
-
- // ********** overrides **********
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
-
- IPath workspacePath = this.getWorkspaceRoot().getLocation();
- this.eclipseCoreSettingsDir = workspacePath + "/" + ECLIPSE_CORE_SETTINGS_DIR;
-
- IPath projectPath = this.javaProject.getProject().getLocation();
- this.projectSettingsDir = projectPath + "/" + SETTINGS_DIR;
- }
-
- // ********** preferences **********
-
- protected Map<String, String> getWorkspacePrefs() {
- return this.getSettings(this.eclipseCoreSettingsDir + PREFS_FILE_NAME);
- }
-
- protected Map<String, String> getProjectPrefs() {
- return this.getSettings(this.projectSettingsDir + PREFS_FILE_NAME);
- }
-
- // ********** internal methods **********
-
- private IWorkspaceRoot getWorkspaceRoot() {
- return ResourcesPlugin.getWorkspace().getRoot();
- }
-
- private Map<String, String> getSettings(String settingsPath) {
- Set<Entry<Object, Object>> settingsSet = null;
- try {
- settingsSet = this.loadMetadata(settingsPath);
- }
- catch (IOException e) {
- throw new RuntimeException("Missing: " + settingsPath, e);
- }
-
- Map<String, String> settings = new HashMap<String, String>();
- for(Entry<Object, Object> property : settingsSet) {
- settings.put((String)property.getKey(), (String)property.getValue());
- }
- return settings;
- }
-
- private Set<Entry<Object, Object>> loadMetadata(String metadataPath) throws IOException {
- FileInputStream stream = new FileInputStream(metadataPath);
-
- Properties properties = new Properties();
- properties.load(stream);
- stream.close();
-
- return properties.entrySet();
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/metadata/JpaValidationMetadataTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/metadata/JpaValidationMetadataTests.java
deleted file mode 100644
index 00394e1e6f..0000000000
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/metadata/JpaValidationMetadataTests.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2012 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.jpa.core.tests.internal.metadata;
-
-import junit.framework.Assert;
-
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.prefs.JpaValidationPreferencesManager;
-
-/**
- * JpaValidationMetadataTests
- */
-public class JpaValidationMetadataTests extends JpaMetadataTests {
-
- public static final String WORKSPACE_OVERRIDEN_PREF_KEY = "workspace_preferences_overriden";
- public static final String PERSISTENCE_NO_PERSISTENCE_UNIT_PREF_KEY = "problem." + JpaValidationMessages.PERSISTENCE_NO_PERSISTENCE_UNIT;
-
- public static final boolean WORKSPACE_OVERRIDEN_TEST_VALUE = true;
- public static final String PERSISTENCE_NO_PERSISTENCE_UNIT_TEST_VALUE = JpaValidationPreferencesManager.INFO;
-
- protected JpaValidationPreferencesManager projectPrefsManager;
-
- // ********** constructor **********
-
- public JpaValidationMetadataTests(String name) {
- super(name);
- }
-
- // ********** overrides **********
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
-
- this.projectPrefsManager = new JpaValidationPreferencesManager(this.getJavaProject().getProject());
- Assert.assertNotNull(this.projectPrefsManager);
- }
-
- // ********** tests **********
-
- public void testWorkspaceLevelProblemMetadata() throws Exception {
- JpaValidationPreferencesManager.setWorkspaceLevelProblemPreference(
- JpaValidationMessages.PERSISTENCE_NO_PERSISTENCE_UNIT,
- PERSISTENCE_NO_PERSISTENCE_UNIT_TEST_VALUE);
- JpaValidationPreferencesManager.getLegacyWorkspacePreferences().flush();
-
- String value = this.getWorkspacePrefs().get(PERSISTENCE_NO_PERSISTENCE_UNIT_PREF_KEY);
- Assert.assertNotNull(value);
- Assert.assertTrue(PERSISTENCE_NO_PERSISTENCE_UNIT_TEST_VALUE.equals(value));
-
- JpaValidationPreferencesManager.removeLegacyWorkspacePreference(PERSISTENCE_NO_PERSISTENCE_UNIT_PREF_KEY);
- }
-
- public void testProjectHasSpecificOptionsMetadata() throws Exception {
-
- this.projectPrefsManager.setProjectHasSpecificOptions(WORKSPACE_OVERRIDEN_TEST_VALUE);
- this.projectPrefsManager.getLegacyProjectPreferences().flush();
-
- String stringValue = this.getProjectPrefs().get(WORKSPACE_OVERRIDEN_PREF_KEY);
- Assert.assertNotNull(stringValue);
- boolean value = Boolean.valueOf(stringValue);
- Assert.assertTrue(value == WORKSPACE_OVERRIDEN_TEST_VALUE);
- }
-
- public void testProjectLevelProblemMetadata() throws Exception {
-
- this.projectPrefsManager.setProjectLevelProblemPreference(
- JpaValidationMessages.PERSISTENCE_NO_PERSISTENCE_UNIT,
- PERSISTENCE_NO_PERSISTENCE_UNIT_TEST_VALUE);
- this.projectPrefsManager.getLegacyProjectPreferences().flush();
-
- String value = this.getProjectPrefs().get(PERSISTENCE_NO_PERSISTENCE_UNIT_PREF_KEY);
- Assert.assertNotNull(value);
- Assert.assertTrue(PERSISTENCE_NO_PERSISTENCE_UNIT_TEST_VALUE.equals(value));
- }
-} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/metadata/JptJpaCoreMetadataTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/metadata/JptJpaCoreMetadataTests.java
deleted file mode 100644
index 41ba644d5c..0000000000
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/metadata/JptJpaCoreMetadataTests.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2012 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.jpa.core.tests.internal.metadata;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-/**
- * JptJpaCoreMetadataTests
- */
-public class JptJpaCoreMetadataTests {
-
- public static Test suite() {
- TestSuite suite = new TestSuite(JptJpaCoreMetadataTests.class.getPackage().getName());
- suite.addTestSuite(JpaEntityGenMetadataTests.class);
- suite.addTestSuite(JpaJpqlMetadataTests.class);
- suite.addTestSuite(JpaValidationMetadataTests.class);
- return suite;
- }
-
- private JptJpaCoreMetadataTests() {
- super();
- throw new UnsupportedOperationException();
- }
-
-} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/model/JpaProjectManagerTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/model/JpaProjectManagerTests.java
index afa17889bd..9cdf35ee8c 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/model/JpaProjectManagerTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/model/JpaProjectManagerTests.java
@@ -17,12 +17,15 @@ import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.jpt.common.core.internal.utility.JptPlugin;
+import org.eclipse.jpt.common.core.internal.utility.ProjectTools;
import org.eclipse.jpt.common.core.tests.internal.projects.TestFacetedProject;
import org.eclipse.jpt.common.core.tests.internal.projects.TestJavaProject;
import org.eclipse.jpt.common.core.tests.internal.projects.TestPlatformProject;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.ReflectionTools;
-import org.eclipse.jpt.jpa.core.JpaFacet;
+import org.eclipse.jpt.jpa.core.JpaPreferences;
import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.JpaProjectManager;
import org.eclipse.jpt.jpa.core.internal.facet.JpaFacetInstallDataModelProperties;
@@ -47,15 +50,12 @@ public class JpaProjectManagerTests
@Override
protected void setUp() throws Exception {
super.setUp();
- if (this.debug()) {
- this.printName();
- }
+ this.trace("+++++ " + this.getName() + " +++++");
this.testProjectHarness = this.buildTestProjectHarness();
}
- private boolean debug() {
- Boolean debug = (Boolean) ReflectionTools.executeStaticMethod(this.getGenericJpaProjectManagerClass(), "debug");
- return debug.booleanValue();
+ private void trace(String message) {
+ ReflectionTools.executeStaticMethod(this.getGenericJpaProjectManagerClass(), "trace", String.class, message);
}
// InternalJpaProjectManager is package-private
@@ -67,22 +67,6 @@ public class JpaProjectManagerTests
return (JpaProjectManager) ResourcesPlugin.getWorkspace().getAdapter(JpaProjectManager.class);
}
- private void printName() {
- String name = this.getName();
- System.out.println();
- System.out.println();
- this.printNameBorder(name);
- System.out.println(name);
- this.printNameBorder(name);
- }
-
- private void printNameBorder(String name) {
- for (int i = name.length(); i-- > 0; ) {
- System.out.print('=');
- }
- System.out.println();
- }
-
@Override
protected void tearDown() throws Exception {
this.testProjectHarness.getProject().delete(true, true, null);
@@ -140,7 +124,7 @@ public class JpaProjectManagerTests
}
public void testProjectCloseReopen() throws Exception {
- this.testProjectHarness.installFacet(JpaFacet.ID, "1.0", buildJpaConfigDataModel());
+ this.testProjectHarness.installFacet(JpaProject.FACET_ID, JpaProject.FACET_VERSION_STRING, buildJpaConfigDataModel());
JpaProject jpaProject = this.getJpaProject();
assertNotNull(jpaProject);
@@ -162,11 +146,15 @@ public class JpaProjectManagerTests
}
public void testProjectDeleteReimport() throws Exception {
- this.testProjectHarness.installFacet(JpaFacet.ID, "1.0", buildJpaConfigDataModel());
+ this.testProjectHarness.installFacet(JpaProject.FACET_ID, JpaProject.FACET_VERSION_STRING, buildJpaConfigDataModel());
JpaProject jpaProject = this.getJpaProject();
assertNotNull(jpaProject);
assertEquals(1, CollectionTools.size(this.getJpaProjectManager().waitToGetJpaProjects()));
+ // flush the prefs file so it will still be there after we delete the project
+ // and our settings are discovered when the project is restored
+ this.flushProjectPrefs();
+
this.testProjectHarness.getProject().delete(false, true, null);
jpaProject = this.getJpaProject();
assertNull(jpaProject);
@@ -179,7 +167,7 @@ public class JpaProjectManagerTests
project.open(null);
assertTrue(project.isOpen());
- assertTrue(JpaFacet.isInstalled(project));
+ assertTrue(ProjectTools.hasFacet(project, JpaProject.FACET));
jpaProject = this.getJpaProject(project);
assertNotNull(jpaProject);
assertEquals(4, jpaProject.getJpaFilesSize());
@@ -189,10 +177,20 @@ public class JpaProjectManagerTests
assertNotNull(jpaProject.getJpaFile(this.getFile(this.testProjectHarness, "src/META-INF/orm.xml")));
}
+ protected void flushProjectPrefs() throws Exception {
+ JptPlugin plugin = this.getPlugin();
+ IEclipsePreferences prefs = (IEclipsePreferences) ReflectionTools.executeMethod(plugin, "getProjectPreferences", IProject.class, this.testProjectHarness.getProject());
+ prefs.flush();
+ }
+
+ protected JptPlugin getPlugin() throws Exception {
+ return (JptPlugin) ReflectionTools.executeStaticMethod(JpaPreferences.class, "getPlugin");
+ }
+
public void testFacetInstallUninstall() throws Exception {
assertNull(this.getJpaProject());
- this.testProjectHarness.installFacet(JpaFacet.ID, "1.0", buildJpaConfigDataModel());
+ this.testProjectHarness.installFacet(JpaProject.FACET_ID, JpaProject.FACET_VERSION_STRING, buildJpaConfigDataModel());
assertEquals(1, CollectionTools.size(this.getJpaProjectManager().waitToGetJpaProjects()));
JpaProject jpaProject = this.getJpaProject();
assertNotNull(jpaProject);
@@ -203,7 +201,7 @@ public class JpaProjectManagerTests
assertNotNull(jpaProject.getJpaFile(this.getFile(this.testProjectHarness, "src/META-INF/persistence.xml")));
assertNotNull(jpaProject.getJpaFile(this.getFile(this.testProjectHarness, "src/META-INF/orm.xml")));
- this.testProjectHarness.uninstallFacet(JpaFacet.ID, "1.0");
+ this.testProjectHarness.uninstallFacet(JpaProject.FACET_ID, "1.0");
assertEquals(0, CollectionTools.size(this.getJpaProjectManager().waitToGetJpaProjects()));
jpaProject = this.getJpaProject();
assertNull(jpaProject);
@@ -246,7 +244,7 @@ public class JpaProjectManagerTests
}
public void testEditFacetSettingsFileRemoveThenAddJpaFacet() throws Exception {
- this.testProjectHarness.installFacet(JpaFacet.ID, "1.0", buildJpaConfigDataModel());
+ this.testProjectHarness.installFacet(JpaProject.FACET_ID, JpaProject.FACET_VERSION_STRING, buildJpaConfigDataModel());
JpaProject jpaProject = this.getJpaProject();
assertNotNull(jpaProject);
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/platform/JpaPlatformExtensionTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/platform/JpaPlatformExtensionTests.java
index b387c46c0e..50a743fe89 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/platform/JpaPlatformExtensionTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/platform/JpaPlatformExtensionTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 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.
@@ -15,12 +15,13 @@ import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jpt.common.core.tests.internal.projects.TestJavaProject;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.jpa.core.JpaFacet;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.JpaPlatform;
+import org.eclipse.jpt.jpa.core.JpaPreferences;
+import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.internal.facet.JpaFacetDataModelProperties;
import org.eclipse.jpt.jpa.core.internal.facet.JpaFacetInstallDataModelProvider;
-import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
-import org.eclipse.jpt.jpa.core.tests.extension.resource.ExtensionTestPlugin;
+import org.eclipse.jpt.jpa.core.internal.plugin.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.tests.extension.resource.TestExtensionPlugin;
import org.eclipse.jpt.jpa.core.tests.extension.resource.TestJpaPlatformProvider;
import org.eclipse.jpt.jpa.core.tests.internal.context.ContextModelTestCase;
import org.eclipse.jpt.jpa.core.tests.internal.projects.TestJpaProject;
@@ -29,11 +30,10 @@ import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.project.facet.core.IActionConfigFactory;
@SuppressWarnings("nls")
-public class JpaPlatformExtensionTests extends ContextModelTestCase
+public class JpaPlatformExtensionTests
+ extends ContextModelTestCase
{
public static final String TEST_PLATFORM_ID = TestJpaPlatformProvider.ID;
- public static final JpaPlatformDescription TEST_PLATFORM_DESC =
- JptJpaCorePlugin.getJpaPlatformManager().getJpaPlatform(TEST_PLATFORM_ID);
public static final String TEST_PLATFORM_LABEL = "Test Jpa Platform";
protected TestJpaProject testProject;
@@ -56,19 +56,19 @@ public class JpaPlatformExtensionTests extends ContextModelTestCase
protected IDataModel buildConfig() throws Exception {
IActionConfigFactory configFactory = new JpaFacetInstallDataModelProvider();
IDataModel config = (IDataModel) configFactory.create();
- config.setProperty(IFacetDataModelProperties.FACET_VERSION_STR, JpaFacet.VERSION_1_0.getVersionString());
- config.setProperty(JpaFacetDataModelProperties.PLATFORM, TEST_PLATFORM_DESC);
+ config.setProperty(IFacetDataModelProperties.FACET_VERSION_STR, JpaProject.FACET_VERSION_STRING);
+ config.setProperty(JpaFacetDataModelProperties.PLATFORM, this.getJpaPlatformManager().getJpaPlatformDescription(TEST_PLATFORM_ID));
return config;
}
public static void verifyExtensionTestProjectExists() {
IExtensionRegistry registry = Platform.getExtensionRegistry();
IExtensionPoint extensionPoint =
- registry.getExtensionPoint(JptJpaCorePlugin.PLUGIN_ID, "jpaPlatform");
+ registry.getExtensionPoint(JptJpaCorePlugin.instance().getPluginID(), "jpaPlatform");
IExtension[] extensions = extensionPoint.getExtensions();
boolean extensionFound = false;
for (IExtension extension : extensions) {
- if (extension.getContributor().getName().equals(ExtensionTestPlugin.PLUGIN_ID)) {
+ if (extension.getContributor().getName().equals(TestExtensionPlugin.instance().getPluginID())) {
extensionFound = true;
}
}
@@ -83,14 +83,18 @@ public class JpaPlatformExtensionTests extends ContextModelTestCase
}
public void testAllJpaPlatformIds() {
- assertTrue(CollectionTools.size(JptJpaCorePlugin.getJpaPlatformManager().getJpaPlatforms()) >= 2);
+ assertTrue(CollectionTools.size(getJpaPlatformManager().getJpaPlatformDescriptions()) >= 2);
}
public void testJpaPlatformLabel() {
- assertEquals(TEST_PLATFORM_LABEL, JptJpaCorePlugin.getJpaPlatformManager().getJpaPlatform(TEST_PLATFORM_ID).getLabel());
+ assertEquals(TEST_PLATFORM_LABEL, getJpaPlatformManager().getJpaPlatformDescription(TEST_PLATFORM_ID).getLabel());
}
public void testJpaPlatform() {
- assertNotNull(JptJpaCorePlugin.getJpaPlatformManager().buildJpaPlatformImplementation(this.testProject.getProject()));
+ assertNotNull(this.getJpaPlatform());
+ }
+
+ protected JpaPlatform getJpaPlatform() {
+ return this.getJpaPlatformManager().getJpaPlatform(JpaPreferences.getJpaPlatformID(this.testProject.getProject()));
}
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/platform/JpaPlatformTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/platform/JpaPlatformTests.java
index 3766cc134f..2e8e6e4fb1 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/platform/JpaPlatformTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/platform/JpaPlatformTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 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.
@@ -13,9 +13,8 @@ import java.util.Iterator;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jpt.common.core.tests.internal.projects.TestJavaProject;
import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jpa.core.JpaFacet;
import org.eclipse.jpt.jpa.core.JpaPlatform;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
@@ -23,11 +22,11 @@ import org.eclipse.jpt.jpa.core.context.java.JavaTypeMapping;
import org.eclipse.jpt.jpa.core.internal.facet.JpaFacetDataModelProperties;
import org.eclipse.jpt.jpa.core.internal.facet.JpaFacetInstallDataModelProvider;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.tests.extension.resource.ExtensionTestPlugin;
import org.eclipse.jpt.jpa.core.tests.extension.resource.JavaTestAttributeMapping;
import org.eclipse.jpt.jpa.core.tests.extension.resource.JavaTestAttributeMappingDefinition;
import org.eclipse.jpt.jpa.core.tests.extension.resource.JavaTestTypeMapping;
import org.eclipse.jpt.jpa.core.tests.extension.resource.JavaTestTypeMappingDefinition;
+import org.eclipse.jpt.jpa.core.tests.extension.resource.TestExtensionPlugin;
import org.eclipse.jpt.jpa.core.tests.extension.resource.TestJavaBasicMapping;
import org.eclipse.jpt.jpa.core.tests.extension.resource.TestJavaEntity;
import org.eclipse.jpt.jpa.core.tests.extension.resource.TestJpaFactory;
@@ -44,7 +43,7 @@ public class JpaPlatformTests
{
protected TestJpaProject testProject;
- public static final String TEST_PLUGIN_CLASS = ExtensionTestPlugin.class.getName();
+ public static final String TEST_PLUGIN_CLASS = TestExtensionPlugin.class.getName();
public static final String TEST_PLUGIN_ID = "org.eclipse.jpt.jpa.core.tests.extension.resource";
public static final String TEST_PLATFORM_CLASS_NAME = TestJpaPlatformProvider.class.getName();
@@ -71,10 +70,10 @@ public class JpaPlatformTests
protected IDataModel buildConfig() throws Exception {
IActionConfigFactory configFactory = new JpaFacetInstallDataModelProvider();
IDataModel config = (IDataModel) configFactory.create();
- config.setProperty(IFacetDataModelProperties.FACET_VERSION_STR, JpaFacet.VERSION_1_0.getVersionString());
+ config.setProperty(IFacetDataModelProperties.FACET_VERSION_STR, JpaProject.FACET_VERSION_STRING);
config.setProperty(
JpaFacetDataModelProperties.PLATFORM,
- JptJpaCorePlugin.getJpaPlatformManager().getJpaPlatform(TestJpaPlatformProvider.ID));
+ this.getJpaPlatformManager().getJpaPlatform(TestJpaPlatformProvider.ID));
return config;
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/JptJpaCoreTestsPlugin.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/plugin/JptJpaCoreTestsPlugin.java
index f3b96b3b39..f309bf3c4a 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/JptJpaCoreTestsPlugin.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/plugin/JptJpaCoreTestsPlugin.java
@@ -7,15 +7,12 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.jpa.core.tests;
+package org.eclipse.jpt.jpa.core.tests.internal.plugin;
import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.Plugin;
+import org.eclipse.jpt.common.core.internal.utility.JptPlugin;
import org.eclipse.jpt.common.utility.internal.ReflectionTools;
import org.eclipse.jpt.jpa.core.JpaProjectManager;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.internal.prefs.JpaPreferencesManager;
-import org.osgi.framework.BundleContext;
/**
* Configure the core for testing:<ul>
@@ -25,8 +22,10 @@ import org.osgi.framework.BundleContext;
*/
@SuppressWarnings("nls")
public class JptJpaCoreTestsPlugin
- extends Plugin
-{
+ extends JptPlugin
+{
+ // ********** singleton **********
+
private static JptJpaCoreTestsPlugin INSTANCE;
public static JptJpaCoreTestsPlugin instance() {
@@ -34,25 +33,18 @@ public class JptJpaCoreTestsPlugin
}
- // ********** plug-in implementation **********
+ // ********** Dali plug-in **********
public JptJpaCoreTestsPlugin() {
super();
- if (INSTANCE != null) {
- throw new IllegalStateException();
- }
- // this convention is *wack*... ~bjv
- INSTANCE = this;
}
-
@Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
+ protected void start_() throws Exception {
+ super.start_();
JpaProjectManager jpaProjectManager = this.getJpaProjectManager();
ReflectionTools.executeMethod(jpaProjectManager, "executeCommandsSynchronously");
- ReflectionTools.setFieldValue(jpaProjectManager, "test", Boolean.TRUE);
- ReflectionTools.executeStaticMethod(JpaPreferencesManager.class, "doNotFlushPreferences");
+ JptPlugin.FlushPreferences = false;
}
private JpaProjectManager getJpaProjectManager() {
@@ -60,7 +52,7 @@ public class JptJpaCoreTestsPlugin
}
@Override
- public void stop(BundleContext context) throws Exception {
- super.stop(context);
+ protected void setInstance(JptPlugin plugin) {
+ INSTANCE = (JptJpaCoreTestsPlugin) plugin;
}
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/projects/TestJpaProject.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/projects/TestJpaProject.java
index 25a39ccccb..4a4091b963 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/projects/TestJpaProject.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/projects/TestJpaProject.java
@@ -11,7 +11,6 @@ package org.eclipse.jpt.jpa.core.tests.internal.projects;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jpt.common.core.tests.internal.projects.TestJavaProject;
-import org.eclipse.jpt.jpa.core.JpaFacet;
import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetDataModelProperties;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
@@ -55,12 +54,12 @@ public class TestJpaProject
public TestJpaProject(String projectName, boolean autoBuild, IDataModel jpaConfig) throws CoreException {
super(projectName, autoBuild);
- String jpaFacetVersion = JpaFacet.VERSION_1_0.getVersionString();
+ String jpaFacetVersion = JpaProject.FACET_VERSION_STRING;
if (jpaConfig != null) {
jpaFacetVersion = jpaConfig.getStringProperty(IFacetDataModelProperties.FACET_VERSION_STR);
}
this.installFacet("jst.utility", "1.0");
- this.installFacet(JpaFacet.ID, jpaFacetVersion, jpaConfig);
+ this.installFacet(JpaProject.FACET_ID, jpaFacetVersion, jpaConfig);
this.addJar(jpaJarName());
if (eclipseLinkJarName() != null) {
this.addJar(eclipseLinkJarName());
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/test.xml b/jpa/tests/org.eclipse.jpt.jpa.core.tests/test.xml
index 1609ffb9ff..c435e63028 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/test.xml
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/test.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?> <!--
- Copyright (c) 2007, 2010 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 -->
+ Copyright (c) 2007, 2012 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 -->
<project name="testsuite" default="run" basedir=".">
<!-- The property ${eclipse-home} should be passed into this script -->
@@ -20,8 +20,7 @@
</delete>
</target>
- <!-- This target defines the tests that need to be run. -->
- <target name="suite1"> <property file="${testRoot}/testServer.properties"/> <property name="jpt-folder" value="${eclipse-home}/jpt_folder"/> <delete dir="${jpt-folder}" quiet="true"/> <ant target="core-test" antfile="${library-file}" dir="${eclipse-home}"> <property name="data-dir" value="${jpt-folder}"/> <property name="plugin-name" value="${plugin-name}"/> <property name="classname" value="org.eclipse.jpt.jpa.core.tests.internal.model.JptJpaCoreModelTests" /> <property name="plugin-path" value="${eclipse-home}/plugins/${plugin-name}"/> </ant> </target> <target name="suite2"> <property file="${testRoot}/testServer.properties"/> <property name="jpt-folder" value="${eclipse-home}/jpt_folder"/> <delete dir="${jpt-folder}" quiet="true"/> <ant target="core-test" antfile="${library-file}" dir="${eclipse-home}"> <property name="data-dir" value="${jpt-folder}"/> <property name="plugin-name" value="${plugin-name}"/> <property name="classname" value="org.eclipse.jpt.jpa.core.tests.internal.resource.JptJpaCoreResourceModelTests" /> <property name="plugin-path" value="${eclipse-home}/plugins/${plugin-name}"/> <property name="extraVMargs" value="-Dorg.eclipse.jpt.jpa.jar=${testDir}/${jpt-persistence-jar}"/> </ant> </target> <target name="suite3"> <property file="${testRoot}/testServer.properties"/> <property name="jpt-folder" value="${eclipse-home}/jpt_folder"/> <delete dir="${jpt-folder}" quiet="true"/> <ant target="core-test" antfile="${library-file}" dir="${eclipse-home}"> <property name="data-dir" value="${jpt-folder}"/> <property name="plugin-name" value="${plugin-name}"/> <property name="classname" value="org.eclipse.jpt.jpa.core.tests.internal.context.JptJpaCoreContextModelTests" /> <property name="plugin-path" value="${eclipse-home}/plugins/${plugin-name}"/> <property name="extraVMargs" value="-Dorg.eclipse.jpt.jpa.jar=${testDir}/${jpt-persistence-jar}"/> </ant> </target> <target name="suite4"> <property file="${testRoot}/testServer.properties"/> <property name="jpt-folder" value="${eclipse-home}/jpt_folder"/> <delete dir="${jpt-folder}" quiet="true"/> <ant target="core-test" antfile="${library-file}" dir="${eclipse-home}"> <property name="data-dir" value="${jpt-folder}"/> <property name="plugin-name" value="${plugin-name}"/> <property name="classname" value="org.eclipse.jpt.jpa.core.tests.internal.metadata.JptJpaCoreMetadataTests" /> <property name="plugin-path" value="${eclipse-home}/plugins/${plugin-name}"/> <property name="extraVMargs" value="-Dorg.eclipse.jpt.jpa.jar=${testDir}/${jpt-persistence-jar}"/> </ant> </target>
+ <!-- Test suite is split up to prevent time-outs during the WTP build. --> <!-- Keep these suites in sync with those listed in JptJpaCoreTests. --> <target name="suite1"> <property file="${testRoot}/testServer.properties"/> <property name="jpt-folder" value="${eclipse-home}/jpt_folder"/> <delete dir="${jpt-folder}" quiet="true"/> <ant target="core-test" antfile="${library-file}" dir="${eclipse-home}"> <property name="data-dir" value="${jpt-folder}"/> <property name="plugin-name" value="${plugin-name}"/> <property name="classname" value="org.eclipse.jpt.jpa.core.tests.internal.model.JptJpaCoreModelTests" /> <property name="plugin-path" value="${eclipse-home}/plugins/${plugin-name}"/> </ant> </target> <target name="suite2"> <property file="${testRoot}/testServer.properties"/> <property name="jpt-folder" value="${eclipse-home}/jpt_folder"/> <delete dir="${jpt-folder}" quiet="true"/> <ant target="core-test" antfile="${library-file}" dir="${eclipse-home}"> <property name="data-dir" value="${jpt-folder}"/> <property name="plugin-name" value="${plugin-name}"/> <property name="classname" value="org.eclipse.jpt.jpa.core.tests.internal.resource.JptJpaCoreResourceModelTests" /> <property name="plugin-path" value="${eclipse-home}/plugins/${plugin-name}"/> <property name="extraVMargs" value="-Dorg.eclipse.jpt.jpa.jar=${testDir}/${jpt-persistence-jar}"/> </ant> </target> <target name="suite3"> <property file="${testRoot}/testServer.properties"/> <property name="jpt-folder" value="${eclipse-home}/jpt_folder"/> <delete dir="${jpt-folder}" quiet="true"/> <ant target="core-test" antfile="${library-file}" dir="${eclipse-home}"> <property name="data-dir" value="${jpt-folder}"/> <property name="plugin-name" value="${plugin-name}"/> <property name="classname" value="org.eclipse.jpt.jpa.core.tests.internal.context.JptJpaCoreContextModelTests" /> <property name="plugin-path" value="${eclipse-home}/plugins/${plugin-name}"/> <property name="extraVMargs" value="-Dorg.eclipse.jpt.jpa.jar=${testDir}/${jpt-persistence-jar}"/> </ant> </target> <target name="suite4"> <property file="${testRoot}/testServer.properties"/> <property name="jpt-folder" value="${eclipse-home}/jpt_folder"/> <delete dir="${jpt-folder}" quiet="true"/> <ant target="core-test" antfile="${library-file}" dir="${eclipse-home}"> <property name="data-dir" value="${jpt-folder}"/> <property name="plugin-name" value="${plugin-name}"/> <property name="classname" value="org.eclipse.jpt.jpa.core.tests.internal.JptJpaCoreMiscTests" /> <property name="plugin-path" value="${eclipse-home}/plugins/${plugin-name}"/> <property name="extraVMargs" value="-Dorg.eclipse.jpt.jpa.jar=${testDir}/${jpt-persistence-jar}"/> </ant> </target>
<!-- This target holds code to cleanup the testing environment after -->
<!-- after all of the tests have been run. You can use this target to -->
<!-- delete temporary files that have been created. -->
diff --git a/jpa/tests/org.eclipse.jpt.jpa.db.tests/.classpath b/jpa/tests/org.eclipse.jpt.jpa.db.tests/.classpath
index 5c128f330d..356a1daca3 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.db.tests/.classpath
+++ b/jpa/tests/org.eclipse.jpt.jpa.db.tests/.classpath
@@ -4,6 +4,7 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
<accessrules>
+ <accessrule kind="accessible" pattern="org/eclipse/jpt/common/core/**"/>
<accessrule kind="accessible" pattern="org/eclipse/jpt/common/utility/**"/>
</accessrules>
</classpathentry>
diff --git a/jpa/tests/org.eclipse.jpt.jpa.db.tests/META-INF/MANIFEST.MF b/jpa/tests/org.eclipse.jpt.jpa.db.tests/META-INF/MANIFEST.MF
index f296c9f361..2d5010ebb9 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.db.tests/META-INF/MANIFEST.MF
+++ b/jpa/tests/org.eclipse.jpt.jpa.db.tests/META-INF/MANIFEST.MF
@@ -2,18 +2,22 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
-Bundle-SymbolicName: org.eclipse.jpt.jpa.db.tests
+Bundle-SymbolicName: org.eclipse.jpt.jpa.db.tests;singleton:=true
Bundle-Version: 2.0.0.qualifier
-Bundle-Activator: org.eclipse.jpt.jpa.db.tests.internal.JptJpaDbTestsPlugin
+Bundle-Activator: org.eclipse.jpt.jpa.db.tests.internal.plugin.JptJpaDbTestsPlugin
Bundle-ActivationPolicy: lazy
+Bundle-ClassPath: .
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)",
+ org.eclipse.core.resources;bundle-version="[3.4.0,4.0.0)",
org.eclipse.datatools.connectivity;bundle-version="[1.1.0,1.3.0)",
org.eclipse.datatools.connectivity.sqm.core;bundle-version="1.0.1",
org.eclipse.datatools.modelbase.sql;bundle-version="1.0.0",
org.eclipse.jpt.common.utility;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.jpt.common.core;bundle-version="[1.0.0,2.0.0)",
org.eclipse.jpt.jpa.db;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.jpt.common.core.tests;bundle-version="[1.0.0,2.0.0)",
org.junit;bundle-version="[4.0.0,5.0.0)"
Export-Package: org.eclipse.jpt.jpa.db.tests.internal;x-internal:=true,
org.eclipse.jpt.jpa.db.tests.internal.platforms;x-internal:=true
diff --git a/jpa/tests/org.eclipse.jpt.jpa.db.tests/src/org/eclipse/jpt/jpa/db/tests/internal/JptJpaDbTests.java b/jpa/tests/org.eclipse.jpt.jpa.db.tests/src/org/eclipse/jpt/jpa/db/tests/internal/JptJpaDbTests.java
index 937b8c2b8c..37f68d4e87 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.db.tests/src/org/eclipse/jpt/jpa/db/tests/internal/JptJpaDbTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.db.tests/src/org/eclipse/jpt/jpa/db/tests/internal/JptJpaDbTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2008 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2012 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.
@@ -11,6 +11,8 @@ package org.eclipse.jpt.jpa.db.tests.internal;
import junit.framework.Test;
import junit.framework.TestSuite;
+import org.eclipse.jpt.common.core.tests.BundleActivatorTest;
+import org.eclipse.jpt.jpa.db.Database;
import org.eclipse.jpt.jpa.db.tests.internal.platforms.AllPlatformTests;
/**
@@ -21,7 +23,8 @@ public class JptJpaDbTests {
public static Test suite() {
TestSuite suite = new TestSuite(JptJpaDbTests.class.getPackage().getName());
- suite.addTest( AllPlatformTests.suite());
+ suite.addTest(AllPlatformTests.suite());
+ suite.addTest(new BundleActivatorTest(Database.class));
return suite;
}
@@ -30,5 +33,4 @@ public class JptJpaDbTests {
super();
throw new UnsupportedOperationException();
}
-
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.db.tests/src/org/eclipse/jpt/jpa/db/tests/internal/JptJpaDbTestsPlugin.java b/jpa/tests/org.eclipse.jpt.jpa.db.tests/src/org/eclipse/jpt/jpa/db/tests/internal/JptJpaDbTestsPlugin.java
deleted file mode 100644
index f42832e95f..0000000000
--- a/jpa/tests/org.eclipse.jpt.jpa.db.tests/src/org/eclipse/jpt/jpa/db/tests/internal/JptJpaDbTestsPlugin.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 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.jpa.db.tests.internal;
-
-import org.eclipse.core.runtime.Plugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * JptJpaDbTestsPlugin
- */
-public class JptJpaDbTestsPlugin extends Plugin {
-
- // The shared instance
- private static JptJpaDbTestsPlugin INSTANCE;
-
- public static final String BUNDLE_ID = "org.eclipse.jpt.jpa.db.tests"; //$NON-NLS-1$
-
- /**
- * Returns the shared instance
- */
- public static JptJpaDbTestsPlugin instance() {
- return INSTANCE;
- }
-
- /**
- * The constructor
- */
- public JptJpaDbTestsPlugin() {
- super();
- INSTANCE = this;
- }
-
- /**
- * This method is called upon plug-in activation
- */
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- }
-
- /**
- * This method is called when the plug-in is stopped
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- INSTANCE = null;
- super.stop(context);
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.db.tests/src/org/eclipse/jpt/jpa/db/tests/internal/plugin/JptJpaDbTestsPlugin.java b/jpa/tests/org.eclipse.jpt.jpa.db.tests/src/org/eclipse/jpt/jpa/db/tests/internal/plugin/JptJpaDbTestsPlugin.java
new file mode 100644
index 0000000000..2bf72f0a1f
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.jpa.db.tests/src/org/eclipse/jpt/jpa/db/tests/internal/plugin/JptJpaDbTestsPlugin.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2012 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.jpa.db.tests.internal.plugin;
+
+import org.eclipse.jpt.common.core.internal.utility.JptPlugin;
+
+/**
+ * Need plugin to simplify reading <code>config/*.properties</code> files.
+ */
+public class JptJpaDbTestsPlugin
+ extends JptPlugin
+{
+ // ********** singleton **********
+
+ private static JptJpaDbTestsPlugin INSTANCE;
+
+ public static JptJpaDbTestsPlugin instance() {
+ return INSTANCE;
+ }
+
+
+ // ********** Dali plug-in **********
+
+ public JptJpaDbTestsPlugin() {
+ super();
+ }
+
+ @Override
+ protected void setInstance(JptPlugin plugin) {
+ INSTANCE = (JptJpaDbTestsPlugin) plugin;
+ }
+}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/META-INF/MANIFEST.MF b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/META-INF/MANIFEST.MF
index db2960f014..c83ce366ec 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/META-INF/MANIFEST.MF
+++ b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/META-INF/MANIFEST.MF
@@ -2,8 +2,10 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
-Bundle-SymbolicName: org.eclipse.jpt.jpa.eclipselink.core.tests
+Bundle-SymbolicName: org.eclipse.jpt.jpa.eclipselink.core.tests;singleton:=true
Bundle-Version: 2.2.0.qualifier
+Bundle-ActivationPolicy: lazy
+Bundle-ClassPath: .
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Require-Bundle: org.eclipse.core.commands;bundle-version="[3.4.0,4.0.0)",
@@ -13,6 +15,7 @@ Require-Bundle: org.eclipse.core.commands;bundle-version="[3.4.0,4.0.0)",
org.eclipse.jpt.common.core;bundle-version="[1.0.0,2.0.0)",
org.eclipse.jpt.common.core.tests;bundle-version="[1.0.0,2.0.0)",
org.eclipse.jpt.common.utility;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.jpt.common.eclipselink.core;bundle-version="[1.0.0,2.0.0)",
org.eclipse.jdt.core;bundle-version="[3.4.0,4.0.0)",
org.eclipse.jpt.jpa.core;bundle-version="[3.0.0,4.0.0)",
org.eclipse.jpt.jpa.eclipselink.core;bundle-version="[2.0.0,3.0.0)",
@@ -28,6 +31,5 @@ Export-Package: org.eclipse.jpt.jpa.eclipselink.core.tests.internal;x-internal:=
org.eclipse.jpt.jpa.eclipselink.core.tests.internal.context.java;x-internal:=true,
org.eclipse.jpt.jpa.eclipselink.core.tests.internal.context.orm;x-internal:=true,
org.eclipse.jpt.jpa.eclipselink.core.tests.internal.context.persistence;x-internal:=true,
- org.eclipse.jpt.jpa.eclipselink.core.tests.internal.metadata;x-internal:=true,
org.eclipse.jpt.jpa.eclipselink.core.tests.internal.resource;x-internal:=true,
org.eclipse.jpt.jpa.eclipselink.core.tests.internal.resource.java;x-internal:=true
diff --git a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/EclipseLinkJpaPreferencesTests.java b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/EclipseLinkJpaPreferencesTests.java
new file mode 100644
index 0000000000..e3a6e7e860
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/EclipseLinkJpaPreferencesTests.java
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.jpa.eclipselink.core.tests.internal;
+
+import org.eclipse.jpt.common.core.tests.PreferencesTests;
+import org.eclipse.jpt.jpa.eclipselink.core.EclipseLinkJpaPreferences;
+
+/**
+ * <strong>NB:</strong> These tests are to test for backward-compatibility!
+ * That is, there are testing to make sure preferences are stored in their
+ * <em>original</em> location from release to release. Thus the hard-coded
+ * file names, preference keys, etc.
+ */
+@SuppressWarnings("nls")
+public class EclipseLinkJpaPreferencesTests
+ extends PreferencesTests
+{
+ // DO NOT CHANGE THIS CONSTANT - as it is testing backward-compatibility
+ private static final String WORKSPACE_PREFS_FILE_NAME = "org.eclipse.jpt.jpa.eclipselink.core.prefs";
+
+ // DO NOT CHANGE THIS CONSTANT - as it is testing backward-compatibility
+ private static final String PROJECT_PREFS_FILE_NAME = "org.eclipse.jpt.jpa.eclipselink.core.prefs";
+
+
+ public EclipseLinkJpaPreferencesTests(String name) {
+ super(name);
+ }
+
+
+ // ********** overrides **********
+
+ @Override
+ protected String getWorkspacePrefsFileName() {
+ return WORKSPACE_PREFS_FILE_NAME;
+ }
+
+ @Override
+ protected String getProjectPrefsFileName() {
+ return PROJECT_PREFS_FILE_NAME;
+ }
+
+ @Override
+ protected Class<?> getPreferencesClass() {
+ return EclipseLinkJpaPreferences.class;
+ }
+
+
+ // ********** tests **********
+
+ public void testStaticWeavingSourceLocation() throws Exception {
+ String value = "FOO";
+ EclipseLinkJpaPreferences.setStaticWeavingSourceLocation(this.getProject(), value);
+ this.flushProjectPrefs();
+ assertEquals(value, this.readProjectPrefs().getProperty(STATIC_WEAVE_SOURCE_LOCATION));
+ }
+ // DO NOT CHANGE THIS CONSTANT - as it is testing backward-compatibility
+ private static final String STATIC_WEAVE_SOURCE_LOCATION = "staticWeaving.SOURCE";
+
+ public void testStaticWeavingTargetLocation() throws Exception {
+ String value = "FOO";
+ EclipseLinkJpaPreferences.setStaticWeavingTargetLocation(this.getProject(), value);
+ this.flushProjectPrefs();
+ assertEquals(value, this.readProjectPrefs().getProperty(STATIC_WEAVING_TARGET_LOCATION));
+ }
+ // DO NOT CHANGE THIS CONSTANT - as it is testing backward-compatibility
+ private static final String STATIC_WEAVING_TARGET_LOCATION = "staticWeaving.TARGET";
+
+ public void testStaticWeavingLogLevel() throws Exception {
+ String value = "SEVERE";
+ EclipseLinkJpaPreferences.setStaticWeavingLogLevel(this.getProject(), value);
+ this.flushProjectPrefs();
+ assertEquals(value, this.readProjectPrefs().getProperty(STATIC_WEAVING_LOG_LEVEL));
+ }
+ // DO NOT CHANGE THIS CONSTANT - as it is testing backward-compatibility
+ private static final String STATIC_WEAVING_LOG_LEVEL = "staticWeaving.LOG_LEVEL";
+
+ public void testStaticWeavingPersistenceInfo() throws Exception {
+ String value = "BLAH";
+ EclipseLinkJpaPreferences.setStaticWeavingPersistenceInfo(this.getProject(), value);
+ this.flushProjectPrefs();
+ assertEquals(value, this.readProjectPrefs().getProperty(STATIC_WEAVING_PERSISTENCE_INFO));
+ }
+ // DO NOT CHANGE THIS CONSTANT - as it is testing backward-compatibility
+ private static final String STATIC_WEAVING_PERSISTENCE_INFO = "staticWeaving.PERSISTENCE_INFO";
+}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/JptJpaEclipseLinkCoreMiscTests.java b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/JptJpaEclipseLinkCoreMiscTests.java
new file mode 100644
index 0000000000..4a860a3ac1
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/JptJpaEclipseLinkCoreMiscTests.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.jpa.eclipselink.core.tests.internal;
+
+import org.eclipse.jpt.common.core.tests.BundleActivatorTest;
+import org.eclipse.jpt.common.eclipselink.core.internal.libval.EclipseLinkLibValUtil;
+import org.eclipse.jpt.jpa.eclipselink.core.EclipseLinkJpaProject;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class JptJpaEclipseLinkCoreMiscTests {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(JptJpaEclipseLinkCoreMiscTests.class.getPackage().getName());
+
+ suite.addTestSuite(EclipseLinkJpaPreferencesTests.class);
+ suite.addTest(new BundleActivatorTest(EclipseLinkJpaProject.class));
+ suite.addTest(new BundleActivatorTest(EclipseLinkLibValUtil.class)); // verify common.eclipselink.core plug-in also
+
+ return suite;
+ }
+
+ private JptJpaEclipseLinkCoreMiscTests() {
+ super();
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/JptJpaEclipseLinkCoreTests.java b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/JptJpaEclipseLinkCoreTests.java
index 97d7891e9c..c62fb1f8c5 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/JptJpaEclipseLinkCoreTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/JptJpaEclipseLinkCoreTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2012 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.
@@ -14,27 +14,30 @@ import junit.framework.Test;
import junit.framework.TestSuite;
import org.eclipse.jpt.jpa.core.tests.internal.projects.TestJpaProject;
import org.eclipse.jpt.jpa.eclipselink.core.tests.internal.context.JptJpaEclipseLinkCoreContextModelTests;
-import org.eclipse.jpt.jpa.eclipselink.core.tests.internal.metadata.JptJpaEclipseLinkCoreMetadataTests;
import org.eclipse.jpt.jpa.eclipselink.core.tests.internal.resource.JptJpaEclipselinkCoreResourceModelTests;
/**
* decentralize test creation code
- *
- * Required Java system property:
- * -Dorg.eclipse.jpt.jpa.jar=<jpa.jar path>
- * -Dorg.eclipse.jpt.eclipselink.jar=<eclipselink.jar path>
+ * <p>
+ * Required Java system properties:<code><ul>
+ * <li>-Dorg.eclipse.jpt.jpa.jar=&lt;jpa.jar path&gt;
+ * <li>-Dorg.eclipse.jpt.eclipselink.jar=&lt;eclipselink.jar path&gt;
+ * </ul></code>
*/
@SuppressWarnings("nls")
-public class JptJpaEclipseLinkCoreTests
-{
+public class JptJpaEclipseLinkCoreTests {
+
private static final String JPA_JAR_PROPERTY = TestJpaProject.JPA_JAR_NAME_SYSTEM_PROPERTY;
private static final String ECLIPSELINK_JAR_PROPERTY = TestJpaProject.ECLIPSELINK_JAR_NAME_SYSTEM_PROPERTY;
public static Test suite() {
+ // ***** keep test.xml in sync with this list *****
+ // test.xml is split up because this test suite was taking too
+ // long and triggering a time-out during the WTP build
TestSuite suite = new TestSuite(JptJpaEclipseLinkCoreTests.class.getPackage().getName());
suite.addTest(JptJpaEclipselinkCoreResourceModelTests.suite());
suite.addTest(JptJpaEclipseLinkCoreContextModelTests.suite());
- suite.addTest(JptJpaEclipseLinkCoreMetadataTests.suite());
+ suite.addTest(JptJpaEclipseLinkCoreMiscTests.suite());
return suite;
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/EclipseLink1_1JpaProjectTests.java b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/EclipseLink1_1JpaProjectTests.java
index 939a527af0..6d479d07d6 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/EclipseLink1_1JpaProjectTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/EclipseLink1_1JpaProjectTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2012 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.
@@ -11,14 +11,13 @@ package org.eclipse.jpt.jpa.eclipselink.core.tests.internal.context;
import org.eclipse.core.runtime.Path;
import org.eclipse.jpt.common.core.internal.operations.JptFileCreationDataModelProperties;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.internal.operations.JpaFileCreationDataModelProperties;
import org.eclipse.jpt.jpa.core.internal.operations.OrmFileCreationDataModelProvider;
import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
import org.eclipse.jpt.jpa.core.tests.internal.context.ContextModelTestCase;
import org.eclipse.jpt.jpa.eclipselink.core.EclipseLinkJpaProject;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
import org.eclipse.jpt.jpa.eclipselink.core.internal.operations.EclipseLinkOrmFileCreationDataModelProvider;
import org.eclipse.jpt.jpa.eclipselink.core.platform.EclipseLinkPlatform;
import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v1_1.EclipseLink1_1;
@@ -47,7 +46,7 @@ public class EclipseLink1_1JpaProjectTests
public void testGetDefaultOrmXmlResource() throws Exception {
JpaXmlResource resource = this.getJpaProject().getDefaultOrmXmlResource();
assertNotNull(resource);
- assertEquals(JptJpaCorePlugin.ORM_XML_CONTENT_TYPE, resource.getContentType());
+ assertEquals(XmlEntityMappings.CONTENT_TYPE, resource.getContentType());
assertEquals("src/META-INF/orm.xml", resource.getFile().getProjectRelativePath().toString());
//delete the orm.xml file and verify it is not returned from getDefaultOrmXmlResource()
@@ -59,7 +58,7 @@ public class EclipseLink1_1JpaProjectTests
createDefaultOrmXmlFileWithEclipseLink1_1ContentType();
resource = this.getJpaProject().getDefaultOrmXmlResource();
assertNotNull(resource);
- assertEquals(JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_1_1_RESOURCE_TYPE, resource.getResourceType());
+ assertEquals(org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml1_1Definition.instance().getResourceType(), resource.getResourceType());
assertEquals("src/META-INF/orm.xml", resource.getFile().getProjectRelativePath().toString());
@@ -73,7 +72,7 @@ public class EclipseLink1_1JpaProjectTests
createDefaultOrmXmlFileWithEclipseLinkContentType();
resource = this.getJpaProject().getDefaultOrmXmlResource();
assertNotNull(resource);
- assertEquals(JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE, resource.getContentType());
+ assertEquals(org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings.CONTENT_TYPE, resource.getContentType());
assertEquals("src/META-INF/orm.xml", resource.getFile().getProjectRelativePath().toString());
@@ -87,7 +86,7 @@ public class EclipseLink1_1JpaProjectTests
createDefaultOrmXmlFile();
resource = this.getJpaProject().getDefaultOrmXmlResource();
assertNotNull(resource);
- assertEquals(JptJpaCorePlugin.ORM_XML_CONTENT_TYPE, resource.getContentType());
+ assertEquals(XmlEntityMappings.CONTENT_TYPE, resource.getContentType());
assertEquals("src/META-INF/orm.xml", resource.getFile().getProjectRelativePath().toString());
}
@@ -99,7 +98,7 @@ public class EclipseLink1_1JpaProjectTests
createDefaultEclipseLink1_1OrmXmlFile();
resource = this.getJpaProject().getDefaultEclipseLinkOrmXmlResource();
assertNotNull(resource);
- assertEquals(JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_1_1_RESOURCE_TYPE, resource.getResourceType());
+ assertEquals(org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml1_1Definition.instance().getResourceType(), resource.getResourceType());
assertEquals("src/META-INF/eclipselink-orm.xml", resource.getFile().getProjectRelativePath().toString());
@@ -123,16 +122,16 @@ public class EclipseLink1_1JpaProjectTests
config.setProperty(JptFileCreationDataModelProperties.CONTAINER_PATH,
getJpaProject().getProject().getFolder("src/META-INF").getFullPath());
config.setProperty(JptFileCreationDataModelProperties.FILE_NAME,
- JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.lastSegment());
+ XmlEntityMappings.DEFAULT_RUNTIME_PATH.lastSegment());
config.getDefaultOperation().execute(null, null);
}
private void createDefaultOrmXmlFileWithEclipseLink1_1ContentType() throws Exception {
- createEclipseLink1_1OrmXmlFile(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.lastSegment());
+ createEclipseLink1_1OrmXmlFile(XmlEntityMappings.DEFAULT_RUNTIME_PATH.lastSegment());
}
private void createDefaultEclipseLink1_1OrmXmlFile() throws Exception {
- createEclipseLink1_1OrmXmlFile(JptJpaEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH.lastSegment());
+ createEclipseLink1_1OrmXmlFile(org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings.DEFAULT_RUNTIME_PATH.lastSegment());
}
private void createEclipseLink1_1OrmXmlFile(String fileName) throws Exception {
@@ -146,19 +145,19 @@ public class EclipseLink1_1JpaProjectTests
}
public void testGetMappingFileResource() throws Exception {
- JpaXmlResource resource = this.getJpaProject().getMappingFileXmlResource(JptJpaEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH);
+ JpaXmlResource resource = this.getJpaProject().getMappingFileXmlResource(org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings.DEFAULT_RUNTIME_PATH);
assertNull(resource);
//add the eclipselink-orm.xml 1.1 file
createDefaultEclipseLink1_1OrmXmlFile();
- resource = this.getJpaProject().getMappingFileXmlResource(JptJpaEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH);
+ resource = this.getJpaProject().getMappingFileXmlResource(org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings.DEFAULT_RUNTIME_PATH);
assertNotNull(resource);
- assertEquals(JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_1_1_RESOURCE_TYPE, resource.getResourceType());
+ assertEquals(org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml1_1Definition.instance().getResourceType(), resource.getResourceType());
assertEquals("src/META-INF/eclipselink-orm.xml", resource.getFile().getProjectRelativePath().toString());
//delete the eclipselink-orm.xml file and verify it is not returned from getMappingFileResource()
resource.delete(null);
- resource = this.getJpaProject().getMappingFileXmlResource(JptJpaEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH);
+ resource = this.getJpaProject().getMappingFileXmlResource(org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings.DEFAULT_RUNTIME_PATH);
assertNull(resource);
}
@@ -170,7 +169,7 @@ public class EclipseLink1_1JpaProjectTests
createEclipseLink1_1OrmXmlFile("orm2.xml");
resource = this.getJpaProject().getMappingFileXmlResource(new Path("META-INF/orm2.xml"));
assertNotNull(resource);
- assertEquals(JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_1_1_RESOURCE_TYPE, resource.getResourceType());
+ assertEquals(org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml1_1Definition.instance().getResourceType(), resource.getResourceType());
assertEquals("src/META-INF/orm2.xml", resource.getFile().getProjectRelativePath().toString());
//delete the orm2.xml file and verify it is not returned from getMappingFileResource()
@@ -182,7 +181,7 @@ public class EclipseLink1_1JpaProjectTests
createEclipseLink1_1OrmXmlFile("orm2.xml");
resource = this.getJpaProject().getMappingFileXmlResource(new Path("META-INF/orm2.xml"));
assertNotNull(resource);
- assertEquals(JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_1_1_RESOURCE_TYPE, resource.getResourceType());
+ assertEquals(org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml1_1Definition.instance().getResourceType(), resource.getResourceType());
assertEquals("src/META-INF/orm2.xml", resource.getFile().getProjectRelativePath().toString());
}
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/EclipseLink1_2JpaProjectTests.java b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/EclipseLink1_2JpaProjectTests.java
index 67272257d3..839c0c8272 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/EclipseLink1_2JpaProjectTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/EclipseLink1_2JpaProjectTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2012 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.
@@ -11,14 +11,13 @@ package org.eclipse.jpt.jpa.eclipselink.core.tests.internal.context;
import org.eclipse.core.runtime.Path;
import org.eclipse.jpt.common.core.internal.operations.JptFileCreationDataModelProperties;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.internal.operations.JpaFileCreationDataModelProperties;
import org.eclipse.jpt.jpa.core.internal.operations.OrmFileCreationDataModelProvider;
import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
import org.eclipse.jpt.jpa.core.tests.internal.context.ContextModelTestCase;
import org.eclipse.jpt.jpa.eclipselink.core.EclipseLinkJpaProject;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
import org.eclipse.jpt.jpa.eclipselink.core.internal.operations.EclipseLinkOrmFileCreationDataModelProvider;
import org.eclipse.jpt.jpa.eclipselink.core.platform.EclipseLinkPlatform;
import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v1_2.EclipseLink1_2;
@@ -47,7 +46,7 @@ public class EclipseLink1_2JpaProjectTests
public void testGetDefaultOrmXmlResource() throws Exception {
JpaXmlResource resource = this.getJpaProject().getDefaultOrmXmlResource();
assertNotNull(resource);
- assertEquals(JptJpaCorePlugin.ORM_XML_CONTENT_TYPE, resource.getContentType());
+ assertEquals(XmlEntityMappings.CONTENT_TYPE, resource.getContentType());
assertEquals("src/META-INF/orm.xml", resource.getFile().getProjectRelativePath().toString());
//delete the orm.xml file and verify it is not returned from getDefaultOrmXmlResource()
@@ -59,7 +58,7 @@ public class EclipseLink1_2JpaProjectTests
createDefaultOrmXmlFileWithEclipseLink1_2ContentType();
resource = this.getJpaProject().getDefaultOrmXmlResource();
assertNotNull(resource);
- assertEquals(JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_1_2_RESOURCE_TYPE, resource.getResourceType());
+ assertEquals(org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml1_2Definition.instance().getResourceType(), resource.getResourceType());
assertEquals("src/META-INF/orm.xml", resource.getFile().getProjectRelativePath().toString());
@@ -73,7 +72,7 @@ public class EclipseLink1_2JpaProjectTests
createDefaultOrmXmlFileWithEclipseLinkContentType();
resource = this.getJpaProject().getDefaultOrmXmlResource();
assertNotNull(resource);
- assertEquals(JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE, resource.getContentType());
+ assertEquals(org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings.CONTENT_TYPE, resource.getContentType());
assertEquals("src/META-INF/orm.xml", resource.getFile().getProjectRelativePath().toString());
@@ -87,7 +86,7 @@ public class EclipseLink1_2JpaProjectTests
createDefaultOrmXmlFile();
resource = this.getJpaProject().getDefaultOrmXmlResource();
assertNotNull(resource);
- assertEquals(JptJpaCorePlugin.ORM_XML_CONTENT_TYPE, resource.getContentType());
+ assertEquals(XmlEntityMappings.CONTENT_TYPE, resource.getContentType());
assertEquals("src/META-INF/orm.xml", resource.getFile().getProjectRelativePath().toString());
}
@@ -99,7 +98,7 @@ public class EclipseLink1_2JpaProjectTests
createDefaultEclipseLink1_2OrmXmlFile();
resource = this.getJpaProject().getDefaultEclipseLinkOrmXmlResource();
assertNotNull(resource);
- assertEquals(JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_1_2_RESOURCE_TYPE, resource.getResourceType());
+ assertEquals(org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml1_2Definition.instance().getResourceType(), resource.getResourceType());
assertEquals("src/META-INF/eclipselink-orm.xml", resource.getFile().getProjectRelativePath().toString());
@@ -123,16 +122,16 @@ public class EclipseLink1_2JpaProjectTests
config.setProperty(JptFileCreationDataModelProperties.CONTAINER_PATH,
getJpaProject().getProject().getFolder("src/META-INF").getFullPath());
config.setProperty(JptFileCreationDataModelProperties.FILE_NAME,
- JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.lastSegment());
+ XmlEntityMappings.DEFAULT_RUNTIME_PATH.lastSegment());
config.getDefaultOperation().execute(null, null);
}
private void createDefaultOrmXmlFileWithEclipseLink1_2ContentType() throws Exception {
- createEclipseLink1_2OrmXmlFile(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.lastSegment());
+ createEclipseLink1_2OrmXmlFile(XmlEntityMappings.DEFAULT_RUNTIME_PATH.lastSegment());
}
private void createDefaultEclipseLink1_2OrmXmlFile() throws Exception {
- createEclipseLink1_2OrmXmlFile(JptJpaEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH.lastSegment());
+ createEclipseLink1_2OrmXmlFile(org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings.DEFAULT_RUNTIME_PATH.lastSegment());
}
private void createEclipseLink1_2OrmXmlFile(String fileName) throws Exception {
@@ -146,19 +145,19 @@ public class EclipseLink1_2JpaProjectTests
}
public void testGetMappingFileResource() throws Exception {
- JpaXmlResource resource = this.getJpaProject().getMappingFileXmlResource(JptJpaEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH);
+ JpaXmlResource resource = this.getJpaProject().getMappingFileXmlResource(org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings.DEFAULT_RUNTIME_PATH);
assertNull(resource);
//add the eclipselink-orm.xml 1.2 file
createDefaultEclipseLink1_2OrmXmlFile();
- resource = this.getJpaProject().getMappingFileXmlResource(JptJpaEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH);
+ resource = this.getJpaProject().getMappingFileXmlResource(org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings.DEFAULT_RUNTIME_PATH);
assertNotNull(resource);
- assertEquals(JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_1_2_RESOURCE_TYPE, resource.getResourceType());
+ assertEquals(org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml1_2Definition.instance().getResourceType(), resource.getResourceType());
assertEquals("src/META-INF/eclipselink-orm.xml", resource.getFile().getProjectRelativePath().toString());
//delete the eclipselink-orm.xml file and verify it is not returned from getMappingFileResource()
resource.delete(null);
- resource = this.getJpaProject().getMappingFileXmlResource(JptJpaEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH);
+ resource = this.getJpaProject().getMappingFileXmlResource(org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings.DEFAULT_RUNTIME_PATH);
assertNull(resource);
}
@@ -170,7 +169,7 @@ public class EclipseLink1_2JpaProjectTests
createEclipseLink1_2OrmXmlFile("orm2.xml");
resource = this.getJpaProject().getMappingFileXmlResource(new Path("META-INF/orm2.xml"));
assertNotNull(resource);
- assertEquals(JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_1_2_RESOURCE_TYPE, resource.getResourceType());
+ assertEquals(org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml1_2Definition.instance().getResourceType(), resource.getResourceType());
assertEquals("src/META-INF/orm2.xml", resource.getFile().getProjectRelativePath().toString());
//delete the orm2.xml file and verify it is not returned from getMappingFileResource()
@@ -182,7 +181,7 @@ public class EclipseLink1_2JpaProjectTests
createEclipseLink1_2OrmXmlFile("orm2.xml");
resource = this.getJpaProject().getMappingFileXmlResource(new Path("META-INF/orm2.xml"));
assertNotNull(resource);
- assertEquals(JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_1_2_RESOURCE_TYPE, resource.getResourceType());
+ assertEquals(org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.EclipseLinkOrmXml1_2Definition.instance().getResourceType(), resource.getResourceType());
assertEquals("src/META-INF/orm2.xml", resource.getFile().getProjectRelativePath().toString());
}
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/EclipseLink2_0ContextModelTestCase.java b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/EclipseLink2_0ContextModelTestCase.java
index e2967967c0..9ca7db55c5 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/EclipseLink2_0ContextModelTestCase.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/EclipseLink2_0ContextModelTestCase.java
@@ -1,16 +1,15 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 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
- *******************************************************************************/
+ * Copyright (c) 2009, 2012 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.jpa.eclipselink.core.tests.internal.context;
-import org.eclipse.jpt.jpa.core.JpaFacet;
+import org.eclipse.jpt.jpa.core.jpa2.JpaProject2_0;
import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
import org.eclipse.jpt.jpa.eclipselink.core.platform.EclipseLinkPlatform;
import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_0.EclipseLink2_0;
@@ -23,7 +22,7 @@ public abstract class EclipseLink2_0ContextModelTestCase extends EclipseLinkCont
@Override
protected String getJpaFacetVersionString() {
- return JpaFacet.VERSION_2_0.getVersionString();
+ return JpaProject2_0.FACET_VERSION_STRING;
}
@Override
diff --git a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/EclipseLink2_1ContextModelTestCase.java b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/EclipseLink2_1ContextModelTestCase.java
index abd561e377..160869ca80 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/EclipseLink2_1ContextModelTestCase.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/EclipseLink2_1ContextModelTestCase.java
@@ -1,15 +1,15 @@
/*******************************************************************************
-* Copyright (c) 2012 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
-*******************************************************************************/
+ * Copyright (c) 2012 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.jpa.eclipselink.core.tests.internal.context;
-import org.eclipse.jpt.jpa.core.JpaFacet;
+import org.eclipse.jpt.jpa.core.jpa2.JpaProject2_0;
import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
import org.eclipse.jpt.jpa.eclipselink.core.platform.EclipseLinkPlatform;
import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_1.EclipseLink2_1;
@@ -22,7 +22,7 @@ public abstract class EclipseLink2_1ContextModelTestCase extends EclipseLinkCont
@Override
protected String getJpaFacetVersionString() {
- return JpaFacet.VERSION_2_0.getVersionString();
+ return JpaProject2_0.FACET_VERSION_STRING;
}
@Override
diff --git a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/EclipseLink2_2ContextModelTestCase.java b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/EclipseLink2_2ContextModelTestCase.java
index 13fbb0ee6f..5f4908de01 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/EclipseLink2_2ContextModelTestCase.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/EclipseLink2_2ContextModelTestCase.java
@@ -1,15 +1,15 @@
/*******************************************************************************
-* Copyright (c) 2011 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
-*******************************************************************************/
+ * Copyright (c) 2011, 2012 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.jpa.eclipselink.core.tests.internal.context;
-import org.eclipse.jpt.jpa.core.JpaFacet;
+import org.eclipse.jpt.jpa.core.jpa2.JpaProject2_0;
import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
import org.eclipse.jpt.jpa.eclipselink.core.platform.EclipseLinkPlatform;
import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_2.EclipseLink2_2;
@@ -22,7 +22,7 @@ public abstract class EclipseLink2_2ContextModelTestCase extends EclipseLinkCont
@Override
protected String getJpaFacetVersionString() {
- return JpaFacet.VERSION_2_0.getVersionString();
+ return JpaProject2_0.FACET_VERSION_STRING;
}
@Override
diff --git a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/EclipseLink2_3ContextModelTestCase.java b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/EclipseLink2_3ContextModelTestCase.java
index dd6efe8e3c..8b1a4585b3 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/EclipseLink2_3ContextModelTestCase.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/EclipseLink2_3ContextModelTestCase.java
@@ -1,15 +1,15 @@
/*******************************************************************************
-* Copyright (c) 2011 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
-*******************************************************************************/
+ * Copyright (c) 2011, 2012 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.jpa.eclipselink.core.tests.internal.context;
-import org.eclipse.jpt.jpa.core.JpaFacet;
+import org.eclipse.jpt.jpa.core.jpa2.JpaProject2_0;
import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
import org.eclipse.jpt.jpa.eclipselink.core.platform.EclipseLinkPlatform;
import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_3.EclipseLink2_3;
@@ -22,7 +22,7 @@ public abstract class EclipseLink2_3ContextModelTestCase extends EclipseLinkCont
@Override
protected String getJpaFacetVersionString() {
- return JpaFacet.VERSION_2_0.getVersionString();
+ return JpaProject2_0.FACET_VERSION_STRING;
}
@Override
diff --git a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/EclipseLinkJpaProjectTests.java b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/EclipseLinkJpaProjectTests.java
index b9d5154465..e39e03e13e 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/EclipseLinkJpaProjectTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/EclipseLinkJpaProjectTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2012 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.
@@ -11,13 +11,12 @@ package org.eclipse.jpt.jpa.eclipselink.core.tests.internal.context;
import org.eclipse.core.runtime.Path;
import org.eclipse.jpt.common.core.internal.operations.JptFileCreationDataModelProperties;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.internal.operations.OrmFileCreationDataModelProvider;
import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
import org.eclipse.jpt.jpa.core.tests.internal.context.ContextModelTestCase;
import org.eclipse.jpt.jpa.eclipselink.core.EclipseLinkJpaProject;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
import org.eclipse.jpt.jpa.eclipselink.core.internal.operations.EclipseLinkOrmFileCreationDataModelProvider;
import org.eclipse.jpt.jpa.eclipselink.core.platform.EclipseLinkPlatform;
import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
@@ -50,7 +49,7 @@ public class EclipseLinkJpaProjectTests
public void testGetDefaultOrmXmlResource() throws Exception {
JpaXmlResource resource = this.getJpaProject().getDefaultOrmXmlResource();
assertNotNull(resource);
- assertEquals(JptJpaCorePlugin.ORM_XML_CONTENT_TYPE, resource.getContentType());
+ assertEquals(XmlEntityMappings.CONTENT_TYPE, resource.getContentType());
assertEquals("src/META-INF/orm.xml", resource.getFile().getProjectRelativePath().toString());
//delete the orm.xml file and verify it is not returned from getDefaultOrmXmlResource()
@@ -62,7 +61,7 @@ public class EclipseLinkJpaProjectTests
createDefaultOrmXmlFileWithEclipseLinkContentType();
resource = this.getJpaProject().getDefaultOrmXmlResource();
assertNotNull(resource);
- assertEquals(JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE, resource.getContentType());
+ assertEquals(org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings.CONTENT_TYPE, resource.getContentType());
assertEquals("src/META-INF/orm.xml", resource.getFile().getProjectRelativePath().toString());
@@ -76,7 +75,7 @@ public class EclipseLinkJpaProjectTests
createDefaultOrmXmlFile();
resource = this.getJpaProject().getDefaultOrmXmlResource();
assertNotNull(resource);
- assertEquals(JptJpaCorePlugin.ORM_XML_CONTENT_TYPE, resource.getContentType());
+ assertEquals(XmlEntityMappings.CONTENT_TYPE, resource.getContentType());
assertEquals("src/META-INF/orm.xml", resource.getFile().getProjectRelativePath().toString());
}
@@ -88,7 +87,7 @@ public class EclipseLinkJpaProjectTests
createDefaultEclipseLinkOrmXmlFile();
resource = this.getJpaProject().getDefaultEclipseLinkOrmXmlResource();
assertNotNull(resource);
- assertEquals(JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE, resource.getContentType());
+ assertEquals(org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings.CONTENT_TYPE, resource.getContentType());
assertEquals("src/META-INF/eclipselink-orm.xml", resource.getFile().getProjectRelativePath().toString());
@@ -107,11 +106,11 @@ public class EclipseLinkJpaProjectTests
}
private void createDefaultOrmXmlFileWithEclipseLinkContentType() throws Exception {
- createEclipseLinkOrmXmlFile(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.lastSegment());
+ createEclipseLinkOrmXmlFile(XmlEntityMappings.DEFAULT_RUNTIME_PATH.lastSegment());
}
private void createDefaultEclipseLinkOrmXmlFile() throws Exception {
- createEclipseLinkOrmXmlFile(JptJpaEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH.lastSegment());
+ createEclipseLinkOrmXmlFile(org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings.DEFAULT_RUNTIME_PATH.lastSegment());
}
private void createEclipseLinkOrmXmlFile(String fileName) throws Exception {
@@ -124,19 +123,19 @@ public class EclipseLinkJpaProjectTests
}
public void testGetMappingFileResource() throws Exception {
- JpaXmlResource resource = this.getJpaProject().getMappingFileXmlResource(JptJpaEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH);
+ JpaXmlResource resource = this.getJpaProject().getMappingFileXmlResource(org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings.DEFAULT_RUNTIME_PATH);
assertNull(resource);
//add the eclipselink-orm.xml file
createDefaultEclipseLinkOrmXmlFile();
- resource = this.getJpaProject().getMappingFileXmlResource(JptJpaEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH);
+ resource = this.getJpaProject().getMappingFileXmlResource(org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings.DEFAULT_RUNTIME_PATH);
assertNotNull(resource);
- assertEquals(JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE, resource.getContentType());
+ assertEquals(org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings.CONTENT_TYPE, resource.getContentType());
assertEquals("src/META-INF/eclipselink-orm.xml", resource.getFile().getProjectRelativePath().toString());
//delete the eclipselink-orm.xml file and verify it is not returned from getMappingFileResource()
resource.delete(null);
- resource = this.getJpaProject().getMappingFileXmlResource(JptJpaEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH);
+ resource = this.getJpaProject().getMappingFileXmlResource(org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings.DEFAULT_RUNTIME_PATH);
assertNull(resource);
}
@@ -148,7 +147,7 @@ public class EclipseLinkJpaProjectTests
createEclipseLinkOrmXmlFile("orm2.xml");
resource = this.getJpaProject().getMappingFileXmlResource(new Path("META-INF/orm2.xml"));
assertNotNull(resource);
- assertEquals(JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE, resource.getContentType());
+ assertEquals(org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings.CONTENT_TYPE, resource.getContentType());
assertEquals("src/META-INF/orm2.xml", resource.getFile().getProjectRelativePath().toString());
//delete the orm2.xml file and verify it is not returned from getMappingFileResource()
@@ -160,7 +159,7 @@ public class EclipseLinkJpaProjectTests
createEclipseLinkOrmXmlFile("orm2.xml");
resource = this.getJpaProject().getMappingFileXmlResource(new Path("META-INF/orm2.xml"));
assertNotNull(resource);
- assertEquals(JptJpaEclipseLinkCorePlugin.ECLIPSELINK_ORM_XML_CONTENT_TYPE, resource.getContentType());
+ assertEquals(org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings.CONTENT_TYPE, resource.getContentType());
assertEquals("src/META-INF/orm2.xml", resource.getFile().getProjectRelativePath().toString());
}
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLink2_0OrmCollectionTableTests.java b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLink2_0OrmCollectionTableTests.java
index 58ab370e5a..bef133e6bd 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLink2_0OrmCollectionTableTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLink2_0OrmCollectionTableTests.java
@@ -13,7 +13,6 @@ import java.util.Iterator;
import java.util.ListIterator;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.JoinColumn;
import org.eclipse.jpt.jpa.core.context.UniqueConstraint;
@@ -37,6 +36,7 @@ import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
import org.eclipse.jpt.jpa.core.resource.orm.XmlCollectionTable;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.orm.XmlUniqueConstraint;
import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlElementCollection_2_0;
import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
@@ -55,7 +55,7 @@ public class EclipseLink2_0OrmCollectionTableTests
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ mappingFileRef.setFileName(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLink2_1PersistenceUnitDefaultsTests.java b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLink2_1PersistenceUnitDefaultsTests.java
index 39c93db3c2..6550dc0893 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLink2_1PersistenceUnitDefaultsTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLink2_1PersistenceUnitDefaultsTests.java
@@ -14,10 +14,10 @@ import org.eclipse.jpt.jpa.core.context.orm.OrmPersistenceUnitDefaults;
import org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitMetadata;
import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkAccessType;
import org.eclipse.jpt.jpa.eclipselink.core.context.orm.EclipseLinkPersistenceUnitDefaults;
import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmFactory;
+import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlPersistenceUnitDefaults;
import org.eclipse.jpt.jpa.eclipselink.core.tests.internal.context.EclipseLink2_1ContextModelTestCase;
@@ -34,7 +34,7 @@ public class EclipseLink2_1PersistenceUnitDefaultsTests
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptJpaEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH.toString());
+ mappingFileRef.setFileName(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmPersistentAttributeTests.java b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmPersistentAttributeTests.java
index f19d5ddd58..201456a66e 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmPersistentAttributeTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmPersistentAttributeTests.java
@@ -15,7 +15,6 @@ import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement.Kind;
import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.AccessType;
import org.eclipse.jpt.jpa.core.context.BasicMapping;
@@ -27,6 +26,7 @@ import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyPersistentAttribute;
import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaNullAttributeMapping;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.orm.OrmEclipseLinkIdMapping;
@@ -45,7 +45,7 @@ public class EclipseLinkOrmPersistentAttributeTests
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ mappingFileRef.setFileName(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkPersistenceUnitDefaultsTests.java b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkPersistenceUnitDefaultsTests.java
index 6691af01df..9e0fda537d 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkPersistenceUnitDefaultsTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkPersistenceUnitDefaultsTests.java
@@ -14,8 +14,8 @@ import org.eclipse.jpt.jpa.core.context.orm.OrmPersistenceUnitDefaults;
import org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitMetadata;
import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmFactory;
+import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlPersistenceUnitDefaults;
import org.eclipse.jpt.jpa.eclipselink.core.tests.internal.context.EclipseLinkContextModelTestCase;
@@ -32,7 +32,7 @@ public class EclipseLinkPersistenceUnitDefaultsTests
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptJpaEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH.toString());
+ mappingFileRef.setFileName(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkPersistenceUnitMetadataTests.java b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkPersistenceUnitMetadataTests.java
index ae3984ff89..8b2f096ea6 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkPersistenceUnitMetadataTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkPersistenceUnitMetadataTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 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.
@@ -12,8 +12,8 @@ package org.eclipse.jpt.jpa.eclipselink.core.tests.internal.context.orm;
import org.eclipse.jpt.jpa.core.context.orm.OrmPersistenceUnitMetadata;
import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmFactory;
+import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlPersistenceUnitMetadata;
import org.eclipse.jpt.jpa.eclipselink.core.tests.internal.context.EclipseLinkContextModelTestCase;
@@ -29,7 +29,7 @@ public class EclipseLinkPersistenceUnitMetadataTests
protected void setUp() throws Exception {
super.setUp();
XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
- mappingFileRef.setFileName(JptJpaEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH.toString());
+ mappingFileRef.setFileName(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
getXmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
getPersistenceXmlResource().save(null);
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/EclipseLink2_0PersistenceUnitTestCase.java b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/EclipseLink2_0PersistenceUnitTestCase.java
index 55a6479832..62bb4e3e18 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/EclipseLink2_0PersistenceUnitTestCase.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/EclipseLink2_0PersistenceUnitTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2012 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.
@@ -11,8 +11,8 @@ package org.eclipse.jpt.jpa.eclipselink.core.tests.internal.context.persistence;
import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel;
import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.jpa.core.JpaFacet;
import org.eclipse.jpt.jpa.core.internal.facet.JpaFacetDataModelProperties;
+import org.eclipse.jpt.jpa.core.jpa2.JpaProject2_0;
import org.eclipse.jpt.jpa.core.tests.internal.context.persistence.PersistenceUnitTestCase;
import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceUnit;
import org.eclipse.jpt.jpa.eclipselink.core.platform.EclipseLinkPlatform;
@@ -44,7 +44,7 @@ public abstract class EclipseLink2_0PersistenceUnitTestCase extends PersistenceU
@Override
protected IDataModel buildJpaConfigDataModel() {
IDataModel dataModel = super.buildJpaConfigDataModel();
- dataModel.setProperty(IFacetDataModelProperties.FACET_VERSION_STR, JpaFacet.VERSION_2_0.getVersionString());
+ dataModel.setProperty(IFacetDataModelProperties.FACET_VERSION_STR, JpaProject2_0.FACET_VERSION_STRING);
dataModel.setProperty(JpaFacetDataModelProperties.PLATFORM, EclipseLinkPlatform.VERSION_2_0);
return dataModel;
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/EclipseLink2_2JpaMetadataConversionTests.java b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/EclipseLink2_2JpaMetadataConversionTests.java
index 0eecf5c287..94224faaa5 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/EclipseLink2_2JpaMetadataConversionTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/EclipseLink2_2JpaMetadataConversionTests.java
@@ -16,15 +16,14 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.java.JavaEntity;
import org.eclipse.jpt.jpa.core.context.java.JavaIdMapping;
import org.eclipse.jpt.jpa.core.context.orm.EntityMappings;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.tests.internal.jpa2.context.persistence.Generic2_0JpaMetadataConversionTests;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkConversionValue;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkConvertibleMapping;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkCustomConverter;
@@ -116,7 +115,7 @@ public class EclipseLink2_2JpaMetadataConversionTests extends EclipseLink2_2Cont
PersistenceUnit persistenceUnit = getPersistenceUnit();
- addXmlMappingFileRef(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ addXmlMappingFileRef(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
EntityMappings entityMappings = getEntityMappings();
persistenceUnit.convertJavaQueries(entityMappings, progressMonitor);
@@ -137,7 +136,7 @@ public class EclipseLink2_2JpaMetadataConversionTests extends EclipseLink2_2Cont
JavaEntity entity = getJavaEntity();
- addXmlMappingFileRef(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ addXmlMappingFileRef(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
EntityMappings entityMappings = getEntityMappings();
persistenceUnit.convertJavaQueries(entityMappings, progressMonitor);
@@ -208,7 +207,7 @@ public class EclipseLink2_2JpaMetadataConversionTests extends EclipseLink2_2Cont
JavaEntity entity = getJavaEntity();
JavaIdMapping mapping = (JavaIdMapping)entity.getIdAttribute().getMapping();
- addXmlMappingFileRef(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ addXmlMappingFileRef(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
EntityMappings entityMappings = getEntityMappings();
persistenceUnit.convertJavaGenerators(entityMappings, progressMonitor);
@@ -231,7 +230,7 @@ public class EclipseLink2_2JpaMetadataConversionTests extends EclipseLink2_2Cont
JavaEntity entity = getJavaEntity();
JavaIdMapping mapping = (JavaIdMapping)entity.getIdAttribute().getMapping();
- addXmlMappingFileRef(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ addXmlMappingFileRef(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
EntityMappings entityMappings = getEntityMappings();
persistenceUnit.convertJavaGenerators(entityMappings, progressMonitor);
@@ -386,7 +385,7 @@ public class EclipseLink2_2JpaMetadataConversionTests extends EclipseLink2_2Cont
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
JavaEclipseLinkEntity entity = getJavaEntity();
- addXmlMappingFileRef(JptJpaEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH.toString());
+ addXmlMappingFileRef(org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
EclipseLinkEntityMappings entityMappings = getEntityMappings();
EclipseLinkPersistenceUnit persistenceUnit = getPersistenceUnit();
@@ -435,7 +434,7 @@ public class EclipseLink2_2JpaMetadataConversionTests extends EclipseLink2_2Cont
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
JavaEclipseLinkEntity entity = getJavaEntity();
- addXmlMappingFileRef(JptJpaEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH.toString());
+ addXmlMappingFileRef(org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
EclipseLinkEntityMappings entityMappings = getEntityMappings();
EclipseLinkPersistenceUnit persistenceUnit = getPersistenceUnit();
@@ -463,7 +462,7 @@ public class EclipseLink2_2JpaMetadataConversionTests extends EclipseLink2_2Cont
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
JavaEclipseLinkEntity entity = getJavaEntity();
- addXmlMappingFileRef(JptJpaEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH.toString());
+ addXmlMappingFileRef(org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
EclipseLinkEntityMappings entityMappings = getEntityMappings();
EclipseLinkPersistenceUnit persistenceUnit = getPersistenceUnit();
@@ -489,7 +488,7 @@ public class EclipseLink2_2JpaMetadataConversionTests extends EclipseLink2_2Cont
createTestEntityWithDuplicateConvertersOfDiffTypes();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- addXmlMappingFileRef(JptJpaEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH.toString());
+ addXmlMappingFileRef(org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
EclipseLinkEntityMappings entityMappings = getEntityMappings();
OrmEclipseLinkConverterContainer ormConvertercontainer = entityMappings.getConverterContainer();
EclipseLinkCustomConverter converter = ormConvertercontainer.addCustomConverter(ormConvertercontainer.getCustomConvertersSize());
@@ -525,7 +524,7 @@ public class EclipseLink2_2JpaMetadataConversionTests extends EclipseLink2_2Cont
JavaEclipseLinkEntity entity = getJavaEntity();
EclipseLinkConvertibleMapping mapping = (EclipseLinkConvertibleMapping)entity.getAttributeMappings().iterator().next();
- addXmlMappingFileRef(JptJpaEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH.toString());
+ addXmlMappingFileRef(org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
EclipseLinkEntityMappings entityMappings = getEntityMappings();
persistenceUnit.convertJavaConverters(entityMappings, progressMonitor);
@@ -551,7 +550,7 @@ public class EclipseLink2_2JpaMetadataConversionTests extends EclipseLink2_2Cont
JavaEclipseLinkEntity entity = getJavaEntity();
EclipseLinkConvertibleMapping mapping = (EclipseLinkConvertibleMapping)entity.getAttributeMappings().iterator().next();
- addXmlMappingFileRef(JptJpaEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH.toString());
+ addXmlMappingFileRef(org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
EclipseLinkEntityMappings entityMappings = getEntityMappings();
persistenceUnit.convertJavaConverters(entityMappings, progressMonitor);
@@ -577,7 +576,7 @@ public class EclipseLink2_2JpaMetadataConversionTests extends EclipseLink2_2Cont
JavaEclipseLinkEntity entity = getJavaEntity();
EclipseLinkConvertibleMapping mapping = (EclipseLinkConvertibleMapping)entity.getAttributeMappings().iterator().next();
- addXmlMappingFileRef(JptJpaEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH.toString());
+ addXmlMappingFileRef(org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
EclipseLinkEntityMappings entityMappings = getEntityMappings();
persistenceUnit.convertJavaConverters(entityMappings, progressMonitor);
@@ -641,7 +640,7 @@ public class EclipseLink2_2JpaMetadataConversionTests extends EclipseLink2_2Cont
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
JavaEclipseLinkEmbeddable embeddable = getJavaEmbeddable();
- addXmlMappingFileRef(JptJpaEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH.toString());
+ addXmlMappingFileRef(org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
EclipseLinkEntityMappings entityMappings = getEntityMappings();
EclipseLinkPersistenceUnit persistenceUnit = getPersistenceUnit();
@@ -690,7 +689,7 @@ public class EclipseLink2_2JpaMetadataConversionTests extends EclipseLink2_2Cont
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
JavaEclipseLinkEmbeddable embeddable = getJavaEmbeddable();
- addXmlMappingFileRef(JptJpaEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH.toString());
+ addXmlMappingFileRef(org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
EclipseLinkEntityMappings entityMappings = getEntityMappings();
EclipseLinkPersistenceUnit persistenceUnit = getPersistenceUnit();
@@ -754,7 +753,7 @@ public class EclipseLink2_2JpaMetadataConversionTests extends EclipseLink2_2Cont
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
JavaEclipseLinkMappedSuperclass mappedSuperclass = getJavaMappedSuperclass();
- addXmlMappingFileRef(JptJpaEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH.toString());
+ addXmlMappingFileRef(org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
EclipseLinkEntityMappings entityMappings = getEntityMappings();
EclipseLinkPersistenceUnit persistenceUnit = getPersistenceUnit();
@@ -803,7 +802,7 @@ public class EclipseLink2_2JpaMetadataConversionTests extends EclipseLink2_2Cont
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
JavaEclipseLinkMappedSuperclass mappedSuperclass = getJavaMappedSuperclass();
- addXmlMappingFileRef(JptJpaEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH.toString());
+ addXmlMappingFileRef(org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
EclipseLinkEntityMappings entityMappings = getEntityMappings();
EclipseLinkPersistenceUnit persistenceUnit = getPersistenceUnit();
diff --git a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/EclipseLink2_4LoggingTests.java b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/EclipseLink2_4LoggingTests.java
index 62b4ff237c..3c6ff84a9b 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/EclipseLink2_4LoggingTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/EclipseLink2_4LoggingTests.java
@@ -10,9 +10,9 @@
package org.eclipse.jpt.jpa.eclipselink.core.tests.internal.context.persistence;
import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener;
-import org.eclipse.jpt.jpa.core.JpaFacet;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnitProperties;
import org.eclipse.jpt.jpa.core.internal.facet.JpaFacetDataModelProperties;
+import org.eclipse.jpt.jpa.core.jpa2.JpaProject2_0;
import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.Logging2_0;
import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.Logging2_4;
import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.LoggingLevel;
@@ -101,7 +101,7 @@ public class EclipseLink2_4LoggingTests extends EclipseLink2_0PersistenceUnitTes
@Override
protected IDataModel buildJpaConfigDataModel() {
IDataModel dataModel = super.buildJpaConfigDataModel();
- dataModel.setProperty(IFacetDataModelProperties.FACET_VERSION_STR, JpaFacet.VERSION_2_0.getVersionString());
+ dataModel.setProperty(IFacetDataModelProperties.FACET_VERSION_STR, JpaProject2_0.FACET_VERSION_STRING);
dataModel.setProperty(JpaFacetDataModelProperties.PLATFORM, EclipseLinkPlatform.VERSION_2_4);
return dataModel;
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/EclipseLinkPersistenceUnitTests.java b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/EclipseLinkPersistenceUnitTests.java
index f39bd0a27a..ad420fbe49 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/EclipseLinkPersistenceUnitTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/EclipseLinkPersistenceUnitTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2012 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.
@@ -27,9 +27,9 @@ import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit;
import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
import org.eclipse.jpt.jpa.core.tests.internal.projects.TestJpaProject;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceUnit;
import org.eclipse.jpt.jpa.eclipselink.core.internal.operations.EclipseLinkOrmFileCreationDataModelProvider;
+import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.eclipselink.core.tests.internal.context.EclipseLinkContextModelTestCase;
import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
@@ -162,7 +162,7 @@ public class EclipseLinkPersistenceUnitTests
//test persistentType from orm.xml file that is specified in the persistence.xml
- addXmlMappingFileRef(JptJpaEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH.toString());
+ addXmlMappingFileRef(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
assertNotNull(persistenceUnit.getPersistentType("model.Foo"));
assertEquals(ormPersistentType, persistenceUnit.getPersistentType("model.Foo"));
diff --git a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/metadata/EclipseLinkStaticWeavingBuilderMetadataTests.java b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/metadata/EclipseLinkStaticWeavingBuilderMetadataTests.java
deleted file mode 100644
index e10ad455cf..0000000000
--- a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/metadata/EclipseLinkStaticWeavingBuilderMetadataTests.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2012 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.jpa.eclipselink.core.tests.internal.metadata;
-
-import junit.framework.Assert;
-
-import org.eclipse.jpt.jpa.core.tests.internal.metadata.JpaMetadataTests;
-import org.eclipse.jpt.jpa.eclipselink.core.builder.EclipseLinkStaticWeavingBuilderConfigurator;
-
-/**
- * JpaStaticWeavingBuilderMetadataTests
- */
-public class EclipseLinkStaticWeavingBuilderMetadataTests extends JpaMetadataTests {
-
- public static final String SOURCE_PREF_KEY = "staticweave.SOURCE"; //$NON-NLS-1$
- public static final String LOG_LEVEL_PREF_KEY = "staticweave.LOG_LEVEL"; //$NON-NLS-1$
-
- public static final String SOURCE_TEST_VALUE = "bin"; //$NON-NLS-1$
- public static final String LOG_LEVEL_TEST_VALUE = "ALL"; //$NON-NLS-1$
-
- protected EclipseLinkStaticWeavingBuilderConfigurator projectPrefsManager;
-
- // ********** constructor **********
-
- public EclipseLinkStaticWeavingBuilderMetadataTests(String name) {
- super(name);
- }
-
- // ********** overrides **********
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
-
- this.projectPrefsManager = new EclipseLinkStaticWeavingBuilderConfigurator(this.getJavaProject().getProject());
- Assert.assertNotNull(this.projectPrefsManager);
- }
-
- // ********** tests **********
-
- public void testSourceLocationProjectMetadata() throws Exception {
-
- this.projectPrefsManager.setSourceLocationPreference(SOURCE_TEST_VALUE);
- this.projectPrefsManager.getLegacyProjectPreferences().flush();
-
- String value = this.getProjectPrefs().get(SOURCE_PREF_KEY);
- Assert.assertNotNull(value);
- Assert.assertTrue(SOURCE_TEST_VALUE.equals(value));
- }
-
- public void testLogLevelProjectMetadata() throws Exception {
-
- this.projectPrefsManager.setLogLevelPreference(LOG_LEVEL_TEST_VALUE);
- this.projectPrefsManager.getLegacyProjectPreferences().flush();
-
- String value = this.getProjectPrefs().get(LOG_LEVEL_PREF_KEY);
- Assert.assertNotNull(value);
- Assert.assertTrue(LOG_LEVEL_TEST_VALUE.equals(value));
- }
-} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/metadata/JptJpaEclipseLinkCoreMetadataTests.java b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/metadata/JptJpaEclipseLinkCoreMetadataTests.java
deleted file mode 100644
index ce8adf5e40..0000000000
--- a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/metadata/JptJpaEclipseLinkCoreMetadataTests.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2012 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.jpa.eclipselink.core.tests.internal.metadata;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-
-/**
- * JptJpaEclipseLinkCoreMetadataTests
- */
-public class JptJpaEclipseLinkCoreMetadataTests {
-
- public static Test suite() {
- TestSuite suite = new TestSuite(JptJpaEclipseLinkCoreMetadataTests.class.getPackage().getName());
- suite.addTestSuite(EclipseLinkStaticWeavingBuilderMetadataTests.class);
- return suite;
- }
-
- private JptJpaEclipseLinkCoreMetadataTests() {
- super();
- throw new UnsupportedOperationException();
- }
-
-} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/test.xml b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/test.xml
index 41a8dcde8f..82b0e8ec90 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/test.xml
+++ b/jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/test.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?> <!--
- Copyright (c) 2008, 2010 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 -->
+ Copyright (c) 2008, 2012 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 -->
<project name="testsuite" default="run" basedir=".">
<!-- The property ${eclipse-home} should be passed into this script -->
@@ -21,8 +21,7 @@
</delete>
</target>
- <!-- This target defines the tests that need to be run. -->
- <target name="suite1">
+ <!-- Test suite is split up to prevent time-outs during the WTP build. --> <!-- Keep these suites in sync with those listed in JptJpaEclipseLinkCoreTests. --> <target name="suite1">
<property file="${testRoot}/testServer.properties"/>
<property name="jpt-folder" value="${eclipse-home}/jpt_folder"/>
<delete dir="${jpt-folder}" quiet="true"/>
@@ -35,7 +34,7 @@
<property name="extraVMargs" value="-Dorg.eclipse.jpt.jpa.jar=${testDir}/${jpt-persistence-jar} -Dorg.eclipse.jpt.eclipselink.jar=${testDir}/${jpt-eclipselink-jar}"/>
</ant>
</target>
- <target name="suite2"> <property file="${testRoot}/testServer.properties"/> <property name="jpt-folder" value="${eclipse-home}/jpt_folder"/> <delete dir="${jpt-folder}" quiet="true"/> <ant target="core-test" antfile="${library-file}" dir="${eclipse-home}"> <property name="data-dir" value="${jpt-folder}"/> <property name="plugin-name" value="${plugin-name}"/> <property name="classname" value="org.eclipse.jpt.jpa.eclipselink.core.tests.internal.context.JptJpaEclipseLinkCoreContextModelTests" /> <property name="plugin-path" value="${eclipse-home}/plugins/${plugin-name}"/> <property name="extraVMargs" value="-Dorg.eclipse.jpt.jpa.jar=${testDir}/${jpt-persistence-jar} -Dorg.eclipse.jpt.eclipselink.jar=${testDir}/${jpt-eclipselink-jar}"/> </ant> </target> <target name="suite3"> <property file="${testRoot}/testServer.properties"/> <property name="jpt-folder" value="${eclipse-home}/jpt_folder"/> <delete dir="${jpt-folder}" quiet="true"/> <ant target="core-test" antfile="${library-file}" dir="${eclipse-home}"> <property name="data-dir" value="${jpt-folder}"/> <property name="plugin-name" value="${plugin-name}"/> <property name="classname" value="org.eclipse.jpt.jpa.eclipselink.core.tests.internal.metadata.JptJpaEclipseLinkCoreMetadataTests" /> <property name="plugin-path" value="${eclipse-home}/plugins/${plugin-name}"/> <property name="extraVMargs" value="-Dorg.eclipse.jpt.jpa.jar=${testDir}/${jpt-persistence-jar} -Dorg.eclipse.jpt.eclipselink.jar=${testDir}/${jpt-eclipselink-jar}"/> </ant> </target>
+ <target name="suite2"> <property file="${testRoot}/testServer.properties"/> <property name="jpt-folder" value="${eclipse-home}/jpt_folder"/> <delete dir="${jpt-folder}" quiet="true"/> <ant target="core-test" antfile="${library-file}" dir="${eclipse-home}"> <property name="data-dir" value="${jpt-folder}"/> <property name="plugin-name" value="${plugin-name}"/> <property name="classname" value="org.eclipse.jpt.jpa.eclipselink.core.tests.internal.context.JptJpaEclipseLinkCoreContextModelTests" /> <property name="plugin-path" value="${eclipse-home}/plugins/${plugin-name}"/> <property name="extraVMargs" value="-Dorg.eclipse.jpt.jpa.jar=${testDir}/${jpt-persistence-jar} -Dorg.eclipse.jpt.eclipselink.jar=${testDir}/${jpt-eclipselink-jar}"/> </ant> </target> <target name="suite3"> <property file="${testRoot}/testServer.properties"/> <property name="jpt-folder" value="${eclipse-home}/jpt_folder"/> <delete dir="${jpt-folder}" quiet="true"/> <ant target="core-test" antfile="${library-file}" dir="${eclipse-home}"> <property name="data-dir" value="${jpt-folder}"/> <property name="plugin-name" value="${plugin-name}"/> <property name="classname" value="org.eclipse.jpt.jpa.eclipselink.core.tests.internal.JptJpaEclipseLinkCoreMiscTests" /> <property name="plugin-path" value="${eclipse-home}/plugins/${plugin-name}"/> <property name="extraVMargs" value="-Dorg.eclipse.jpt.jpa.jar=${testDir}/${jpt-persistence-jar} -Dorg.eclipse.jpt.eclipselink.jar=${testDir}/${jpt-eclipselink-jar}"/> </ant> </target>
<!-- This target holds code to cleanup the testing environment after -->
<!-- after all of the tests have been run. You can use this target to -->
<!-- delete temporary files that have been created. -->
diff --git a/jpa/tests/org.eclipse.jpt.jpa.gen.tests/META-INF/MANIFEST.MF b/jpa/tests/org.eclipse.jpt.jpa.gen.tests/META-INF/MANIFEST.MF
index d666f3ae1a..765f0e963e 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.gen.tests/META-INF/MANIFEST.MF
+++ b/jpa/tests/org.eclipse.jpt.jpa.gen.tests/META-INF/MANIFEST.MF
@@ -2,13 +2,17 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
-Bundle-SymbolicName: org.eclipse.jpt.jpa.gen.tests
+Bundle-SymbolicName: org.eclipse.jpt.jpa.gen.tests;singleton:=true
Bundle-Version: 3.0.0.qualifier
+Bundle-ActivationPolicy: lazy
+Bundle-ClassPath: .
+Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Require-Bundle: org.eclipse.core.runtime;bundle-version="3.4.0",
org.eclipse.jdt.core;bundle-version="3.4.0",
org.eclipse.jpt.common.utility;bundle-version="[2.0.0,3.0.0)",
org.eclipse.jpt.jpa.db;bundle-version="[2.0.0,3.0.0)",
org.eclipse.jpt.jpa.gen;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.jpt.common.core.tests;bundle-version="[1.0.0,2.0.0)",
org.junit;bundle-version="[4.0.0,5.0.0)"
Export-Package: org.eclipse.jpt.jpa.gen.tests.internal;x-internal:=true
diff --git a/jpa/tests/org.eclipse.jpt.jpa.gen.tests/src/org/eclipse/jpt/jpa/gen/tests/internal/EntityGenToolsTests.java b/jpa/tests/org.eclipse.jpt.jpa.gen.tests/src/org/eclipse/jpt/jpa/gen/tests/internal/EntityGenToolsTests.java
index 25e870f97a..b8cff48d20 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.gen.tests/src/org/eclipse/jpt/jpa/gen/tests/internal/EntityGenToolsTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.gen.tests/src/org/eclipse/jpt/jpa/gen/tests/internal/EntityGenToolsTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2012 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.
@@ -10,13 +10,9 @@
package org.eclipse.jpt.jpa.gen.tests.internal;
import java.util.HashSet;
-import org.eclipse.jpt.jpa.gen.internal.util.EntityGenTools;
-
import junit.framework.TestCase;
+import org.eclipse.jpt.jpa.gen.internal.util.EntityGenTools;
-/**
- *
- */
@SuppressWarnings("nls")
public class EntityGenToolsTests extends TestCase {
@@ -62,7 +58,7 @@ public class EntityGenToolsTests extends TestCase {
public void testConvertToUniqueJavaStyleClassName4() {
HashSet<String> names = new HashSet<String>();
assertEquals("FooBar", EntityGenTools.convertToUniqueJavaStyleClassName("FooBar", names));
- assertEquals("Foo_bar", EntityGenTools.convertToUniqueJavaStyleClassName("foo_bar", names));
+ assertEquals("FooBar", EntityGenTools.convertToUniqueJavaStyleClassName("foo_bar", names));
assertEquals("FooBar", EntityGenTools.convertToUniqueJavaStyleClassName("FOO_BAR", names));
assertEquals("FooBar", EntityGenTools.convertToUniqueJavaStyleClassName("_FOO_BAR", names));
assertEquals("FooBar", EntityGenTools.convertToUniqueJavaStyleClassName("FOO_BAR_", names));
@@ -74,7 +70,7 @@ public class EntityGenToolsTests extends TestCase {
HashSet<String> names = new HashSet<String>();
names.add("FooBar");
assertEquals("FooBar2", EntityGenTools.convertToUniqueJavaStyleClassName("FooBar", names));
- assertEquals("Foo_bar", EntityGenTools.convertToUniqueJavaStyleClassName("foo_bar", names));
+ assertEquals("FooBar2", EntityGenTools.convertToUniqueJavaStyleClassName("foo_bar", names));
assertEquals("FooBar2", EntityGenTools.convertToUniqueJavaStyleClassName("FOO_BAR", names));
assertEquals("FooBar2", EntityGenTools.convertToUniqueJavaStyleClassName("_FOO_BAR", names));
assertEquals("FooBar2", EntityGenTools.convertToUniqueJavaStyleClassName("FOO_BAR_", names));
@@ -120,7 +116,7 @@ public class EntityGenToolsTests extends TestCase {
public void testConvertToUniqueJavaStyleAttributeName4() {
HashSet<String> names = new HashSet<String>();
assertEquals("fooBar", EntityGenTools.convertToUniqueJavaStyleAttributeName("FooBar", names));
- assertEquals("foo_bar", EntityGenTools.convertToUniqueJavaStyleAttributeName("foo_bar", names));
+ assertEquals("fooBar", EntityGenTools.convertToUniqueJavaStyleAttributeName("foo_bar", names));
assertEquals("fooBar", EntityGenTools.convertToUniqueJavaStyleAttributeName("FOO_BAR", names));
assertEquals("fooBar", EntityGenTools.convertToUniqueJavaStyleAttributeName("_FOO_BAR", names));
assertEquals("fooBar", EntityGenTools.convertToUniqueJavaStyleAttributeName("FOO_BAR_", names));
@@ -132,12 +128,11 @@ public class EntityGenToolsTests extends TestCase {
HashSet<String> names = new HashSet<String>();
names.add("FooBar");
assertEquals("fooBar2", EntityGenTools.convertToUniqueJavaStyleAttributeName("FooBar", names));
- assertEquals("foo_bar", EntityGenTools.convertToUniqueJavaStyleAttributeName("foo_bar", names));
+ assertEquals("fooBar2", EntityGenTools.convertToUniqueJavaStyleAttributeName("foo_bar", names));
assertEquals("fooBar2", EntityGenTools.convertToUniqueJavaStyleAttributeName("FOO_BAR", names));
assertEquals("fooBar2", EntityGenTools.convertToUniqueJavaStyleAttributeName("_FOO_BAR", names));
assertEquals("fooBar2", EntityGenTools.convertToUniqueJavaStyleAttributeName("FOO_BAR_", names));
assertEquals("fooBar_", EntityGenTools.convertToUniqueJavaStyleAttributeName("FOO_BAR_*", names));
assertEquals("_fooBar", EntityGenTools.convertToUniqueJavaStyleAttributeName("4FOO_BAR", names));
}
-
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.gen.tests/src/org/eclipse/jpt/jpa/gen/tests/internal/JptJpaGenTests.java b/jpa/tests/org.eclipse.jpt.jpa.gen.tests/src/org/eclipse/jpt/jpa/gen/tests/internal/JptJpaGenTests.java
index 530dd84d72..ae5f855328 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.gen.tests/src/org/eclipse/jpt/jpa/gen/tests/internal/JptJpaGenTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.gen.tests/src/org/eclipse/jpt/jpa/gen/tests/internal/JptJpaGenTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2012 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.
@@ -11,16 +11,15 @@ package org.eclipse.jpt.jpa.gen.tests.internal;
import junit.framework.Test;
import junit.framework.TestSuite;
-import org.eclipse.jpt.jpa.gen.tests.internal.EntityGenToolsTests;
+import org.eclipse.jpt.common.core.tests.BundleActivatorTest;
+import org.eclipse.jpt.jpa.gen.internal.util.EntityGenTools;
-/**
- *
- */
public class JptJpaGenTests {
public static Test suite() {
- TestSuite suite = new TestSuite("JPT Entity Generation Tests"); //$NON-NLS-1$
+ TestSuite suite = new TestSuite("JPA Entity Generation Tests"); //$NON-NLS-1$
suite.addTestSuite(EntityGenToolsTests.class);
+ suite.addTest(new BundleActivatorTest(EntityGenTools.class));
return suite;
}
@@ -28,5 +27,4 @@ public class JptJpaGenTests {
super();
throw new UnsupportedOperationException();
}
-
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.ui.tests/META-INF/MANIFEST.MF b/jpa/tests/org.eclipse.jpt.jpa.ui.tests/META-INF/MANIFEST.MF
index f0f41e0cdb..76c5397902 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.ui.tests/META-INF/MANIFEST.MF
+++ b/jpa/tests/org.eclipse.jpt.jpa.ui.tests/META-INF/MANIFEST.MF
@@ -2,8 +2,11 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
-Bundle-SymbolicName: org.eclipse.jpt.jpa.ui.tests
+Bundle-SymbolicName: org.eclipse.jpt.jpa.ui.tests;singleton:=true
Bundle-Version: 2.0.0.qualifier
+Bundle-ActivationPolicy: lazy
+Bundle-ClassPath: .
+Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Require-Bundle:
org.eclipse.core.resources,
@@ -13,11 +16,12 @@ Require-Bundle:
org.eclipse.jpt.jpa.core.tests,
org.eclipse.jpt.jpa.core.tests.extension.resource,
org.eclipse.jpt.common.utility,
+ org.eclipse.jpt.common.core,
org.eclipse.jpt.jpa.core,
org.eclipse.jpt.jpa.ui,
org.eclipse.ui.navigator;bundle-version="3.4.0",
org.eclipse.ui.forms;bundle-version="3.3.100",
org.eclipse.ui.workbench;bundle-version="3.4.0",
org.junit;bundle-version="[4.0.0,5.0.0)"
-Export-Package: org.eclipse.jpt.jpa.ui.tests;x-internal:=true,
+Export-Package: org.eclipse.jpt.jpa.ui.tests.internal;x-internal:=true,
org.eclipse.jpt.jpa.ui.tests.internal.platform;x-internal:=true
diff --git a/jpa/tests/org.eclipse.jpt.jpa.ui.tests/src/org/eclipse/jpt/jpa/ui/tests/internal/JptJpaUiTests.java b/jpa/tests/org.eclipse.jpt.jpa.ui.tests/src/org/eclipse/jpt/jpa/ui/tests/internal/JptJpaUiTests.java
new file mode 100644
index 0000000000..2ccc77dadc
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.jpa.ui.tests/src/org/eclipse/jpt/jpa/ui/tests/internal/JptJpaUiTests.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2012 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.jpa.ui.tests.internal;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.eclipse.jpt.common.core.tests.BundleActivatorTest;
+import org.eclipse.jpt.jpa.ui.JpaPlatformUi;
+import org.eclipse.jpt.jpa.ui.tests.internal.platform.JptJpaUiPlatformTests;
+
+// TODO we need to add BundleActivatorTests for:
+// o.e.jpt.dbws.eclipselink.ui
+// o.e.jpt.jaxb.ui
+// o.e.jpt.jaxb.eclipselink.ui
+// o.e.jpt.jpa.eclipselink.ui
+public class JptJpaUiTests {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(JptJpaUiTests.class.getPackage().getName());
+ suite.addTest(JptJpaUiPlatformTests.suite());
+ suite.addTest(new BundleActivatorTest(JpaPlatformUi.class));
+ return suite;
+ }
+
+ private JptJpaUiTests() {
+ super();
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.ui.tests/src/org/eclipse/jpt/jpa/ui/tests/internal/platform/JpaPlatformUiExtensionTests.java b/jpa/tests/org.eclipse.jpt.jpa.ui.tests/src/org/eclipse/jpt/jpa/ui/tests/internal/platform/JpaPlatformUiExtensionTests.java
index ea60afa47f..27572a98ef 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.ui.tests/src/org/eclipse/jpt/jpa/ui/tests/internal/platform/JpaPlatformUiExtensionTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.ui.tests/src/org/eclipse/jpt/jpa/ui/tests/internal/platform/JpaPlatformUiExtensionTests.java
@@ -1,19 +1,22 @@
/*******************************************************************************
- * Copyright (c) 2010 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
- *******************************************************************************/
+ * Copyright (c) 2010, 2012 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.jpa.ui.tests.internal.platform;
import junit.framework.TestCase;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.jpt.jpa.core.JpaPlatform;
+import org.eclipse.jpt.jpa.core.JpaPreferences;
import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.internal.platform.JpaPlatformManagerImpl;
-import org.eclipse.jpt.jpa.core.tests.extension.resource.ExtensionTestPlugin;
+import org.eclipse.jpt.jpa.core.JpaWorkspace;
+import org.eclipse.jpt.jpa.core.platform.JpaPlatformManager;
+import org.eclipse.jpt.jpa.core.tests.extension.resource.TestExtensionPlugin;
import org.eclipse.jpt.jpa.core.tests.extension.resource.TestJpaPlatformProvider;
import org.eclipse.jpt.jpa.core.tests.internal.projects.TestJpaProject;
@@ -25,8 +28,8 @@ public class JpaPlatformUiExtensionTests extends TestCase
protected static final String PROJECT_NAME = "ExtensionTestProject";
protected static final String PACKAGE_NAME = "extension.test";
- public static final String TEST_PLUGIN_CLASS = ExtensionTestPlugin.class.getName();
- public static final String TEST_PLUGIN_ID = ExtensionTestPlugin.PLUGIN_ID;
+ public static final String TEST_PLUGIN_CLASS = TestExtensionPlugin.class.getName();
+ public static final String TEST_PLUGIN_ID = TestExtensionPlugin.instance().getPluginID();
public static final String TEST_PLATFORM_ID = TestJpaPlatformProvider.ID;
public static final String TEST_PLATFORM_CLASS = TestJpaPlatformProvider.class.getName();
@@ -60,6 +63,22 @@ public class JpaPlatformUiExtensionTests extends TestCase
}
public void testJpaPlatform() {
- assertNotNull(JpaPlatformManagerImpl.instance().buildJpaPlatformImplementation(this.testProject.getProject()));
+ assertNotNull(this.getJpaPlatform());
+ }
+
+ protected JpaPlatform getJpaPlatform() {
+ return this.getJpaPlatformManager().getJpaPlatform(this.getJpaPlatformID());
+ }
+
+ protected String getJpaPlatformID() {
+ return JpaPreferences.getJpaPlatformID(this.testProject.getProject());
+ }
+
+ protected JpaPlatformManager getJpaPlatformManager() {
+ return this.getJpaWorkspace().getJpaPlatformManager();
+ }
+
+ protected JpaWorkspace getJpaWorkspace() {
+ return (JpaWorkspace) ResourcesPlugin.getWorkspace().getAdapter(JpaWorkspace.class);
}
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.ui.tests/src/org/eclipse/jpt/jpa/ui/tests/internal/platform/JptUiPlatformTests.java b/jpa/tests/org.eclipse.jpt.jpa.ui.tests/src/org/eclipse/jpt/jpa/ui/tests/internal/platform/JptJpaUiPlatformTests.java
index abd6960a2c..793db72eac 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.ui.tests/src/org/eclipse/jpt/jpa/ui/tests/internal/platform/JptUiPlatformTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.ui.tests/src/org/eclipse/jpt/jpa/ui/tests/internal/platform/JptJpaUiPlatformTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 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.
@@ -12,15 +12,15 @@ package org.eclipse.jpt.jpa.ui.tests.internal.platform;
import junit.framework.Test;
import junit.framework.TestSuite;
-public class JptUiPlatformTests
+public class JptJpaUiPlatformTests
{
public static Test suite() {
- TestSuite suite = new TestSuite(JptUiPlatformTests.class.getPackage().getName());
+ TestSuite suite = new TestSuite(JptJpaUiPlatformTests.class.getPackage().getName());
suite.addTestSuite(JpaPlatformUiExtensionTests.class);
return suite;
}
- private JptUiPlatformTests() {
+ private JptJpaUiPlatformTests() {
super();
throw new UnsupportedOperationException();
}
diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/.classpath b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/.classpath
index e1f2c35125..64c5e31b7a 100644
--- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/.classpath
+++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/.classpath
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5" />
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins" />
- <classpathentry kind="src" path="src" />
- <classpathentry kind="output" path="bin" />
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/.settings/org.eclipse.jdt.core.prefs b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/.settings/org.eclipse.jdt.core.prefs
index d3cad09797..416f4fb696 100644
--- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/.settings/org.eclipse.jdt.core.prefs
+++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/.settings/org.eclipse.jdt.core.prefs
@@ -1,4 +1,3 @@
-#Tue Mar 08 12:09:57 EST 2011
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/AddAllEntitiesFeature.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/AddAllEntitiesFeature.java
index 7ed3e4cdec..0e8e8bb6d8 100644
--- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/AddAllEntitiesFeature.java
+++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/AddAllEntitiesFeature.java
@@ -75,7 +75,7 @@ public class AddAllEntitiesFeature extends AbstractCustomFeature implements IAdd
Diagram d = getDiagram();
JpaProject project = getTargetJPAProject();
PersistenceUnit unit = project.getRootContextNode().getPersistenceXml().
- getPersistence().getPersistenceUnits().iterator().next();
+ getRoot().getPersistenceUnits().iterator().next();
Point lowestRightestPointOfExistingDiagram = getLowestRightestPoint(d);
diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateJPAEntityFeature.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateJPAEntityFeature.java
index ded03573e9..a2ccf021e6 100644
--- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateJPAEntityFeature.java
+++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateJPAEntityFeature.java
@@ -17,7 +17,6 @@ package org.eclipse.jpt.jpadiagrameditor.ui.internal.feature;
import java.util.List;
import java.util.ListIterator;
-
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
@@ -33,8 +32,8 @@ import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jpt.jpa.core.JpaPreferences;
import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.jpadiagrameditor.ui.internal.JPADiagramEditor;
@@ -130,7 +129,7 @@ public class CreateJPAEntityFeature extends AbstractCreateFeature {
return new Object[] {};
}
- if (!JptJpaCorePlugin.getDiscoverAnnotatedClasses(targetProject)) {
+ if (! JpaPreferences.getDiscoverAnnotatedClasses(targetProject)) {
JPAEditorUtil.createRegisterEntityInXMLJob(jpaProject, entityName);
}
@@ -157,7 +156,7 @@ public class CreateJPAEntityFeature extends AbstractCreateFeature {
JPADiagramEditorPlugin.logError("Cannot refresh the project", e1); //$NON-NLS-1$
}
- ListIterator<PersistenceUnit> lit = jpaProject.getRootContextNode().getPersistenceXml().getPersistence().getPersistenceUnits().iterator();
+ ListIterator<PersistenceUnit> lit = jpaProject.getRootContextNode().getPersistenceXml().getRoot().getPersistenceUnits().iterator();
PersistenceUnit pu = lit.next();
JavaPersistentType jpt = (JavaPersistentType)pu.getPersistentType(entityName);
diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateJPAEntityFromMappedSuperclassFeature.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateJPAEntityFromMappedSuperclassFeature.java
index cc442d6b1b..504c88ab7e 100644
--- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateJPAEntityFromMappedSuperclassFeature.java
+++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateJPAEntityFromMappedSuperclassFeature.java
@@ -1,7 +1,6 @@
package org.eclipse.jpt.jpadiagrameditor.ui.internal.feature;
import java.util.List;
-
import org.eclipse.core.resources.IProject;
import org.eclipse.graphiti.features.IFeatureProvider;
import org.eclipse.graphiti.features.context.ICreateContext;
@@ -9,8 +8,8 @@ import org.eclipse.graphiti.features.impl.AbstractCreateFeature;
import org.eclipse.graphiti.mm.pictograms.Diagram;
import org.eclipse.graphiti.mm.pictograms.Shape;
import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jpt.jpa.core.JpaPreferences;
import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
import org.eclipse.jpt.jpadiagrameditor.ui.internal.JPADiagramEditorPlugin;
import org.eclipse.jpt.jpadiagrameditor.ui.internal.i18n.JPAEditorMessages;
@@ -62,7 +61,7 @@ public class CreateJPAEntityFromMappedSuperclassFeature extends
JPADiagramPropertyPage.getDefaultPackage(jpaProject.getProject()),
getFeatureProvider());
- if (!JptJpaCorePlugin.getDiscoverAnnotatedClasses(jpaProject.getProject())) {
+ if (! JpaPreferences.getDiscoverAnnotatedClasses(jpaProject.getProject())) {
JPAEditorUtil.createRegisterEntityInXMLJob(jpaProject, mappedSuperclassName);
}
diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateMappedSuperclassFeature.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateMappedSuperclassFeature.java
index 16b458d724..93d2e7ceab 100644
--- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateMappedSuperclassFeature.java
+++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateMappedSuperclassFeature.java
@@ -16,7 +16,6 @@
package org.eclipse.jpt.jpadiagrameditor.ui.internal.feature;
import java.util.List;
-
import org.eclipse.core.resources.IProject;
import org.eclipse.graphiti.features.IFeatureProvider;
import org.eclipse.graphiti.features.context.ICreateContext;
@@ -24,8 +23,8 @@ import org.eclipse.graphiti.features.impl.AbstractCreateFeature;
import org.eclipse.graphiti.mm.pictograms.Diagram;
import org.eclipse.graphiti.mm.pictograms.Shape;
import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jpt.jpa.core.JpaPreferences;
import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.jpadiagrameditor.ui.internal.JPADiagramEditorPlugin;
@@ -79,7 +78,7 @@ public class CreateMappedSuperclassFeature extends
JPADiagramPropertyPage.getDefaultPackage(jpaProject.getProject()),
getFeatureProvider());
- if (!JptJpaCorePlugin.getDiscoverAnnotatedClasses(jpaProject.getProject())) {
+ if (! JpaPreferences.getDiscoverAnnotatedClasses(jpaProject.getProject())) {
JPAEditorUtil.createRegisterEntityInXMLJob(jpaProject, mappedSuperclassName);
}
diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/DeleteJPAEntityFeature.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/DeleteJPAEntityFeature.java
index d54d3a39cf..f188152406 100644
--- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/DeleteJPAEntityFeature.java
+++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/DeleteJPAEntityFeature.java
@@ -16,7 +16,6 @@
package org.eclipse.jpt.jpadiagrameditor.ui.internal.feature;
import java.text.MessageFormat;
-
import org.eclipse.emf.transaction.RecordingCommand;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.emf.transaction.util.TransactionUtil;
@@ -26,8 +25,8 @@ import org.eclipse.graphiti.features.context.IMultiDeleteInfo;
import org.eclipse.graphiti.mm.pictograms.PictogramElement;
import org.eclipse.graphiti.ui.features.DefaultDeleteFeature;
import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jpt.jpa.core.JpaPreferences;
import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
import org.eclipse.jpt.jpadiagrameditor.ui.internal.i18n.JPAEditorMessages;
import org.eclipse.jpt.jpadiagrameditor.ui.internal.provider.IJPAEditorFeatureProvider;
@@ -75,7 +74,7 @@ public class DeleteJPAEntityFeature extends DefaultDeleteFeature {
JpaArtifactFactory.instance().forceSaveEntityClass(jpt, getFeatureProvider());
JpaArtifactFactory.instance().deleteEntityClass(jpt, getFeatureProvider());
- if (!JptJpaCorePlugin.getDiscoverAnnotatedClasses(jpt.getJpaProject().getProject())) {
+ if (! JpaPreferences.getDiscoverAnnotatedClasses(jpt.getJpaProject().getProject())) {
JPAEditorUtil.createUnregisterEntityFromXMLJob(jpaProject, name);
}
diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/RefactorEntityFeature.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/RefactorEntityFeature.java
index 671b32e3fe..474f5d694a 100644
--- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/RefactorEntityFeature.java
+++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/RefactorEntityFeature.java
@@ -50,8 +50,8 @@ import org.eclipse.jpt.common.utility.model.event.CollectionClearEvent;
import org.eclipse.jpt.common.utility.model.event.CollectionRemoveEvent;
import org.eclipse.jpt.common.utility.model.listener.CollectionChangeListener;
import org.eclipse.jpt.jpa.core.JpaFile;
+import org.eclipse.jpt.jpa.core.JpaPreferences;
import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
@@ -207,7 +207,7 @@ public abstract class RefactorEntityFeature extends AbstractCustomFeature {
String newJPTName = lsnr.getNewJPTName();
JavaPersistentType newJPT = JpaArtifactFactory.instance().getJPT(newJPTName, pu);
- if (!JptJpaCorePlugin.getDiscoverAnnotatedClasses(newJPT.getJpaProject().getProject())) {
+ if (! JpaPreferences.getDiscoverAnnotatedClasses(newJPT.getJpaProject().getProject())) {
JPAEditorUtil.createUnregisterEntityFromXMLJob(newJPT.getJpaProject(), oldName);
}
if (rename) {
@@ -228,7 +228,7 @@ public abstract class RefactorEntityFeature extends AbstractCustomFeature {
Graphiti.getPeService().deletePictogramElement(cs);
JpaArtifactFactory.instance().refreshEntityModel(fp, newJPT);
- if (!JptJpaCorePlugin.getDiscoverAnnotatedClasses(newJPT.getJpaProject().getProject())) {
+ if (! JpaPreferences.getDiscoverAnnotatedClasses(newJPT.getJpaProject().getProject())) {
JPAEditorUtil.createRegisterEntityInXMLJob(newJPT.getJpaProject(), newJPTName);
}
}
diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/propertytester/JpaContentNodeFacetProjectVersionPropertyTester.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/propertytester/JpaContentNodeFacetProjectVersionPropertyTester.java
index 6f7b97daa7..bd85bca73b 100644
--- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/propertytester/JpaContentNodeFacetProjectVersionPropertyTester.java
+++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/propertytester/JpaContentNodeFacetProjectVersionPropertyTester.java
@@ -1,17 +1,12 @@
package org.eclipse.jpt.jpadiagrameditor.ui.internal.propertytester;
import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.ui.JpaRootContextNodeModel;
-import org.eclipse.wst.common.project.facet.core.IProjectFacet;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
public class JpaContentNodeFacetProjectVersionPropertyTester extends
PropertyTester {
-
- public static final String ID = "jpt.jpa"; //$NON-NLS-1$
- public static final IProjectFacet FACET = ProjectFacetsManager.getProjectFacet(ID);
-
public boolean test(Object receiver, String property, Object[] args,
Object value) {
@@ -19,7 +14,7 @@ public class JpaContentNodeFacetProjectVersionPropertyTester extends
String receiverId = subValues[0];
if (receiver instanceof JpaRootContextNodeModel) {
- if(receiverId.equals(ID)){
+ if(receiverId.equals(JpaProject.FACET_ID)){
return true;
}
}
diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/propertytester/JpaProjectFacetVersionPropertyTester.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/propertytester/JpaProjectFacetVersionPropertyTester.java
index 86a00f2e4d..15167b0442 100644
--- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/propertytester/JpaProjectFacetVersionPropertyTester.java
+++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/propertytester/JpaProjectFacetVersionPropertyTester.java
@@ -2,14 +2,10 @@ package org.eclipse.jpt.jpadiagrameditor.ui.internal.propertytester;
import org.eclipse.core.expressions.PropertyTester;
import org.eclipse.jpt.jpa.core.JpaNode;
-import org.eclipse.wst.common.project.facet.core.IProjectFacet;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.eclipse.jpt.jpa.core.JpaProject;
public class JpaProjectFacetVersionPropertyTester extends PropertyTester{
- public static final String ID = "jpt.jpa"; //$NON-NLS-1$
- public static final IProjectFacet FACET = ProjectFacetsManager.getProjectFacet(ID);
-
public boolean test(Object receiver, String property, Object[] args,
Object value) {
@@ -17,7 +13,7 @@ public class JpaProjectFacetVersionPropertyTester extends PropertyTester{
String receiverId = subValues[0];
if (receiver instanceof JpaNode) {
- if(receiverId.equals(ID)){
+ if(receiverId.equals(JpaProject.FACET_ID)){
return true;
}
}
diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/JPAEditorDiagramTypeProvider.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/JPAEditorDiagramTypeProvider.java
index ff4c5c016b..0156f7f991 100644
--- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/JPAEditorDiagramTypeProvider.java
+++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/JPAEditorDiagramTypeProvider.java
@@ -110,7 +110,7 @@ public class JPAEditorDiagramTypeProvider extends AbstractDiagramTypeProvider {
public boolean hasToAdd() {
JpaProject project = getTargetJPAProject();
PersistenceUnit unit = project.getRootContextNode().getPersistenceXml().
- getPersistence().getPersistenceUnits().iterator().next();
+ getRoot().getPersistenceUnits().iterator().next();
for (ClassRef classRef : unit.getClassRefs()) {
if (classRef.getJavaPersistentType() != null) {
diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/EntityChangeListener.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/EntityChangeListener.java
index ef5c528eae..ca26b220e8 100644
--- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/EntityChangeListener.java
+++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/EntityChangeListener.java
@@ -20,11 +20,10 @@ import java.util.HashSet;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Set;
-
import org.eclipse.graphiti.features.context.impl.RemoveContext;
import org.eclipse.graphiti.mm.pictograms.ContainerShape;
import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.JpaPreferences;
import org.eclipse.jpt.jpa.core.context.MappedByRelationship;
import org.eclipse.jpt.jpa.core.context.PersistentType;
import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
@@ -126,7 +125,7 @@ public class EntityChangeListener extends Thread {
JpaArtifactFactory.instance().forceSaveEntityClass(jpt, featureProvider);
if(jpt.getMapping() == null || (jpt.getMapping() instanceof JavaNullTypeMapping)) {
- if (!JptJpaCorePlugin.getDiscoverAnnotatedClasses(jpt.getJpaProject().getProject())) {
+ if (! JpaPreferences.getDiscoverAnnotatedClasses(jpt.getJpaProject().getProject())) {
JPAEditorUtil.createUnregisterEntityFromXMLJob(jpt.getJpaProject(), jpt.getName());
}
}
diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JPAEditorUtil.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JPAEditorUtil.java
index cc76c9e8b2..aaed31974c 100644
--- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JPAEditorUtil.java
+++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JPAEditorUtil.java
@@ -1376,7 +1376,7 @@ public class JPAEditorUtil {
static private HashSet<String> getEntityNames(JpaProject jpaProject) {
HashSet<String> names = new HashSet<String>();
ListIterator<PersistenceUnit> lit = jpaProject.getRootContextNode().getPersistenceXml().
- getPersistence().getPersistenceUnits().iterator();
+ getRoot().getPersistenceUnits().iterator();
PersistenceUnit pu = lit.next();
for (ClassRef cf : pu.getClassRefs()) {
names.add(cf.getClassName());
@@ -1387,7 +1387,7 @@ public class JPAEditorUtil {
static private HashSet<String> getEntitySimpleNames(JpaProject jpaProject) {
HashSet<String> names = new HashSet<String>();
ListIterator<PersistenceUnit> lit = jpaProject.getRootContextNode().getPersistenceXml().
- getPersistence().getPersistenceUnits().iterator();
+ getRoot().getPersistenceUnits().iterator();
PersistenceUnit pu = lit.next();
for (ClassRef cf : pu.getClassRefs()) {
names.add(returnSimpleName(cf.getClassName()).toLowerCase(Locale.ENGLISH));
@@ -1419,13 +1419,13 @@ public class JPAEditorUtil {
try {
fproj = ProjectFacetsManager.create(project);
} catch (CoreException e) {
- JPADiagramEditorPlugin.logError("Could not create faceted project from " + project.getName(), e); //$NON-NLS-1$
+ JPADiagramEditorPlugin.logError("Could not create faceted project from " + project.getName(), e); //$NON-NLS-1$
}
Set<IProjectFacetVersion> projFacets = fproj.getProjectFacets();
Iterator<IProjectFacetVersion> it = projFacets.iterator();
while (it.hasNext()) {
IProjectFacetVersion fv = it.next();
- if (fv.getProjectFacet().getId().equals("jpt.jpa")) { //$NON-NLS-1$
+ if (fv.getProjectFacet().getId().equals(JpaProject.FACET_ID)) {
return fv.getVersionString().equals(version);
}
}
diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JpaArtifactFactory.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JpaArtifactFactory.java
index b71dab1de9..8e3631bf92 100644
--- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JpaArtifactFactory.java
+++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JpaArtifactFactory.java
@@ -2042,7 +2042,7 @@ public class JpaArtifactFactory {
public PersistenceUnit getPersistenceUnit(JpaProject project) {
if(project.getRootContextNode().getPersistenceXml() == null)
return null;
- return project.getRootContextNode().getPersistenceXml().getPersistence()
+ return project.getRootContextNode().getPersistenceXml().getRoot()
.getPersistenceUnits().iterator().next();
}
diff --git a/jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/.settings/org.eclipse.jdt.core.prefs b/jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/.settings/org.eclipse.jdt.core.prefs
index b7176b3cc1..416f4fb696 100644
--- a/jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/.settings/org.eclipse.jdt.core.prefs
+++ b/jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/.settings/org.eclipse.jdt.core.prefs
@@ -1,4 +1,3 @@
-#Wed Mar 09 10:22:22 EST 2011
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
diff --git a/jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/META-INF/MANIFEST.MF b/jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/META-INF/MANIFEST.MF
index 3478e86b14..724df47d5f 100644
--- a/jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/META-INF/MANIFEST.MF
+++ b/jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/META-INF/MANIFEST.MF
@@ -6,6 +6,7 @@ Bundle-SymbolicName: org.eclipse.jpt.jpadiagrameditor.ui.tests;singleton:=true
Bundle-Version: 1.0.200.qualifier
Bundle-Activator: org.eclipse.jpt.jpadiagrameditor.ui.tests.internal.JPAEditorTestsActivator
Bundle-ActivationPolicy: lazy
+Bundle-ClassPath: .
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: org.easymock;bundle-version="[2.4.0,3.0.0)",
diff --git a/jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/src/org/eclipse/jpt/jpadiagrameditor/ui/tests/internal/JPAEditorTestsActivator.java b/jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/src/org/eclipse/jpt/jpadiagrameditor/ui/tests/internal/JPAEditorTestsActivator.java
index 7571ee0ddb..76f4dfc7a3 100644
--- a/jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/src/org/eclipse/jpt/jpadiagrameditor/ui/tests/internal/JPAEditorTestsActivator.java
+++ b/jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/src/org/eclipse/jpt/jpadiagrameditor/ui/tests/internal/JPAEditorTestsActivator.java
@@ -1,7 +1,7 @@
/*******************************************************************************
* <copyright>
*
- * Copyright (c) 2005, 2011 SAP AG and others.
+ * Copyright (c) 2005, 2012 SAP AG and others.
* 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
@@ -19,7 +19,6 @@ import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.jpt.common.utility.internal.ReflectionTools;
import org.eclipse.jpt.jpa.core.JpaProjectManager;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.osgi.framework.BundleContext;
public class JPAEditorTestsActivator extends Plugin {
diff --git a/jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/src/org/eclipse/jpt/jpadiagrameditor/ui/tests/internal/listener/JPAProjectListenerTest.java b/jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/src/org/eclipse/jpt/jpadiagrameditor/ui/tests/internal/listener/JPAProjectListenerTest.java
index d6195301f1..524e60d755 100644
--- a/jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/src/org/eclipse/jpt/jpadiagrameditor/ui/tests/internal/listener/JPAProjectListenerTest.java
+++ b/jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/src/org/eclipse/jpt/jpadiagrameditor/ui/tests/internal/listener/JPAProjectListenerTest.java
@@ -19,7 +19,6 @@ import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.isA;
import static org.easymock.EasyMock.replay;
import static org.junit.Assert.assertNotNull;
-
import org.easymock.EasyMock;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
@@ -33,11 +32,7 @@ import org.eclipse.graphiti.features.context.IRemoveContext;
import org.eclipse.graphiti.mm.pictograms.ContainerShape;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.jpa.core.JpaFile;
import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JpaStructureNode;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.jpadiagrameditor.ui.internal.provider.IJPAEditorFeatureProvider;
diff --git a/jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/src/org/eclipse/jpt/jpadiagrameditor/ui/tests/internal/modelintegration/ui/ModelIntegrationTest.java b/jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/src/org/eclipse/jpt/jpadiagrameditor/ui/tests/internal/modelintegration/ui/ModelIntegrationTest.java
index 34e3ba1189..be55db9ff4 100644
--- a/jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/src/org/eclipse/jpt/jpadiagrameditor/ui/tests/internal/modelintegration/ui/ModelIntegrationTest.java
+++ b/jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/src/org/eclipse/jpt/jpadiagrameditor/ui/tests/internal/modelintegration/ui/ModelIntegrationTest.java
@@ -20,7 +20,6 @@ import static org.easymock.EasyMock.isA;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
-
import org.easymock.EasyMock;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
@@ -35,11 +34,7 @@ import org.eclipse.graphiti.mm.pictograms.PictogramElement;
import org.eclipse.graphiti.platform.IDiagramEditor;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.jpa.core.JpaFile;
import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JpaStructureNode;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
import org.eclipse.jpt.jpadiagrameditor.ui.internal.modelintegration.ui.JPAEditorMatchingStrategy;
import org.eclipse.jpt.jpadiagrameditor.ui.internal.modelintegration.util.IModelIntegrationUtil;
diff --git a/jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/src/org/eclipse/jpt/jpadiagrameditor/ui/tests/internal/relation/CreateRelationAttributesTest.java b/jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/src/org/eclipse/jpt/jpadiagrameditor/ui/tests/internal/relation/CreateRelationAttributesTest.java
index 1149ffe48d..353342fba4 100644
--- a/jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/src/org/eclipse/jpt/jpadiagrameditor/ui/tests/internal/relation/CreateRelationAttributesTest.java
+++ b/jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/src/org/eclipse/jpt/jpadiagrameditor/ui/tests/internal/relation/CreateRelationAttributesTest.java
@@ -111,7 +111,7 @@ public class CreateRelationAttributesTest {
createCompilationUnitFrom(customerFile),
createCompilationUnitFrom(addressFile));
jpaProject.getProject().build(IncrementalProjectBuilder.CLEAN_BUILD, new NullProgressMonitor());
- PersistenceUnit pu = jpaProject.getRootContextNode().getPersistenceXml().getPersistence().getPersistenceUnits().iterator().next();
+ PersistenceUnit pu = jpaProject.getRootContextNode().getPersistenceXml().getRoot().getPersistenceUnits().iterator().next();
t1 = pu.getPersistentType("abc.Customer");
assertNotNull(attr);
diff --git a/jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/src/org/eclipse/jpt/jpadiagrameditor/ui/tests/internal/util/CreateDeleteEntity.java b/jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/src/org/eclipse/jpt/jpadiagrameditor/ui/tests/internal/util/CreateDeleteEntity.java
index d9acdb512d..6bf22d4698 100644
--- a/jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/src/org/eclipse/jpt/jpadiagrameditor/ui/tests/internal/util/CreateDeleteEntity.java
+++ b/jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/src/org/eclipse/jpt/jpadiagrameditor/ui/tests/internal/util/CreateDeleteEntity.java
@@ -60,18 +60,18 @@ public class CreateDeleteEntity {
Thread.sleep(2000);
PersistenceXml persistenceXml = jpaProjectContent.getPersistenceXml();
assertNotNull(persistenceXml);
- Persistence p = persistenceXml.getPersistence();
+ Persistence p = persistenceXml.getRoot();
int cnt = 0;
while ((p == null) && (cnt < 25)) {
Thread.sleep(250);
- p = persistenceXml.getPersistence();
+ p = persistenceXml.getRoot();
cnt++;
}
assertTrue("Can't obtain persistence object", p != null);
- assertTrue(persistenceXml.getPersistence().getPersistenceUnitsSize() == 1);
+ assertTrue(persistenceXml.getRoot().getPersistenceUnitsSize() == 1);
//java.lang.UnsupportedOperationException: No PersistenceUnit in this context
//PersistenceUnit persistenceUnit = persistenceXml.getPersistence().getPersistenceUnit();
- PersistenceUnit persistenceUnit = persistenceXml.getPersistence().getPersistenceUnits().iterator().next();
+ PersistenceUnit persistenceUnit = persistenceXml.getRoot().getPersistenceUnits().iterator().next();
assertNotNull(persistenceUnit);
assertTrue(persistenceUnit.getClassRefsSize() == 0);
IFile entity1 = factory.createEntityInProject(jpaProject.getProject(), new String[]{"com"}, "Entity1");
diff --git a/jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/test.xml b/jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/test.xml
index 98ad18889a..c5bf9c6bca 100644
--- a/jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/test.xml
+++ b/jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.ui.tests/test.xml
@@ -21,7 +21,7 @@
</target>
<!-- This target defines the tests that need to be run. -->
- <target name="suite1">
+ <target name="suite">
<property file="${testRoot}/testServer.properties"/>
<property name="jpae-folder" value="${eclipse-home}/jpae_folder"/>
<delete dir="${jpae-folder}" quiet="true"/>
@@ -43,6 +43,6 @@
<!-- This target runs the test suite. Any actions that need to happen -->
<!-- after all the tests have been run should go here. -->
- <target name="run" depends="init, suite1, cleanup">
+ <target name="run" depends="init, suite, cleanup">
</target>
</project>

Back to the top