Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbvosburgh2012-07-20 17:21:07 -0400
committerbvosburgh2012-07-20 17:21:07 -0400
commita9acc40fabcdda7547981853cb47172a73175b41 (patch)
tree61f25593bcebffa356a03d0d6388a5d0e44060fa
parent04bfbb636dce962376aa61d6ae51f627522c65b1 (diff)
downloadwebtools.dali-a9acc40fabcdda7547981853cb47172a73175b41.tar.gz
webtools.dali-a9acc40fabcdda7547981853cb47172a73175b41.tar.xz
webtools.dali-a9acc40fabcdda7547981853cb47172a73175b41.zip
rework plug-in classes
-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 = (Bo