Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbvosburgh2012-07-20 21:30:01 +0000
committerbvosburgh2012-07-20 21:30:01 +0000
commit5f8bf631641f060fe17e25721e4092d78cc0933a (patch)
tree5ed9009549bb63337c8b17bbbbe83235074a3931
parenta9acc40fabcdda7547981853cb47172a73175b41 (diff)
downloadwebtools.dali-5f8bf631641f060fe17e25721e4092d78cc0933a.tar.gz
webtools.dali-5f8bf631641f060fe17e25721e4092d78cc0933a.tar.xz
webtools.dali-5f8bf631641f060fe17e25721e4092d78cc0933a.zip
rework plug-in classes
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/.options22
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/META-INF/MANIFEST.MF4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/plugin.properties2
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/JpaPlatformUi.java73
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/JpaPlatformUiProvider.java26
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/JpaProjectsModel.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/MappingResourceUiDefinition.java56
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/details/MappingUiDefinition.java56
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/details/java/JavaAttributeMappingUiDefinition.java9
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/details/java/JavaTypeMappingUiDefinition.java10
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/details/orm/OrmAttributeMappingUiDefinition.java9
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/details/orm/OrmTypeMappingUiDefinition.java10
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/AbstractJpaPlatformUiProvider.java42
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/FileAdapterFactory.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/ImageRepository.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JpaHelpContextIds.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JpaJavaCompletionProposalComputer.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JpaMappingImageHelper.java86
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JpaPlatformAdapterFactory.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JpaStructureNodeAdapterFactory.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JpaXmlCompletionProposalComputer.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JptUiIcons.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/ProjectAdapterFactory.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/WorkspaceAdapterFactory.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/actions/MakePersistentAction.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/actions/SynchronizeClassesAction.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/commands/ConvertJavaProjectToJpaCommandHandler.java14
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractBasicMappingUiDefinition.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractEmbeddableUiDefinition.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractEmbeddedIdMappingUiDefinition.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractEmbeddedMappingUiDefinition.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractEntityUiDefinition.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractIdMappingUiDefinition.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractManyToManyMappingUiDefinition.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractManyToOneMappingUiDefinition.java36
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractMappedSuperclassUiDefinition.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractMappingUiDefinition.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractOneToManyMappingUiDefinition.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractOneToOneMappingUiDefinition.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractOverridesComposite.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractTransientMappingUiDefinition.java40
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractVersionMappingUiDefinition.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/JoinTableComposite.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/JoiningStrategyJoinColumnsComposite.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/MapAsComposite.java75
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/PersistentAttributeDetailsPage.java17
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/PersistentAttributeMapAsComposite.java87
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/PersistentTypeDetailsPage.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/PersistentTypeMapAsComposite.java67
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/db/DatabaseObjectCombo.java40
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/AbstractJavaResourceUiDefinition.java263
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/DefaultBasicMappingUiDefinition.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/DefaultEmbeddedMappingUiDefinition.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/GenericJavaResourceUiDefinition.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/JavaPersistentAttributeDetailsProvider.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/JavaPersistentTypeDetailsProvider.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/NullJavaAttributeMappingUiDefinition.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/NullJavaTypeMappingUiDefinition.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/AbstractOrmXmlResourceUiDefinition.java185
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/EntityMappingsDetailsProvider.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/OrmPersistentAttributeDetailsProvider.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/OrmPersistentTypeDetailsProvider.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/OrmXmlUiDefinition.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/UnsupportedOrmAttributeMappingUiDefinition.java (renamed from jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/UnsupportedOrmMappingUiDefinition.java)51
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/dialogs/AddPersistentAttributeToXmlAndMapDialog.java9
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/dialogs/AddPersistentClassDialog.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/editors/PersistenceEditor.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jface/XmlMappingFileViewerFilter.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/Jpa2_0FlagTransformer.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/OrmXml2_0FlagModel.java (renamed from jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/Jpa2_0XmlFlagModel.java)20
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/AbstractElementCollectionMapping2_0UiDefinition.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/java/Generic2_0JavaResourceUiDefinition.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/orm/EntityMappings2_0DetailsProvider.java20
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/orm/OrmXml2_0UiDefinition.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/persistence/GenericPersistenceUnit2_0OptionsTab.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/persistence/JdbcConnectionPropertiesComposite.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/persistence/PersistenceXml2_0UiDefinition.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpaJpqlContentProposalProvider.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpaJpqlJavaCompletionProposalComputer.java9
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpaJpqlSseCompletionProposalComputer.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpqlCompletionProposalComputer.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/menus/MapAsContribution.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/menus/PersistentAttributeMapAsContribution.java9
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/menus/PersistentTypeMapAsContribution.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/navigator/RootContextNodeModelItemLabelProvider.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/ArchiveFileSelectionDialog.java16
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/PersistenceUnitClassesComposite.java37
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/PersistenceUnitJarFilesComposite.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/PersistenceUnitMappingFilesComposite.java17
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/PersistenceXmlUiDefinition.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/JpaPlatformUiRegistry.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/base/AbstractJpaPlatformUi.java156
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/ClassRefItemLabelProvider.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/GenericNavigatorItemLabelProviderFactory.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/JarFileRefItemLabelProvider.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/MappingFileRefItemLabelProvider.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/OrmXmlItemContentProvider.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/PersistenceUnitItemLabelProvider.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/PersistenceXmlItemContentProvider.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/PersistentAttributeItemLabelProvider.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/PersistentTypeItemLabelProvider.java56
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/plugin/JptJpaUiPlugin.java (renamed from jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/JptJpaUiPlugin.java)195
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/prefs/JpaEntityGenPreferencePage.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/prefs/JpaPreferencesPage.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/prefs/JpaProblemSeveritiesPage.java98
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/prefs/JptPreferencesPage.java11
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/properties/JpaProjectPropertiesPage.java329
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/selection/TextEditorAdapterFactory.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/structure/OrmStructureItemLabelProviderFactory.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/structure/PersistenceStructureItemLabelProviderFactory.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/views/JpaDetailsView.java10
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/views/JpaStructurePage.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/JpaFacetActionPage.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/JpaFacetInstallPage.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/JpaMakePersistentWizard.java11
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/JpaMakePersistentWizardPage.java42
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/NewEntityDropDownAction.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/SelectMappingFileDialog.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/conversion/java/GenericJavaMetadataConversionWizardPage.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/conversion/java/JavaMetadataConversionWizard.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/conversion/java/JavaMetadataConversionWizardPage.java22
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/EntityClassWizardPage.java11
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/EntityRowTableWizardSection.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/EntityWizard.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/data/model/CreateEntityTemplateModel.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/data/model/EntityDataModelProvider.java44
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/data/operation/NewEntityClassOperation.java18
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/AssociationTablesPage.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/AssociationsListComposite.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/CascadeDialog.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/ColumnGenPanel.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/DatabaseGroup.java17
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/DefaultTableGenerationWizardPage.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/GenerateEntitiesFromSchemaWizard.java18
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/SWTUtil.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/TableAssociationsWizardPage.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/TableGenPanel.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/TablesSelectorWizardPage.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/orm/MappingFileWizard.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/proj/JpaProjectWizard.java20
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/proj/JpaProjectWizardFirstPage.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/proj/model/JpaProjectCreationDataModelProvider.java20
142 files changed, 1820 insertions, 2117 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/.options b/jpa/plugins/org.eclipse.jpt.jpa.ui/.options
index c49913db89..129a35de52 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/.options
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/.options
@@ -1,14 +1,16 @@
-# Debugging options for org.eclipse.jpt.jpa.ui plug-in
+# debugging options for the plug-in org.eclipse.jpt.jpa.ui
-# Turn on debugging for the org.eclipse.jpt.jpa.ui plugin.
-org.eclipse.jpt.jpa.ui/debug=false
+# turn on debugging for the plug-in org.eclipse.jpt.jpa.ui
+org.eclipse.jpt.jpa.ui/debug=true
-# Turn on debugging for unit-tests
-org.eclipse.jpt.jpa.ui/debug/unit-tests=false
+# turn on debugging for the JPA selection managers
+org.eclipse.jpt.jpa.ui/debug/JpaSelectionManager=false
-# Turn on debugging for events occurring in the UI panes
-org.eclipse.jpt.jpa.ui/debug/ui/layout=false
-org.eclipse.jpt.jpa.ui/debug/ui/detailsView=false
+# turn on debugging for the persistent type details pages
+org.eclipse.jpt.jpa.ui/debug/PersistentTypeDetailsPage=false
-# Turn on debugging for events coming from ConnectionProfile
-org.eclipse.jpt.jpa.ui/debug/ui/db=false
+# turn on debugging for the persistent attribute details pages
+org.eclipse.jpt.jpa.ui/debug/PersistentAttributeDetailsPage=false
+
+# turn on debugging for the database combos
+org.eclipse.jpt.jpa.ui/debug/DatabaseObjectCombo=false
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/META-INF/MANIFEST.MF b/jpa/plugins/org.eclipse.jpt.jpa.ui/META-INF/MANIFEST.MF
index 5ded5941f2..0213406a64 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/META-INF/MANIFEST.MF
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/META-INF/MANIFEST.MF
@@ -4,7 +4,7 @@ Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.jpt.jpa.ui;singleton:=true
Bundle-Version: 3.2.0.qualifier
-Bundle-Activator: org.eclipse.jpt.jpa.ui.JptJpaUiPlugin
+Bundle-Activator: org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .
Bundle-Localization: plugin
@@ -47,6 +47,7 @@ Require-Bundle: org.eclipse.core.expressions;bundle-version="[3.4.0,4.0.0)",
org.eclipse.wst.web.ui;bundle-version="[1.1.200,2.0.0)",
org.eclipse.wst.xml.core;bundle-version="[1.1.700,2.0.0)",
org.eclipse.wst.xml.ui;bundle-version="[1.1.300,2.0.0)"
+Import-Package: com.ibm.icu.text;version="4.0.1"
Export-Package: org.eclipse.jpt.jpa.ui,
org.eclipse.jpt.jpa.ui.details,
org.eclipse.jpt.jpa.ui.details.java,
@@ -94,4 +95,3 @@ Export-Package: org.eclipse.jpt.jpa.ui,
org.eclipse.jpt.jpa.ui.jpa2.details.java,
org.eclipse.jpt.jpa.ui.jpa2.details.orm,
org.eclipse.jpt.jpa.ui.selection
-Import-Package: com.ibm.icu.text;version="4.0.1"
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/plugin.properties b/jpa/plugins/org.eclipse.jpt.jpa.ui/plugin.properties
index bc640982c7..00fef0994b 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/plugin.properties
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/plugin.properties
@@ -75,4 +75,4 @@ JpaProposalCategory = JPA Proposals
JptCreationActionSet.label = Jpt Creation
JptCreationActionSet.description = Jpt Creation Action Set
-NewEntityAction.label = New Entity \ No newline at end of file
+NewEntityAction.label = New Entity
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/JpaPlatformUi.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/JpaPlatformUi.java
index dc8d458fc9..eb6efd342f 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/JpaPlatformUi.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/JpaPlatformUi.java
@@ -9,7 +9,6 @@
******************************************************************************/
package org.eclipse.jpt.jpa.ui;
-import java.util.Iterator;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jpt.common.core.JptResourceType;
import org.eclipse.jpt.common.ui.WidgetFactory;
@@ -55,57 +54,57 @@ import org.eclipse.swt.widgets.Composite;
*/
public interface JpaPlatformUi {
// ********** navigator provider **********
-
+
/**
* Return the platform's Navigator factory provider.
* This is used by the Common Navigator to build and maintain the JPA
* content and labels.
*/
ItemTreeStateProviderFactoryProvider getNavigatorFactoryProvider();
-
-
+
+
// ********** structure view factory providers **********
-
+
/**
* Return a structure provider for the specified JPA file.
*/
ItemTreeStateProviderFactoryProvider getStructureViewFactoryProvider(JpaFile jpaFile);
-
-
+
+
// ********** details providers **********
-
+
JpaDetailsPageManager<? extends JpaStructureNode> buildJpaDetailsPageManager(
Composite parent,
JpaStructureNode structureNode,
WidgetFactory widgetFactory);
-
-
+
+
// ********** file ui definitions **********
-
+
/**
* Return a resource ui definition for the specified resource type.
*/
ResourceUiDefinition getResourceUiDefinition(JptResourceType resourceType);
-
-
+
+
// ********** type mappings **********
-
+
JpaComposite buildTypeMappingComposite(
JptResourceType resourceType,
String mappingKey,
Composite parent,
PropertyValueModel<TypeMapping> mappingHolder,
WidgetFactory widgetFactory);
-
- DefaultMappingUiDefinition<PersistentType, ? extends TypeMapping>
- getDefaultTypeMappingUiDefinition(JptResourceType resourceType);
-
- Iterator<MappingUiDefinition<PersistentType, ? extends TypeMapping>>
- typeMappingUiDefinitions(JptResourceType resourceType);
-
-
+
+ Iterable<MappingUiDefinition<PersistentType, ? extends TypeMapping>> getTypeMappingUiDefinitions(JptResourceType resourceType);
+
+ MappingUiDefinition<PersistentType, ? extends TypeMapping> getTypeMappingUiDefinition(JptResourceType resourceType, String mappingKey);
+
+ DefaultMappingUiDefinition<PersistentType, ? extends TypeMapping> getDefaultTypeMappingUiDefinition(JptResourceType resourceType);
+
+
// ********** attribute mappings **********
-
+
JpaComposite buildAttributeMappingComposite(
JptResourceType resourceType,
String mappingKey,
@@ -113,25 +112,27 @@ public interface JpaPlatformUi {
PropertyValueModel<AttributeMapping> mappingHolder,
PropertyValueModel<Boolean> enabledModel,
WidgetFactory widgetFactory);
-
- DefaultMappingUiDefinition<ReadOnlyPersistentAttribute, ? extends AttributeMapping>
- getDefaultAttributeMappingUiDefinition(JptResourceType resourceType, String mappingKey);
-
- Iterator<MappingUiDefinition<ReadOnlyPersistentAttribute, ? extends AttributeMapping>>
- attributeMappingUiDefinitions(JptResourceType resourceType);
-
+
+ Iterable<MappingUiDefinition<ReadOnlyPersistentAttribute, ? extends AttributeMapping>> getAttributeMappingUiDefinitions(JptResourceType resourceType);
+
+ MappingUiDefinition<ReadOnlyPersistentAttribute, ? extends AttributeMapping> getAttributeMappingUiDefinition(JptResourceType resourceType, String mappingKey);
+
+ DefaultMappingUiDefinition<ReadOnlyPersistentAttribute, ? extends AttributeMapping> getDefaultAttributeMappingUiDefinition(JptResourceType resourceType, String mappingKey);
+
+
// ********** metadata conversion **********
void convertJavaQueryMetadataToGlobal(JpaProject project);
-
+
void convertJavaGeneratorMetadataToGlobal(JpaProject project);
-
+
+
// ********** entity generation **********
-
+
void generateEntities(JpaProject project, IStructuredSelection selection);
-
-
+
+
// ********** DDL generation **********
-
+
void generateDDL(JpaProject project, IStructuredSelection selection);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/JpaPlatformUiProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/JpaPlatformUiProvider.java
index a1a064d1b4..4abc8672a0 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/JpaPlatformUiProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/JpaPlatformUiProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,38 +9,36 @@
******************************************************************************/
package org.eclipse.jpt.jpa.ui;
-import java.util.ListIterator;
import org.eclipse.jpt.jpa.core.JpaPlatform;
import org.eclipse.jpt.jpa.ui.details.JpaDetailsProvider;
/**
* This interface is to be implemented by a JPA vendor to provide extensions to
- * JPA UI functionality. This is intended to work in conjunction with a core
+ * JPA UI functionality. This is intended to work in conjunction with a core
* JPA platform ({@link JpaPlatform}) implementation with the same ID.
* <p>
* Any implementation should be <em>stateless</em> in nature.
* <p>
* The "generic" extension supplies UI for the core platform extension with the same
* ID.
- *
- * See the extension point: org.eclipse.jpt.jpa.ui.jpaPlatformUis
- *
+ * <p>
+ * See the extension point: <code>org.eclipse.jpt.jpa.ui.jpaPlatformUis</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
* pioneering adopters on the understanding that any code that uses this API
* will almost certainly be broken (repeatedly) as the API evolves.
*/
-public interface JpaPlatformUiProvider
-{
+public interface JpaPlatformUiProvider {
+
/**
- * Return the details providers that apply to this platform.
+ * Return the platform's details providers.
*/
- ListIterator<JpaDetailsProvider> detailsProviders();
-
+ Iterable<JpaDetailsProvider> getDetailsProviders();
+
/**
- * Return the resource ui definitions that apply to this platform.
+ * Return the platform's resource UI definitions.
*/
- ListIterator<ResourceUiDefinition> resourceUiDefinitions();
-
+ Iterable<ResourceUiDefinition> getResourceUiDefinitions();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/JpaProjectsModel.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/JpaProjectsModel.java
index 33a8a50325..920b7ffebc 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/JpaProjectsModel.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/JpaProjectsModel.java
@@ -9,9 +9,9 @@
******************************************************************************/
package org.eclipse.jpt.jpa.ui;
-import org.eclipse.core.resources.IWorkspace;
import org.eclipse.jpt.common.utility.model.value.CollectionValueModel;
import org.eclipse.jpt.jpa.core.JpaProject;
+import org.eclipse.jpt.jpa.core.JpaWorkspace;
/**
* Standard adapter for retrieving a model of a workspace's
@@ -27,7 +27,7 @@ public interface JpaProjectsModel
extends CollectionValueModel<JpaProject>
{
/**
- * Return the workspace corresponding to the JPA projects model.
+ * Return the JPA workspace corresponding to the JPA projects model.
*/
- IWorkspace getWorkspace();
+ JpaWorkspace getJpaWorkspace();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/MappingResourceUiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/MappingResourceUiDefinition.java
index 4ff92e64e8..216ded6763 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/MappingResourceUiDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/MappingResourceUiDefinition.java
@@ -9,7 +9,6 @@
******************************************************************************/
package org.eclipse.jpt.jpa.ui;
-import java.util.Iterator;
import org.eclipse.jpt.common.ui.WidgetFactory;
import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
import org.eclipse.jpt.jpa.core.context.AttributeMapping;
@@ -22,54 +21,61 @@ import org.eclipse.jpt.jpa.ui.details.MappingUiDefinition;
import org.eclipse.swt.widgets.Composite;
/**
- *
+ * UI definitions for a specific
+ * {@link org.eclipse.jpt.common.core.JptResourceType 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.
*/
-public interface MappingResourceUiDefinition extends ResourceUiDefinition
+public interface MappingResourceUiDefinition
+ extends ResourceUiDefinition
{
+ // ********** type mappings **********
+
/**
*
*/
- JpaComposite buildAttributeMappingComposite(
- String key,
- PropertyValueModel<AttributeMapping> mappingHolder,
- PropertyValueModel<Boolean> enabledModel,
- Composite parent,
- WidgetFactory widgetFactory);
+ JpaComposite buildTypeMappingComposite(String mappingKey, PropertyValueModel<TypeMapping> mappingHolder, Composite parent, WidgetFactory widgetFactory);
/**
- * Return an iterator of attribute mapping ui definitions appropriate for this file type
+ *
*/
- Iterator<MappingUiDefinition<ReadOnlyPersistentAttribute, ? extends AttributeMapping>>
- attributeMappingUiDefinitions();
+ Iterable<MappingUiDefinition<PersistentType, ? extends TypeMapping>> getTypeMappingUiDefinitions();
/**
- * Return a default attribute mapping ui definition for the given key or null
+ *
*/
- DefaultMappingUiDefinition<ReadOnlyPersistentAttribute, ? extends AttributeMapping>
- getDefaultAttributeMappingUiDefinition(String key);
+ MappingUiDefinition<PersistentType, ? extends TypeMapping> getTypeMappingUiDefinition(String mappingKey);
/**
+ * Return a default type mapping ui provider or null
+ */
+ DefaultMappingUiDefinition<PersistentType, ? extends TypeMapping> getDefaultTypeMappingUiDefinition();
+
+
+ // ********** attribute mappings **********
+
+ /**
*
*/
- JpaComposite buildTypeMappingComposite(
- String key,
- PropertyValueModel<TypeMapping> mappingHolder,
- Composite parent, WidgetFactory widgetFactory);
+ JpaComposite buildAttributeMappingComposite(String mappingKey, PropertyValueModel<AttributeMapping> mappingHolder, PropertyValueModel<Boolean> enabledModel, Composite parent, WidgetFactory widgetFactory);
/**
- *
+ * Return the resource's attribute mapping UI definitions.
*/
- Iterator<MappingUiDefinition<PersistentType, ? extends TypeMapping>>
- typeMappingUiDefinitions();
+ Iterable<MappingUiDefinition<ReadOnlyPersistentAttribute, ? extends AttributeMapping>> getAttributeMappingUiDefinitions();
/**
- * Return a default type mapping ui provider or null
+ * Return the resource's attribute mapping UI definitions.
+ */
+ MappingUiDefinition<ReadOnlyPersistentAttribute, ? extends AttributeMapping> getAttributeMappingUiDefinition(String mappingKey);
+
+ /**
+ * Return a default attribute mapping ui definition for the given key or null
*/
- DefaultMappingUiDefinition<PersistentType, ? extends TypeMapping>
- getDefaultTypeMappingUiDefinition();
+ DefaultMappingUiDefinition<ReadOnlyPersistentAttribute, ? extends AttributeMapping> getDefaultAttributeMappingUiDefinition(String mappingKey);
+
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/details/MappingUiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/details/MappingUiDefinition.java
index 01d27f0444..c94c6a883e 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/details/MappingUiDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/details/MappingUiDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2012 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -12,51 +12,53 @@ package org.eclipse.jpt.jpa.ui.details;
import org.eclipse.swt.graphics.Image;
/**
- * A UI provider is responsible to provide the support for displaying the
- * information for a certain mapping type.
- *
- * T represents the type of the mapping the definition represents
- * M represents the type of the object being mapped
- *
- * @version 2.3
- * @since 2.0
- *
+ * A mapping UI definition provides the labels and images for the (type or
+ * attribute) mapping type indicated by {@link #getKey()}.
+ * <p>
* Provisional API: This interface is part of an interim API that is still
* under development and expected to change significantly before reaching
* stability. It is available at this early stage to solicit feedback from
* pioneering adopters on the understanding that any code that uses this API
* will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 2.3
+ * @since 2.0
*/
-public interface MappingUiDefinition<M, T>
-{
+public interface MappingUiDefinition<M, T> {
+
/**
- * Returns a unique string that corresponds to the key of the mapping in the
- * core (JavaAttributeMappingDefinition and/or OrmAttributeMappingProvider).
- *
- * @return The key representing the mapping
+ * Return a key that corresponds to the mapping's key.
+ *
+ * @see org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition#getKey()
+ * @see org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition#getKey()
+ * @see org.eclipse.jpt.jpa.core.context.orm.OrmTypeMappingDefinition#getKey()
+ * @see org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition#getKey()
*/
String getKey();
-
+
/**
- * Returns a human readable text of the mapping type.
- *
- * @return A display string for the mapping type
+ * Return a string that indicates the mapping type.
*/
String getLabel();
/**
- * Returns a human readable text of the mapping type to be used in the mapping change link label
+ * Return a string that indicates the mapping type and can be used
+ * in the mapping change link label.
*/
String getLinkLabel();
-
+
/**
- * Returns an image that represents the mapping type defined by this provider.
- *
- * @return An image representing a mapping or <code>null</code> if no image
- * is required
+ * Return a "normal" image that indicates the mapping type.
+ * @see #getGhostImage()
*/
Image getImage();
-
+
+ /**
+ * Return a "ghost" image that indicates the mapping type.
+ * @see #getImage()
+ */
+ Image getGhostImage();
+
/**
* Return whether the mapping type represented by this definition is enabled for the given
* mappable object. This is almost always true.
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/details/java/JavaAttributeMappingUiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/details/java/JavaAttributeMappingUiDefinition.java
index 5dbbfa1c76..e3b3da63c2 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/details/java/JavaAttributeMappingUiDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/details/java/JavaAttributeMappingUiDefinition.java
@@ -35,15 +35,10 @@ public interface JavaAttributeMappingUiDefinition<T extends AttributeMapping>
*
* @param factory The UI factory responsible to create the right composite
* for any mapping type
- * @param subjectHolder The holder of the subject being displayed
+ * @param mappingModel The model of the mapping being displayed
* @param parent The parent container
* @param widgetFactory The factory used to create the various widgets
* @return The composite displaying the information for a certain mapping
*/
- JpaComposite buildAttributeMappingComposite(
- JavaUiFactory factory,
- PropertyValueModel<T> subjectHolder,
- PropertyValueModel<Boolean> enabledModel,
- Composite parent,
- WidgetFactory widgetFactory);
+ JpaComposite buildAttributeMappingComposite(JavaUiFactory factory, PropertyValueModel<T> mappingModel, PropertyValueModel<Boolean> enabledModel, Composite parent, WidgetFactory widgetFactory);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/details/java/JavaTypeMappingUiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/details/java/JavaTypeMappingUiDefinition.java
index 9583a4809f..74202a75b0 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/details/java/JavaTypeMappingUiDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/details/java/JavaTypeMappingUiDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2012 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -35,14 +35,10 @@ public interface JavaTypeMappingUiDefinition<T extends TypeMapping>
*
* @param factory The UI factory responsible to create the right composite
* for any mapping type
- * @param subjectHolder The holder of the subject being displayed
+ * @param mappingModel The model of the mapping being displayed
* @param parent The parent container
* @param widgetFactory The factory used to create the various widgets
* @return The composite displaying the information for a certain mapping
*/
- JpaComposite buildTypeMappingComposite(
- JavaUiFactory factory,
- PropertyValueModel<T> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory);
+ JpaComposite buildTypeMappingComposite(JavaUiFactory factory, PropertyValueModel<T> mappingModel, Composite parent, WidgetFactory widgetFactory);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/details/orm/OrmAttributeMappingUiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/details/orm/OrmAttributeMappingUiDefinition.java
index a3fb5478e0..89cfb0c7be 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/details/orm/OrmAttributeMappingUiDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/details/orm/OrmAttributeMappingUiDefinition.java
@@ -35,15 +35,10 @@ public interface OrmAttributeMappingUiDefinition<T extends AttributeMapping>
*
* @param factory The UI factory responsible to create the right composite
* for any mapping type
- * @param subjectHolder The holder of the subject being displayed
+ * @param mappingModel The model of the mapping being displayed
* @param parent The parent container
* @param widgetFactory The factory used to create the various widgets
* @return The composite displaying the information for a certain mapping
*/
- JpaComposite buildAttributeMappingComposite(
- OrmXmlUiFactory factory,
- PropertyValueModel<T> subjectHolder,
- PropertyValueModel<Boolean> enabledModel,
- Composite parent,
- WidgetFactory widgetFactory);
+ JpaComposite buildAttributeMappingComposite(OrmXmlUiFactory factory, PropertyValueModel<T> mappingModel, PropertyValueModel<Boolean> enabledModel, Composite parent, WidgetFactory widgetFactory);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/details/orm/OrmTypeMappingUiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/details/orm/OrmTypeMappingUiDefinition.java
index f9f918bb6b..552cd31ed7 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/details/orm/OrmTypeMappingUiDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/details/orm/OrmTypeMappingUiDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2012 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -35,14 +35,10 @@ public interface OrmTypeMappingUiDefinition<T extends TypeMapping>
*
* @param factory The UI factory responsible to create the right composite
* for any mapping type
- * @param subjectHolder The holder of the subject being displayed
+ * @param mappingModel The model of the mapping being displayed
* @param parent The parent container
* @param widgetFactory The factory used to create the various widgets
* @return The composite displaying the information for a certain mapping
*/
- JpaComposite buildTypeMappingComposite(
- OrmXmlUiFactory factory,
- PropertyValueModel<T> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory);
+ JpaComposite buildTypeMappingComposite(OrmXmlUiFactory factory, PropertyValueModel<T> mappingModel, Composite parent, WidgetFactory widgetFactory);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/AbstractJpaPlatformUiProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/AbstractJpaPlatformUiProvider.java
index a2d20f16ae..365b545cd6 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/AbstractJpaPlatformUiProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/AbstractJpaPlatformUiProvider.java
@@ -11,22 +11,22 @@ package org.eclipse.jpt.jpa.ui.internal;
import java.util.ArrayList;
import java.util.List;
-import java.util.ListIterator;
-import org.eclipse.jpt.common.utility.internal.iterators.ArrayListIterator;
import org.eclipse.jpt.jpa.ui.JpaPlatformUiProvider;
import org.eclipse.jpt.jpa.ui.ResourceUiDefinition;
import org.eclipse.jpt.jpa.ui.details.JpaDetailsProvider;
/**
- * All the state in the JPA platform ui provider should be "static" (i.e. unchanging once
- * it is initialized).
+ * All the state in the JPA platform ui provider should be "static"
+ * (i.e. unchanging once it is initialized).
*/
-public abstract class AbstractJpaPlatformUiProvider implements JpaPlatformUiProvider
+public abstract class AbstractJpaPlatformUiProvider
+ implements JpaPlatformUiProvider
{
- private JpaDetailsProvider[] detailsProviders;
+ private ArrayList<JpaDetailsProvider> detailsProviders;
+
+ private ArrayList<ResourceUiDefinition> resourceUiDefinitions;
+
- private ResourceUiDefinition[] resourceUiDefinitions;
-
/**
* zero-argument constructor
*/
@@ -37,47 +37,39 @@ public abstract class AbstractJpaPlatformUiProvider implements JpaPlatformUiProv
// ********** details providers **********
- public ListIterator<JpaDetailsProvider> detailsProviders() {
- return new ArrayListIterator<JpaDetailsProvider>(getDetailsProviders());
- }
-
- protected synchronized JpaDetailsProvider[] getDetailsProviders() {
+ public synchronized Iterable<JpaDetailsProvider> getDetailsProviders() {
if (this.detailsProviders == null) {
this.detailsProviders = this.buildDetailsProviders();
}
return this.detailsProviders;
}
- protected JpaDetailsProvider[] buildDetailsProviders() {
+ protected ArrayList<JpaDetailsProvider> buildDetailsProviders() {
ArrayList<JpaDetailsProvider> providers = new ArrayList<JpaDetailsProvider>();
this.addDetailsProvidersTo(providers);
- return providers.toArray(new JpaDetailsProvider[providers.size()]);
+ return providers;
}
/**
* Implement this to specify JPA details providers.
*/
protected abstract void addDetailsProvidersTo(List<JpaDetailsProvider> providers);
-
-
-
+
+
+
// ********** structure providers **********
- public ListIterator<ResourceUiDefinition> resourceUiDefinitions() {
- return new ArrayListIterator<ResourceUiDefinition>(getResourceUiDefinitions());
- }
-
- protected synchronized ResourceUiDefinition[] getResourceUiDefinitions() {
+ public Iterable<ResourceUiDefinition> getResourceUiDefinitions() {
if (this.resourceUiDefinitions == null) {
this.resourceUiDefinitions = this.buildResourceUiDefinitions();
}
return this.resourceUiDefinitions;
}
- protected ResourceUiDefinition[] buildResourceUiDefinitions() {
+ protected ArrayList<ResourceUiDefinition> buildResourceUiDefinitions() {
ArrayList<ResourceUiDefinition> definitions = new ArrayList<ResourceUiDefinition>();
this.addResourceUiDefinitionsTo(definitions);
- return definitions.toArray(new ResourceUiDefinition[definitions.size()]);
+ return definitions;
}
/**
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/FileAdapterFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/FileAdapterFactory.java
index 388e1ec0dc..2bbd2388d7 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/FileAdapterFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/FileAdapterFactory.java
@@ -28,7 +28,7 @@ import org.eclipse.jpt.jpa.ui.JpaProjectModel;
* are applicable here also):<ul>
* <li>{@link org.eclipse.jpt.jpa.ui.JpaFileModel JpaFileModel}
* </ul>
- * See <code>org.eclipse.jpt.jpa.ui/plugin.xml</code>.
+ * See <code>org.eclipse.jpt.jpa.ui/plugin.xml:org.eclipse.core.runtime.adapters</code>.
*
* @see ProjectAdapterFactory
*/
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/ImageRepository.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/ImageRepository.java
index b93cd85284..1a9f7a5388 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/ImageRepository.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/ImageRepository.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2012 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -11,7 +11,7 @@ package org.eclipse.jpt.jpa.ui.internal;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ResourceManager;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.plugin.AbstractUIPlugin;
@@ -143,7 +143,7 @@ public final class ImageRepository {
private static ImageDescriptor buildImageDescriptor(String fileName) {
- return AbstractUIPlugin.imageDescriptorFromPlugin(JptJpaUiPlugin.PLUGIN_ID, "images/" + fileName);
+ return AbstractUIPlugin.imageDescriptorFromPlugin(JptJpaUiPlugin.instance().getPluginID(), "images/" + fileName);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JpaHelpContextIds.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JpaHelpContextIds.java
index bd03323320..c5f1c7a317 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JpaHelpContextIds.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JpaHelpContextIds.java
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.ui.internal;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
/**
* Help context ids for the Dali JPA UI.
@@ -22,7 +22,7 @@ import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
public interface JpaHelpContextIds {
//ContextID prefix
- public static final String PREFIX = JptJpaUiPlugin.PLUGIN_ID + ".";
+ public static final String PREFIX = JptJpaUiPlugin.instance().getPluginID() + ".";
//Persistent Type composites
public static final String ENTITY_ACCESS_TYPE = PREFIX + "entity_accessType";
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JpaJavaCompletionProposalComputer.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JpaJavaCompletionProposalComputer.java
index 64118423b7..376fd315d5 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JpaJavaCompletionProposalComputer.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JpaJavaCompletionProposalComputer.java
@@ -31,7 +31,7 @@ import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.jpa.core.JpaFile;
import org.eclipse.jpt.jpa.core.JpaStructureNode;
import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
/**
* JPA Java code-completion proposal computer
@@ -153,7 +153,7 @@ public class JpaJavaCompletionProposalComputer
try {
return (IFile) cu.getCorrespondingResource();
} catch (JavaModelException ex) {
- JptJpaUiPlugin.log(ex);
+ JptJpaUiPlugin.instance().logError(ex);
return null;
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JpaMappingImageHelper.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JpaMappingImageHelper.java
deleted file mode 100644
index 509a13eab8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JpaMappingImageHelper.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 Oracle.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.jpa.ui.internal;
-
-import org.eclipse.jpt.common.utility.internal.Tools;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.jpa2.MappingKeys2_0;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
-import org.eclipse.swt.graphics.Image;
-
-public class JpaMappingImageHelper
-{
-
- public static Image imageForTypeMapping(String mappingKey) {
- return JptJpaUiPlugin.getImage(iconKeyForTypeMapping(mappingKey));
- }
-
- public static String iconKeyForTypeMapping(String mappingKey) {
- if (Tools.valuesAreEqual(mappingKey, MappingKeys.NULL_TYPE_MAPPING_KEY)) {
- return JptUiIcons.NULL_TYPE_MAPPING;
- }
- if (Tools.valuesAreEqual(mappingKey, MappingKeys.ENTITY_TYPE_MAPPING_KEY)) {
- return JptUiIcons.ENTITY;
- }
- if (Tools.valuesAreEqual(mappingKey, MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY)) {
- return JptUiIcons.EMBEDDABLE;
- }
- if (Tools.valuesAreEqual(mappingKey, MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY)) {
- return JptUiIcons.MAPPED_SUPERCLASS;
- }
- return null;
- }
-
- public static Image imageForAttributeMapping(String mappingKey) {
- return JptJpaUiPlugin.getImage(iconKeyForAttributeMapping(mappingKey));
- }
-
- public static String iconKeyForAttributeMapping(String mappingKey) {
- if (MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY == mappingKey) {
- return JptUiIcons.NULL_ATTRIBUTE_MAPPING;
- }
- else if (MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY.equals(mappingKey)) {
- return JptUiIcons.BASIC;
- }
- else if (MappingKeys.ID_ATTRIBUTE_MAPPING_KEY.equals(mappingKey)) {
- return JptUiIcons.ID;
- }
- else if (MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY.equals(mappingKey)) {
- return JptUiIcons.VERSION;
- }
- else if (MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY.equals(mappingKey)) {
- return JptUiIcons.EMBEDDED_ID;
- }
- else if (MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY.equals(mappingKey)) {
- return JptUiIcons.EMBEDDED;
- }
- else if (MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY.equals(mappingKey)) {
- return JptUiIcons.ONE_TO_ONE;
- }
- else if (MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY.equals(mappingKey)) {
- return JptUiIcons.ONE_TO_MANY;
- }
- else if (MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY.equals(mappingKey)) {
- return JptUiIcons.MANY_TO_ONE;
- }
- else if (MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY.equals(mappingKey)) {
- return JptUiIcons.MANY_TO_MANY;
- }
- else if (MappingKeys2_0.ELEMENT_COLLECTION_ATTRIBUTE_MAPPING_KEY.equals(mappingKey)) {
- return JptUiIcons.ELEMENT_COLLECTION;
- }
- else if (MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY.equals(mappingKey)) {
- return JptUiIcons.TRANSIENT;
- }
- //return the JPA_CONTENT icon instead of null, might as well have an icon if one is not defined
- return JptUiIcons.JPA_CONTENT;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JpaPlatformAdapterFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JpaPlatformAdapterFactory.java
index bc1de165e0..587b9c4f74 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JpaPlatformAdapterFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JpaPlatformAdapterFactory.java
@@ -18,7 +18,7 @@ import org.eclipse.jpt.jpa.ui.internal.platform.JpaPlatformUiRegistry;
* Factory to build adapters for a {@link JpaPlatform}:<ul>
* <li>{@link JpaPlatformUi}
* </ul>
- * See <code>org.eclipse.jpt.jpa.ui/plugin.xml</code>.
+ * See <code>org.eclipse.jpt.jpa.ui/plugin.xml:org.eclipse.core.runtime.adapters</code>.
*
* @see JpaPlatformUiRegistry
*/
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JpaStructureNodeAdapterFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JpaStructureNodeAdapterFactory.java
index 220c128fbc..9d17111a7c 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JpaStructureNodeAdapterFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JpaStructureNodeAdapterFactory.java
@@ -21,7 +21,7 @@ import org.eclipse.swt.widgets.Composite;
* Factory to build adapters for a {@link JpaStructureNode}:<ul>
* <li>{@link org.eclipse.jpt.jpa.ui.details.JpaDetailsPageManager.Factory}
* </ul>
- * See <code>org.eclipse.jpt.jpa.ui/plugin.xml</code>.
+ * See <code>org.eclipse.jpt.jpa.ui/plugin.xml:org.eclipse.core.runtime.adapters</code>.
*/
public class JpaStructureNodeAdapterFactory
implements IAdapterFactory
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JpaXmlCompletionProposalComputer.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JpaXmlCompletionProposalComputer.java
index e2c64319b9..e5c2bff977 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JpaXmlCompletionProposalComputer.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JpaXmlCompletionProposalComputer.java
@@ -1,25 +1,14 @@
/*******************************************************************************
* 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 and Eclipse Distribution License v. 1.0
- * which accompanies this distribution.
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
* Contributors:
* Oracle - initial API and implementation
- *
******************************************************************************/
package org.eclipse.jpt.jpa.ui.internal;
-/**
- * This computer adds content assist support for a mapping file (ORM Configuration).
- *
- * @version 2.3
- * @since 2.3
- */
-
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -37,8 +26,8 @@ import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.jpa.core.JpaFile;
import org.eclipse.jpt.jpa.core.JpaStructureNode;
-import org.eclipse.jpt.jpa.core.JpaXmlStructureNode;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
+import org.eclipse.jpt.jpa.core.context.XmlFile;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
import org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext;
import org.eclipse.wst.sse.ui.internal.contentassist.CustomCompletionProposal;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
@@ -50,6 +39,12 @@ import org.eclipse.wst.xml.ui.internal.contentassist.XMLRelevanceConstants;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
+/**
+ * This computer adds content assist support for a mapping file (ORM Configuration).
+ *
+ * @version 2.3
+ * @since 2.3
+ */
public class JpaXmlCompletionProposalComputer extends DefaultJpaXmlCompletionProposalComputer {
public JpaXmlCompletionProposalComputer() {
@@ -66,7 +61,7 @@ public class JpaXmlCompletionProposalComputer extends DefaultJpaXmlCompletionPro
// and then return an empty list to prevent code completion process from
// crashing. We need to determine if runtime exceptions should be
// expected. If so, we could remove the log(ex) in the future.
- JptJpaUiPlugin.log(ex);
+ JptJpaUiPlugin.instance().logError(ex);
return Collections.emptyList();
}
}
@@ -149,7 +144,7 @@ public class JpaXmlCompletionProposalComputer extends DefaultJpaXmlCompletionPro
if ((matchString.length() == 0) || StringTools.stringStartsWithIgnoreCase(possibleValue, matchString)) {
CustomCompletionProposal proposal = new CustomCompletionProposal(
possibleValue, begin, length, possibleValue.length(),
- JptJpaUiPlugin.getImage(JptUiIcons.JPA_CONTENT),
+ JptJpaUiPlugin.instance().getImage(JptUiIcons.JPA_CONTENT),
possibleValue, null, null, XMLRelevanceConstants.R_TAG_INSERTION);
contentAssistRequest.addProposal(proposal);
}
@@ -164,7 +159,6 @@ public class JpaXmlCompletionProposalComputer extends DefaultJpaXmlCompletionPro
* Retrieves all of the possible valid values for this attribute/element declaration
*/
private List<String> getProposedValues(CompletionProposalInvocationContext context) {
- List<String> list = new ArrayList<String>();
int documentPosition = context.getInvocationOffset();
if (documentPosition == -1) return Collections.emptyList();
@@ -183,14 +177,9 @@ public class JpaXmlCompletionProposalComputer extends DefaultJpaXmlCompletionPro
return Collections.emptyList();
}
+ List<String> list = new ArrayList<String>();
for (JpaStructureNode node : rootStructureNodes) {
- Iterable<String> strings = ((JpaXmlStructureNode) node).getXmlCompletionProposals(documentPosition);
- if (strings != null) {
- CollectionTools.addAll(list, strings);
- } else {
- return Collections.emptyList();
- }
-
+ CollectionTools.addAll(list, ((XmlFile.Root) node).getXmlCompletionProposals(documentPosition));
}
return list;
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JptUiIcons.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JptUiIcons.java
index f07c6c921a..7c981cc97f 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JptUiIcons.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JptUiIcons.java
@@ -1,60 +1,16 @@
/*******************************************************************************
- * 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
+ ******************************************************************************/
package org.eclipse.jpt.jpa.ui.internal;
-import org.eclipse.draw2d.ImageUtilities;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.ImageData;
-
@SuppressWarnings("nls")
-public class JptUiIcons
-{
- /**
- * Creates and returns a new SWT image that is a grayed out version of the image
- * corresponding to the passed in key. Stores this gray image in the JptJpaUiPlugin
- * ImageRegistry with -gray appended to the key.
- * Clients of this method should not dispose of the image.
- *
- * This method is synchronized to prevent concurrent access of the ImageRegistry by
- * multiple threads.
- *
- * @return a new grayed out image
- */
- public static synchronized Image ghost(String key) {
- Image existingImage = JptJpaUiPlugin.instance().getImageRegistry().get(key + "-gray");
- if (existingImage != null) {
- return existingImage;
- }
-
- Image grayImage = buildGhostImage(key);
- JptJpaUiPlugin.instance().getImageRegistry().put(key + "-gray", grayImage);
- return grayImage;
- }
-
- private static Image buildGhostImage(String key) {
- Image originalImage = JptJpaUiPlugin.getImage(key);
- Color lightGray = new Color(originalImage.getDevice(), 223, 223, 223);
- ImageData imageData = ImageUtilities.createShadedImage(originalImage, lightGray);
-
- Image shadedImage = new Image(originalImage.getDevice(), imageData);
- Image grayImage = new Image(originalImage.getDevice(), shadedImage, SWT.IMAGE_GRAY);
-
- lightGray.dispose();
- shadedImage.dispose();
- return grayImage;
- }
-
+public class JptUiIcons {
// **************** General JPA icons **************************************
@@ -136,4 +92,4 @@ public class JptUiIcons
public static final String JPQL_IDENTIFIER = "full/obj16/jpql.identifier";
public static final String JPQL_VARIABLE = "full/obj16/jpql.variable";
-} \ No newline at end of file
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/ProjectAdapterFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/ProjectAdapterFactory.java
index 8f5ff00a3e..e9a46ccdd4 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/ProjectAdapterFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/ProjectAdapterFactory.java
@@ -36,7 +36,7 @@ import org.eclipse.jpt.jpa.ui.JpaRootContextNodeModel;
* This adapter is much like the {@link org.eclipse.jpt.jpa.ui.JpaProjectModel JpaProjectModel}
* adapter described above.
* </ul>
- * See <code>org.eclipse.jpt.jpa.ui/plugin.xml</code>.
+ * See <code>org.eclipse.jpt.jpa.ui/plugin.xml:org.eclipse.core.runtime.adapters</code>.
*/
public class ProjectAdapterFactory
implements IAdapterFactory
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/WorkspaceAdapterFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/WorkspaceAdapterFactory.java
index 96254f916e..be01af2471 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/WorkspaceAdapterFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/WorkspaceAdapterFactory.java
@@ -14,6 +14,7 @@ import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.jpt.common.utility.internal.model.value.CollectionAspectAdapter;
import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.JpaProjectManager;
+import org.eclipse.jpt.jpa.core.JpaWorkspace;
import org.eclipse.jpt.jpa.ui.JpaProjectsModel;
/**
@@ -26,7 +27,7 @@ import org.eclipse.jpt.jpa.ui.JpaProjectsModel;
* any uncreated JPA projects but should be notified if the JPA project
* <em>is</em> ever created (e.g. UI views).
* </ul>
- * See <code>org.eclipse.jpt.jpa.ui/plugin.xml</code>.
+ * See <code>org.eclipse.jpt.jpa.ui/plugin.xml:org.eclipse.core.runtime.adapters</code>.
*/
public class WorkspaceAdapterFactory
implements IAdapterFactory
@@ -86,8 +87,8 @@ public class WorkspaceAdapterFactory
return this.subject.getJpaProjectsSize();
}
- public IWorkspace getWorkspace() {
- return this.subject.getWorkspace();
+ public JpaWorkspace getJpaWorkspace() {
+ return this.subject.getJpaWorkspace();
}
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/actions/MakePersistentAction.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/actions/MakePersistentAction.java
index 766719dd02..bde2b1db68 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/actions/MakePersistentAction.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/actions/MakePersistentAction.java
@@ -25,7 +25,7 @@ import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
import org.eclipse.jpt.jpa.ui.internal.wizards.JpaMakePersistentWizard;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
@@ -111,7 +111,7 @@ public class MakePersistentAction implements IObjectActionDelegate {
return packageFragment.getCompilationUnits();
}
catch (JavaModelException e) {
- JptJpaUiPlugin.log(e);
+ JptJpaUiPlugin.instance().logError(e);
}
return new ICompilationUnit[0];
}
@@ -121,7 +121,7 @@ public class MakePersistentAction implements IObjectActionDelegate {
return packageFragmentRoot.getChildren();
}
catch (JavaModelException e) {
- JptJpaUiPlugin.log(e);
+ JptJpaUiPlugin.instance().logError(e);
}
return new IJavaElement[0];
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/actions/SynchronizeClassesAction.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/actions/SynchronizeClassesAction.java
index 759f96733a..0c37d57f34 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/actions/SynchronizeClassesAction.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/actions/SynchronizeClassesAction.java
@@ -33,8 +33,8 @@ import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
import org.eclipse.jpt.jpa.ui.internal.JptUiMessages;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
import org.eclipse.ui.IObjectActionDelegate;
import org.eclipse.ui.IWorkbenchPart;
@@ -79,10 +79,10 @@ public class SynchronizeClassesAction
IRunnableWithProgress runnable = new SyncRunnable(this.persistenceXmlFile);
this.buildProgressMonitorDialog().run(true, true, runnable); // true => fork; true => cancellable
} catch (InvocationTargetException ex) {
- JptJpaUiPlugin.log(ex);
+ JptJpaUiPlugin.instance().logError(ex);
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
- JptJpaUiPlugin.log(ex);
+ JptJpaUiPlugin.instance().logError(ex);
}
}
@@ -170,7 +170,7 @@ public class SynchronizeClassesAction
return; // unlikely...
}
- Persistence persistence = persistenceXml.getPersistence();
+ Persistence persistence = persistenceXml.getRoot();
if (persistence == null) {
return; // unlikely...
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/commands/ConvertJavaProjectToJpaCommandHandler.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/commands/ConvertJavaProjectToJpaCommandHandler.java
index 6f8a2d9022..eb90d04d93 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/commands/ConvertJavaProjectToJpaCommandHandler.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/commands/ConvertJavaProjectToJpaCommandHandler.java
@@ -28,9 +28,9 @@ import org.eclipse.jface.window.Window;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
import org.eclipse.jpt.common.utility.internal.ArrayTools;
-import org.eclipse.jpt.jpa.core.JpaFacet;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
+import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.ui.internal.JptUiMessages;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.handlers.HandlerUtil;
@@ -96,11 +96,11 @@ public class ConvertJavaProjectToJpaCommandHandler
}
}
catch (InvocationTargetException ex) {
- JptJpaUiPlugin.log(ex);
+ JptJpaUiPlugin.instance().logError(ex);
}
catch(InterruptedException ex) {
Thread.currentThread().interrupt();
- JptJpaUiPlugin.log(ex);
+ JptJpaUiPlugin.instance().logError(ex);
removeFacetNature(project);
}
}
@@ -118,7 +118,7 @@ public class ConvertJavaProjectToJpaCommandHandler
project.setDescription(description, null);
}
catch (CoreException ce) {
- JptJpaUiPlugin.log(ce);
+ JptJpaUiPlugin.instance().logError(ce);
}
}
@@ -146,8 +146,8 @@ public class ConvertJavaProjectToJpaCommandHandler
this.fprojwc = fproj.createWorkingCopy();
this.fprojwc.detect(detectProgressMonitor);
- if (! this.fprojwc.hasProjectFacet(JpaFacet.FACET)) {
- this.fprojwc.addProjectFacet(JpaFacet.FACET.getDefaultVersion());
+ if (! this.fprojwc.hasProjectFacet(JpaProject.FACET)) {
+ this.fprojwc.addProjectFacet(JpaProject.FACET.getDefaultVersion());
}
}
catch(CoreException e) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractBasicMappingUiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractBasicMappingUiDefinition.java
index f0ef46dffc..7e40001689 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractBasicMappingUiDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractBasicMappingUiDefinition.java
@@ -1,19 +1,17 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
+ * Copyright (c) 2008, 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
package org.eclipse.jpt.jpa.ui.internal.details;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.BasicMapping;
-import org.eclipse.jpt.jpa.ui.internal.JpaMappingImageHelper;
-import org.eclipse.swt.graphics.Image;
+import org.eclipse.jpt.jpa.ui.internal.JptUiIcons;
public abstract class AbstractBasicMappingUiDefinition<M, T extends BasicMapping>
extends AbstractMappingUiDefinition<M, T>
@@ -21,21 +19,21 @@ public abstract class AbstractBasicMappingUiDefinition<M, T extends BasicMapping
protected AbstractBasicMappingUiDefinition() {
super();
}
-
-
- public Image getImage() {
- return JpaMappingImageHelper.imageForAttributeMapping(getKey());
+
+ public String getKey() {
+ return MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY;
}
-
+
public String getLabel() {
return JptUiDetailsMessages.BasicMappingUiProvider_label;
}
-
+
public String getLinkLabel() {
return JptUiDetailsMessages.BasicMappingUiProvider_linkLabel;
}
-
- public String getKey() {
- return MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY;
+
+ @Override
+ protected String getImageKey() {
+ return JptUiIcons.BASIC;
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractEmbeddableUiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractEmbeddableUiDefinition.java
index 985eb31d32..c67d551a1a 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractEmbeddableUiDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractEmbeddableUiDefinition.java
@@ -1,19 +1,17 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
+ * Copyright (c) 2008, 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
package org.eclipse.jpt.jpa.ui.internal.details;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.Embeddable;
-import org.eclipse.jpt.jpa.ui.internal.JpaMappingImageHelper;
-import org.eclipse.swt.graphics.Image;
+import org.eclipse.jpt.jpa.ui.internal.JptUiIcons;
public abstract class AbstractEmbeddableUiDefinition<M, T extends Embeddable>
extends AbstractMappingUiDefinition<M, T>
@@ -21,21 +19,21 @@ public abstract class AbstractEmbeddableUiDefinition<M, T extends Embeddable>
protected AbstractEmbeddableUiDefinition() {
super();
}
-
-
+
public String getKey() {
return MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY;
}
-
+
public String getLabel() {
return JptUiDetailsMessages.EmbeddableUiProvider_label;
}
-
+
public String getLinkLabel() {
return JptUiDetailsMessages.EmbeddableUiProvider_linkLabel;
}
-
- public Image getImage() {
- return JpaMappingImageHelper.imageForTypeMapping(getKey());
+
+ @Override
+ protected String getImageKey() {
+ return JptUiIcons.EMBEDDABLE;
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractEmbeddedIdMappingUiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractEmbeddedIdMappingUiDefinition.java
index 142fe12e4e..2906100949 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractEmbeddedIdMappingUiDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractEmbeddedIdMappingUiDefinition.java
@@ -1,20 +1,17 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
+ * Copyright (c) 2008, 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
package org.eclipse.jpt.jpa.ui.internal.details;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.EmbeddedIdMapping;
-import org.eclipse.jpt.jpa.ui.internal.JpaMappingImageHelper;
-import org.eclipse.swt.graphics.Image;
-
+import org.eclipse.jpt.jpa.ui.internal.JptUiIcons;
public abstract class AbstractEmbeddedIdMappingUiDefinition<M, T extends EmbeddedIdMapping>
extends AbstractMappingUiDefinition<M, T>
@@ -22,8 +19,7 @@ public abstract class AbstractEmbeddedIdMappingUiDefinition<M, T extends Embedde
protected AbstractEmbeddedIdMappingUiDefinition() {
super();
}
-
-
+
public String getKey() {
return MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY;
}
@@ -36,7 +32,8 @@ public abstract class AbstractEmbeddedIdMappingUiDefinition<M, T extends Embedde
return JptUiDetailsMessages.EmbeddedIdMappingUiProvider_linkLabel;
}
- public Image getImage() {
- return JpaMappingImageHelper.imageForAttributeMapping(getKey());
+ @Override
+ protected String getImageKey() {
+ return JptUiIcons.EMBEDDED_ID;
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractEmbeddedMappingUiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractEmbeddedMappingUiDefinition.java
index f699c1a6e3..750ec03cae 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractEmbeddedMappingUiDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractEmbeddedMappingUiDefinition.java
@@ -1,19 +1,17 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
+ * Copyright (c) 2008, 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
package org.eclipse.jpt.jpa.ui.internal.details;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.EmbeddedMapping;
-import org.eclipse.jpt.jpa.ui.internal.JpaMappingImageHelper;
-import org.eclipse.swt.graphics.Image;
+import org.eclipse.jpt.jpa.ui.internal.JptUiIcons;
public abstract class AbstractEmbeddedMappingUiDefinition<M, T extends EmbeddedMapping>
extends AbstractMappingUiDefinition<M, T>
@@ -21,8 +19,7 @@ public abstract class AbstractEmbeddedMappingUiDefinition<M, T extends EmbeddedM
protected AbstractEmbeddedMappingUiDefinition() {
super();
}
-
-
+
public String getKey() {
return MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY;
}
@@ -35,7 +32,8 @@ public abstract class AbstractEmbeddedMappingUiDefinition<M, T extends EmbeddedM
return JptUiDetailsMessages.EmbeddedMappingUiProvider_linkLabel;
}
- public Image getImage() {
- return JpaMappingImageHelper.imageForAttributeMapping(getKey());
+ @Override
+ protected String getImageKey() {
+ return JptUiIcons.EMBEDDED;
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractEntityUiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractEntityUiDefinition.java
index 1dae9012f0..9b07875dcd 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractEntityUiDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractEntityUiDefinition.java
@@ -1,19 +1,17 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
+ * Copyright (c) 2008, 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
package org.eclipse.jpt.jpa.ui.internal.details;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.Entity;
-import org.eclipse.jpt.jpa.ui.internal.JpaMappingImageHelper;
-import org.eclipse.swt.graphics.Image;
+import org.eclipse.jpt.jpa.ui.internal.JptUiIcons;
public abstract class AbstractEntityUiDefinition<M, T extends Entity>
extends AbstractMappingUiDefinition<M, T>
@@ -21,8 +19,7 @@ public abstract class AbstractEntityUiDefinition<M, T extends Entity>
protected AbstractEntityUiDefinition() {
super();
}
-
-
+
public String getKey() {
return MappingKeys.ENTITY_TYPE_MAPPING_KEY;
}
@@ -34,8 +31,9 @@ public abstract class AbstractEntityUiDefinition<M, T extends Entity>
public String getLinkLabel() {
return JptUiDetailsMessages.EntityUiProvider_linkLabel;
}
-
- public Image getImage() {
- return JpaMappingImageHelper.imageForTypeMapping(getKey());
+
+ @Override
+ protected String getImageKey() {
+ return JptUiIcons.ENTITY;
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractIdMappingUiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractIdMappingUiDefinition.java
index 32a63a31bb..a8ea915004 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractIdMappingUiDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractIdMappingUiDefinition.java
@@ -1,19 +1,17 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
+ * Copyright (c) 2008, 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
package org.eclipse.jpt.jpa.ui.internal.details;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.IdMapping;
-import org.eclipse.jpt.jpa.ui.internal.JpaMappingImageHelper;
-import org.eclipse.swt.graphics.Image;
+import org.eclipse.jpt.jpa.ui.internal.JptUiIcons;
public abstract class AbstractIdMappingUiDefinition<M, T extends IdMapping>
@@ -22,12 +20,11 @@ public abstract class AbstractIdMappingUiDefinition<M, T extends IdMapping>
protected AbstractIdMappingUiDefinition() {
super();
}
-
-
- public Image getImage() {
- return JpaMappingImageHelper.imageForAttributeMapping(getKey());
+
+ public String getKey() {
+ return MappingKeys.ID_ATTRIBUTE_MAPPING_KEY;
}
-
+
public String getLabel() {
return JptUiDetailsMessages.IdMappingUiProvider_label;
}
@@ -36,7 +33,8 @@ public abstract class AbstractIdMappingUiDefinition<M, T extends IdMapping>
return JptUiDetailsMessages.IdMappingUiProvider_linkLabel;
}
- public String getKey() {
- return MappingKeys.ID_ATTRIBUTE_MAPPING_KEY;
+ @Override
+ protected String getImageKey() {
+ return JptUiIcons.ID;
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractManyToManyMappingUiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractManyToManyMappingUiDefinition.java
index 331af34391..5aa06d1f2d 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractManyToManyMappingUiDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractManyToManyMappingUiDefinition.java
@@ -1,19 +1,17 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
+ * Copyright (c) 2008, 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
package org.eclipse.jpt.jpa.ui.internal.details;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.ManyToManyMapping;
-import org.eclipse.jpt.jpa.ui.internal.JpaMappingImageHelper;
-import org.eclipse.swt.graphics.Image;
+import org.eclipse.jpt.jpa.ui.internal.JptUiIcons;
public abstract class AbstractManyToManyMappingUiDefinition<M, T extends ManyToManyMapping>
extends AbstractMappingUiDefinition<M, T>
@@ -21,10 +19,9 @@ public abstract class AbstractManyToManyMappingUiDefinition<M, T extends ManyToM
protected AbstractManyToManyMappingUiDefinition() {
super();
}
-
-
- public Image getImage() {
- return JpaMappingImageHelper.imageForAttributeMapping(getKey());
+
+ public String getKey() {
+ return MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY;
}
public String getLabel() {
@@ -34,8 +31,8 @@ public abstract class AbstractManyToManyMappingUiDefinition<M, T extends ManyToM
public String getLinkLabel() {
return JptUiDetailsMessages.ManyToManyMappingUiProvider_linkLabel;
}
-
- public String getKey() {
- return MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY;
+ @Override
+ protected String getImageKey() {
+ return JptUiIcons.MANY_TO_MANY;
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractManyToOneMappingUiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractManyToOneMappingUiDefinition.java
index 74635a0651..efb22f8acd 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractManyToOneMappingUiDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractManyToOneMappingUiDefinition.java
@@ -1,19 +1,17 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
+ * Copyright (c) 2008, 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
package org.eclipse.jpt.jpa.ui.internal.details;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.ManyToOneMapping;
-import org.eclipse.jpt.jpa.ui.internal.JpaMappingImageHelper;
-import org.eclipse.swt.graphics.Image;
+import org.eclipse.jpt.jpa.ui.internal.JptUiIcons;
public abstract class AbstractManyToOneMappingUiDefinition<M, T extends ManyToOneMapping>
extends AbstractMappingUiDefinition<M, T>
@@ -21,12 +19,11 @@ public abstract class AbstractManyToOneMappingUiDefinition<M, T extends ManyToOn
protected AbstractManyToOneMappingUiDefinition() {
super();
}
-
-
- public Image getImage() {
- return JpaMappingImageHelper.imageForAttributeMapping(getKey());
+
+ public String getKey() {
+ return MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY;
}
-
+
public String getLabel() {
return JptUiDetailsMessages.ManyToOneMappingUiProvider_label;
}
@@ -34,8 +31,9 @@ public abstract class AbstractManyToOneMappingUiDefinition<M, T extends ManyToOn
public String getLinkLabel() {
return JptUiDetailsMessages.ManyToOneMappingUiProvider_linkLabel;
}
-
- public String getKey() {
- return MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY;
+
+ @Override
+ protected String getImageKey() {
+ return JptUiIcons.MANY_TO_ONE;
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractMappedSuperclassUiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractMappedSuperclassUiDefinition.java
index 2d76a0b67b..2ca163770b 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractMappedSuperclassUiDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractMappedSuperclassUiDefinition.java
@@ -1,19 +1,17 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
+ * Copyright (c) 2008, 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
package org.eclipse.jpt.jpa.ui.internal.details;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.MappedSuperclass;
-import org.eclipse.jpt.jpa.ui.internal.JpaMappingImageHelper;
-import org.eclipse.swt.graphics.Image;
+import org.eclipse.jpt.jpa.ui.internal.JptUiIcons;
public abstract class AbstractMappedSuperclassUiDefinition<M, T extends MappedSuperclass>
extends AbstractMappingUiDefinition<M, T>
@@ -21,21 +19,21 @@ public abstract class AbstractMappedSuperclassUiDefinition<M, T extends MappedSu
protected AbstractMappedSuperclassUiDefinition() {
super();
}
-
-
+
public String getKey() {
return MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY;
}
-
+
public String getLabel() {
return JptUiDetailsMessages.MappedSuperclassUiProvider_label;
}
-
+
public String getLinkLabel() {
return JptUiDetailsMessages.MappedSuperclassUiProvider_linkLabel;
}
-
- public Image getImage() {
- return JpaMappingImageHelper.imageForTypeMapping(getKey());
+
+ @Override
+ protected String getImageKey() {
+ return JptUiIcons.MAPPED_SUPERCLASS;
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractMappingUiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractMappingUiDefinition.java
index 54562e5693..565eba2b75 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractMappingUiDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractMappingUiDefinition.java
@@ -1,15 +1,19 @@
/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
+ * Copyright (c) 2010, 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
package org.eclipse.jpt.jpa.ui.internal.details;
+import org.eclipse.jpt.common.ui.internal.JptUIPlugin;
import org.eclipse.jpt.jpa.ui.details.MappingUiDefinition;
+import org.eclipse.jpt.jpa.ui.internal.JptUiIcons;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
+import org.eclipse.swt.graphics.Image;
public abstract class AbstractMappingUiDefinition<M, T>
implements MappingUiDefinition<M, T>
@@ -17,8 +21,41 @@ public abstract class AbstractMappingUiDefinition<M, T>
protected AbstractMappingUiDefinition() {
super();
}
-
-
+
+ /**
+ * Subclasses can use the Dali-provided icons by overriding the method
+ * {@link #getImageKey()} to return a key to one of the icons in the
+ * <code>org.eclipse.jpt.jpa.ui/icons</code> folder.
+ * @see JptUIPlugin#getImage(String)
+ */
+ public final Image getImage() {
+ return JptJpaUiPlugin.instance().getImage(this.getImageKey());
+ }
+
+ /**
+ * Subclasses can use the Dali-provided icons by overriding the method
+ * {@link #getImageKey()} to return a key to one of the icons in the
+ * <code>org.eclipse.jpt.jpa.ui/icons</code> folder.
+ * @see JptUIPlugin#getGhostImage(String)
+ */
+ public Image getGhostImage() {
+ return JptJpaUiPlugin.instance().getGhostImage(this.getImageKey());
+ }
+
+ /**
+ * Return the image key for a Dali-supplied icon; i.e. an icon in the
+ * <code>org.eclipse.jpt.jpa.ui/icons</code> folder.
+ * Override {@link #getImage()} and {@link #getGhostImage()} to use
+ * non-Dali-supplied icons.
+ * <p>
+ * By default return the key for the generic JPA content image.
+ *
+ * @see JptUIPlugin#getImage(String)
+ */
+ protected String getImageKey() {
+ return JptUiIcons.JPA_CONTENT;
+ }
+
public boolean isEnabledFor(M mappableObject) {
return true;
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractOneToManyMappingUiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractOneToManyMappingUiDefinition.java
index 26680dbc0d..21c3054c57 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractOneToManyMappingUiDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractOneToManyMappingUiDefinition.java
@@ -1,19 +1,17 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
+ * Copyright (c) 2008, 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
package org.eclipse.jpt.jpa.ui.internal.details;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.OneToManyMapping;
-import org.eclipse.jpt.jpa.ui.internal.JpaMappingImageHelper;
-import org.eclipse.swt.graphics.Image;
+import org.eclipse.jpt.jpa.ui.internal.JptUiIcons;
public abstract class AbstractOneToManyMappingUiDefinition<M, T extends OneToManyMapping>
extends AbstractMappingUiDefinition<M, T>
@@ -21,10 +19,9 @@ public abstract class AbstractOneToManyMappingUiDefinition<M, T extends OneToMan
protected AbstractOneToManyMappingUiDefinition() {
super();
}
-
-
- public Image getImage() {
- return JpaMappingImageHelper.imageForAttributeMapping(getKey());
+
+ public String getKey() {
+ return MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY;
}
public String getLabel() {
@@ -34,8 +31,9 @@ public abstract class AbstractOneToManyMappingUiDefinition<M, T extends OneToMan
public String getLinkLabel() {
return JptUiDetailsMessages.OneToManyMappingUiProvider_linkLabel;
}
-
- public String getKey() {
- return MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY;
+
+ @Override
+ protected String getImageKey() {
+ return JptUiIcons.ONE_TO_MANY;
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractOneToOneMappingUiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractOneToOneMappingUiDefinition.java
index 133ad70daa..88c6584814 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractOneToOneMappingUiDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractOneToOneMappingUiDefinition.java
@@ -1,19 +1,17 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
+ * Copyright (c) 2008, 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
package org.eclipse.jpt.jpa.ui.internal.details;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.OneToOneMapping;
-import org.eclipse.jpt.jpa.ui.internal.JpaMappingImageHelper;
-import org.eclipse.swt.graphics.Image;
+import org.eclipse.jpt.jpa.ui.internal.JptUiIcons;
public abstract class AbstractOneToOneMappingUiDefinition<M, T extends OneToOneMapping>
extends AbstractMappingUiDefinition<M, T>
@@ -21,12 +19,11 @@ public abstract class AbstractOneToOneMappingUiDefinition<M, T extends OneToOneM
protected AbstractOneToOneMappingUiDefinition() {
super();
}
-
-
- public Image getImage() {
- return JpaMappingImageHelper.imageForAttributeMapping(getKey());
+
+ public String getKey() {
+ return MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY;
}
-
+
public String getLabel() {
return JptUiDetailsMessages.OneToOneMappingUiProvider_label;
}
@@ -35,7 +32,8 @@ public abstract class AbstractOneToOneMappingUiDefinition<M, T extends OneToOneM
return JptUiDetailsMessages.OneToOneMappingUiProvider_linkLabel;
}
- public String getKey() {
- return MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY;
+ @Override
+ protected String getImageKey() {
+ return JptUiIcons.ONE_TO_ONE;
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractOverridesComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractOverridesComposite.java
index 537fa2ec87..db22c3e2e8 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractOverridesComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractOverridesComposite.java
@@ -28,7 +28,7 @@ import org.eclipse.jpt.common.utility.internal.model.value.ListAspectAdapter;
import org.eclipse.jpt.common.utility.internal.model.value.ModifiablePropertyCollectionValueModelAdapter;
import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel;
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.value.CollectionValueModel;
import org.eclipse.jpt.common.utility.model.value.ListValueModel;
import org.eclipse.jpt.common.utility.model.value.ModifiablePropertyValueModel;
@@ -224,7 +224,7 @@ public abstract class AbstractOverridesComposite<T extends JpaContextNode>
}
private ModifiablePropertyValueModel<Boolean> buildOverrideVirtualOverrideHolder() {
- return new TransformationWritablePropertyValueModel<ReadOnlyOverride, Boolean>(this.selectedOverrideModel) {
+ return new TransformationModifiablePropertyValueModel<ReadOnlyOverride, Boolean>(this.selectedOverrideModel) {
@Override
public void setValue(Boolean value) {
updateOverride(value.booleanValue());
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractTransientMappingUiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractTransientMappingUiDefinition.java
index 0453e01eb0..511b62de75 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractTransientMappingUiDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractTransientMappingUiDefinition.java
@@ -1,19 +1,17 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
+ * Copyright (c) 2008, 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
package org.eclipse.jpt.jpa.ui.internal.details;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.TransientMapping;
-import org.eclipse.jpt.jpa.ui.internal.JpaMappingImageHelper;
-import org.eclipse.swt.graphics.Image;
+import org.eclipse.jpt.jpa.ui.internal.JptUiIcons;
public abstract class AbstractTransientMappingUiDefinition<M, T extends TransientMapping>
extends AbstractMappingUiDefinition<M, T>
@@ -21,12 +19,11 @@ public abstract class AbstractTransientMappingUiDefinition<M, T extends Transien
protected AbstractTransientMappingUiDefinition() {
super();
}
-
-
- public Image getImage() {
- return JpaMappingImageHelper.imageForAttributeMapping(getKey());
- }
-
+
+ public String getKey() {
+ return MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY;
+ }
+
public String getLabel() {
return JptUiDetailsMessages.TransientMappingUiProvider_label;
}
@@ -34,8 +31,9 @@ public abstract class AbstractTransientMappingUiDefinition<M, T extends Transien
public String getLinkLabel() {
return JptUiDetailsMessages.TransientMappingUiProvider_linkLabel;
}
-
- public String getKey() {
- return MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY;
- }
+
+ @Override
+ protected String getImageKey() {
+ return JptUiIcons.TRANSIENT;
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractVersionMappingUiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractVersionMappingUiDefinition.java
index 829f66bc5b..55395fc6d7 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractVersionMappingUiDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractVersionMappingUiDefinition.java
@@ -1,19 +1,17 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
+ * Copyright (c) 2008, 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
package org.eclipse.jpt.jpa.ui.internal.details;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.VersionMapping;
-import org.eclipse.jpt.jpa.ui.internal.JpaMappingImageHelper;
-import org.eclipse.swt.graphics.Image;
+import org.eclipse.jpt.jpa.ui.internal.JptUiIcons;
public abstract class AbstractVersionMappingUiDefinition<M, T extends VersionMapping>
extends AbstractMappingUiDefinition<M, T>
@@ -21,10 +19,9 @@ public abstract class AbstractVersionMappingUiDefinition<M, T extends VersionMap
protected AbstractVersionMappingUiDefinition() {
super();
}
-
-
- public Image getImage() {
- return JpaMappingImageHelper.imageForAttributeMapping(getKey());
+
+ public String getKey() {
+ return MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY;
}
public String getLabel() {
@@ -34,8 +31,9 @@ public abstract class AbstractVersionMappingUiDefinition<M, T extends VersionMap
public String getLinkLabel() {
return JptUiDetailsMessages.VersionMappingUiProvider_linkLabel;
}
-
- public String getKey() {
- return MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY;
+
+ @Override
+ protected String getImageKey() {
+ return JptUiIcons.VERSION;
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/JoinTableComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/JoinTableComposite.java
index 89e6cc956f..481794f050 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/JoinTableComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/JoinTableComposite.java
@@ -15,7 +15,7 @@ import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.common.utility.internal.iterables.SuperListIterableWrapper;
import org.eclipse.jpt.common.utility.internal.model.value.ListAspectAdapter;
import org.eclipse.jpt.common.utility.internal.model.value.ListPropertyValueModelAdapter;
-import org.eclipse.jpt.common.utility.internal.model.value.ReadOnlyWritablePropertyValueModelWrapper;
+import org.eclipse.jpt.common.utility.internal.model.value.ReadOnlyModifiablePropertyValueModelWrapper;
import org.eclipse.jpt.common.utility.internal.model.value.TransformationPropertyValueModel;
import org.eclipse.jpt.common.utility.internal.model.value.ValueListAdapter;
import org.eclipse.jpt.common.utility.model.event.StateChangeEvent;
@@ -342,7 +342,7 @@ public class JoinTableComposite
public InverseJoinColumnPaneEnablerHolder() {
super(
new ValueListAdapter<ReadOnlyJoinTable>(
- new ReadOnlyWritablePropertyValueModelWrapper<ReadOnlyJoinTable>(getSubjectHolder()),
+ new ReadOnlyModifiablePropertyValueModelWrapper<ReadOnlyJoinTable>(getSubjectHolder()),
ReadOnlyJoinTable.SPECIFIED_INVERSE_JOIN_COLUMNS_LIST));
this.stateListener = new StateListener();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/JoiningStrategyJoinColumnsComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/JoiningStrategyJoinColumnsComposite.java
index 779f1c3207..5e39f2c993 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/JoiningStrategyJoinColumnsComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/JoiningStrategyJoinColumnsComposite.java
@@ -12,7 +12,7 @@ package org.eclipse.jpt.jpa.ui.internal.details;
import org.eclipse.jpt.common.ui.internal.widgets.Pane;
import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.common.utility.internal.iterables.SuperListIterableWrapper;
-import org.eclipse.jpt.common.utility.internal.model.value.ReadOnlyWritablePropertyValueModelWrapper;
+import org.eclipse.jpt.common.utility.internal.model.value.ReadOnlyModifiablePropertyValueModelWrapper;
import org.eclipse.jpt.common.utility.internal.model.value.TransformationPropertyValueModel;
import org.eclipse.jpt.common.utility.internal.model.value.ValueListAdapter;
import org.eclipse.jpt.common.utility.model.event.StateChangeEvent;
@@ -154,7 +154,7 @@ public class JoiningStrategyJoinColumnsComposite
JoinColumnPaneEnablerHolder() {
super(
new ValueListAdapter<ReadOnlyJoinColumnRelationshipStrategy>(
- new ReadOnlyWritablePropertyValueModelWrapper<ReadOnlyJoinColumnRelationshipStrategy>(getSubjectHolder()),
+ new ReadOnlyModifiablePropertyValueModelWrapper<ReadOnlyJoinColumnRelationshipStrategy>(getSubjectHolder()),
ReadOnlyJoinColumnRelationshipStrategy.SPECIFIED_JOIN_COLUMNS_LIST
)
);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/MapAsComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/MapAsComposite.java
index 37d46ff81f..4c8de82327 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/MapAsComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/MapAsComposite.java
@@ -29,9 +29,9 @@ import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener;
import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
import org.eclipse.jpt.jpa.core.JpaNode;
import org.eclipse.jpt.jpa.ui.JpaPlatformUi;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
import org.eclipse.jpt.jpa.ui.details.DefaultMappingUiDefinition;
import org.eclipse.jpt.jpa.ui.details.MappingUiDefinition;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyleRange;
@@ -110,7 +110,7 @@ public abstract class MapAsComposite<T extends JpaNode> extends Pane<T> {
* @return The UI platform of the JPT plug-in
*/
protected JpaPlatformUi getJpaPlatformUi() {
- return (JpaPlatformUi) getSubject().getJpaProject().getJpaPlatform().getAdapter(JpaPlatformUi.class);
+ return (JpaPlatformUi) getSubject().getJpaProject().getJpaPlatform().getAdapter(JpaPlatformUi.class);
}
/**
@@ -123,12 +123,7 @@ public abstract class MapAsComposite<T extends JpaNode> extends Pane<T> {
protected abstract DefaultMappingUiDefinition getDefaultDefinition(String mappingKey);
protected MappingUiDefinition getMappingUiDefinition(String mappingKey) {
- for (MappingUiDefinition<T, ?> provider : CollectionTools.iterable(this.mappingChangeHandler.mappingUiDefinitions())) {
- if (provider.getKey() == mappingKey) {
- return provider;
- }
- }
- return null;
+ return this.mappingChangeHandler.getMappingUiDefinition(mappingKey);
}
/**
@@ -298,16 +293,7 @@ public abstract class MapAsComposite<T extends JpaNode> extends Pane<T> {
* mapping being edited
*/
protected MappingUiDefinition initialSelection() {
-
- for (Iterator<? extends MappingUiDefinition> iter = this.mappingChangeHandler.mappingUiDefinitions(); iter.hasNext(); ) {
- MappingUiDefinition definition = iter.next();
-
- if (getMappingKey() == definition.getKey()) {
- return definition;
- }
- }
-
- return null;
+ return this.mappingChangeHandler.getMappingUiDefinition(getMappingKey());
}
/**
@@ -474,14 +460,23 @@ public abstract class MapAsComposite<T extends JpaNode> extends Pane<T> {
*
* @return The supported types of mapping
*/
- Iterator<MappingUiDefinition<T, ?>> mappingUiDefinitions();
+ Iterable<MappingUiDefinition<T, ?>> getMappingUiDefinitions();
+
+ /**
+ * Returns the mapping UI definition for the specified mapping key
+ * that is registered with the JPT plugin.
+ *
+ * @return The supported types of mapping
+ */
+ MappingUiDefinition<T, ?> getMappingUiDefinition(String mappingKey);
}
/**
* This dialog shows the list of possible mapping types and lets the user
* the option to filter them using a search field.
*/
- protected class MappingSelectionDialog extends FilteredItemsSelectionDialog
+ protected class MappingSelectionDialog
+ extends FilteredItemsSelectionDialog
{
private MappingUiDefinition<?,?> defaultDefinition;
@@ -497,29 +492,20 @@ public abstract class MapAsComposite<T extends JpaNode> extends Pane<T> {
}
private ILabelProvider buildLabelProvider() {
- return new LabelProvider() {
-
- @Override
- public Image getImage(Object element) {
-
- if (element == null) {
- return null;
- }
-
- MappingUiDefinition<?,?> definition = (MappingUiDefinition<?,?>) element;
- return definition.getImage();
- }
+ return new MappingUiDefinitionLabelProvider();
+ }
- @Override
- public String getText(Object element) {
- if (element == null) {
- return "";
- }
-
- MappingUiDefinition<?,?> definition = (MappingUiDefinition<?,?>) element;
- return definition.getLabel();
- }
- };
+ class MappingUiDefinitionLabelProvider
+ extends LabelProvider
+ {
+ @Override
+ public Image getImage(Object element) {
+ return (element == null) ? null : ((MappingUiDefinition<?,?>) element).getImage();
+ }
+ @Override
+ public String getText(Object element) {
+ return (element == null) ? "" : ((MappingUiDefinition<?,?>) element).getLabel();
+ }
}
@Override
@@ -549,8 +535,7 @@ public abstract class MapAsComposite<T extends JpaNode> extends Pane<T> {
}
// Add the registered mapping providers to the dialog
- for (Iterator<MappingUiDefinition<T, ?>> iter = mappingChangeHandler.mappingUiDefinitions(); iter.hasNext(); ) {
- MappingUiDefinition mappingDefinition = iter.next();
+ for (MappingUiDefinition mappingDefinition : mappingChangeHandler.getMappingUiDefinitions()) {
if (mappingDefinition.isEnabledFor(getSubject())) {
provider.add(mappingDefinition, itemsFilter);
}
@@ -604,7 +589,7 @@ public abstract class MapAsComposite<T extends JpaNode> extends Pane<T> {
protected IStatus validateItem(Object item) {
if (item == null) {
- return new Status(IStatus.ERROR, JptJpaUiPlugin.PLUGIN_ID, IStatus.ERROR, "", null);
+ return JptJpaUiPlugin.instance().buildErrorStatus();
}
return Status.OK_STATUS;
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/PersistentAttributeDetailsPage.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/PersistentAttributeDetailsPage.java
index 5fe95fa133..ede33b74b7 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/PersistentAttributeDetailsPage.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/PersistentAttributeDetailsPage.java
@@ -12,18 +12,18 @@ package org.eclipse.jpt.jpa.ui.internal.details;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.jpt.common.ui.WidgetFactory;
-import org.eclipse.jpt.common.ui.internal.Tracing;
import org.eclipse.jpt.common.ui.internal.util.ControlSwitcher;
import org.eclipse.jpt.common.utility.Filter;
import org.eclipse.jpt.common.utility.internal.Transformer;
import org.eclipse.jpt.common.utility.internal.model.value.FilteringPropertyValueModel;
import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapter;
-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.jpt.jpa.core.context.AttributeMapping;
import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
import org.eclipse.jpt.jpa.ui.details.JpaComposite;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
@@ -148,7 +148,7 @@ public abstract class PersistentAttributeDetailsPage<A extends ReadOnlyPersisten
@Override
public void dispose() {
- log(Tracing.UI_DETAILS_VIEW, "PersistentAttributeDetailsPage.dispose()"); //$NON-NLS-1$
+ JptJpaUiPlugin.instance().trace(TRACE_OPTION, "dispose"); //$NON-NLS-1$
for (JpaComposite mappingComposite : this.mappingComposites.values()) {
mappingComposite.dispose();
@@ -157,16 +157,7 @@ public abstract class PersistentAttributeDetailsPage<A extends ReadOnlyPersisten
super.dispose();
}
- @Override
- protected void log(String flag, String message) {
- super.log(flag, message);
-
- if (Tracing.UI_DETAILS_VIEW.equals(flag) &&
- Tracing.booleanDebugOption(Tracing.UI_DETAILS_VIEW))
- {
- Tracing.log(message);
- }
- }
+ private static final String TRACE_OPTION = PersistentAttributeDetailsPage.class.getSimpleName();
private class MappingFilter implements Filter<AttributeMapping> {
private String mappingKey;
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/PersistentAttributeMapAsComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/PersistentAttributeMapAsComposite.java
index ba0868c5f5..b71e18516e 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/PersistentAttributeMapAsComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/PersistentAttributeMapAsComposite.java
@@ -19,7 +19,9 @@ import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
import org.eclipse.jpt.jpa.ui.details.DefaultMappingUiDefinition;
import org.eclipse.jpt.jpa.ui.details.MappingUiDefinition;
-import org.eclipse.jpt.jpa.ui.internal.details.orm.UnsupportedOrmMappingUiDefinition;
+import org.eclipse.jpt.jpa.ui.internal.details.MapAsComposite.MappingChangeHandler;
+import org.eclipse.jpt.jpa.ui.internal.details.PersistentTypeMapAsComposite.TypeMappingChangeHandler;
+import org.eclipse.jpt.jpa.ui.internal.details.orm.UnsupportedOrmAttributeMappingUiDefinition;
import org.eclipse.swt.widgets.Composite;
/**
@@ -61,50 +63,61 @@ public class PersistentAttributeMapAsComposite
@Override
protected MappingChangeHandler buildMappingChangeHandler() {
- return new MappingChangeHandler() {
-
- public String getLabelText() {
- String mappingKey = getMappingKey();
+ return new AttributeMappingChangeHandler();
+ }
- if (mappingKey != MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY) {
- return JptUiDetailsMessages.MapAsComposite_mappedAttributeText;
- }
- if (getSubject().isVirtual()) {
- return JptUiDetailsMessages.MapAsComposite_virtualAttributeText;
- }
+ protected class AttributeMappingChangeHandler
+ implements MappingChangeHandler
+ {
+ public String getLabelText() {
+ String mappingKey = getMappingKey();
- return JptUiDetailsMessages.MapAsComposite_unmappedAttributeText;
+ if (mappingKey != MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY) {
+ return JptUiDetailsMessages.MapAsComposite_mappedAttributeText;
+ }
+ if (getSubject().isVirtual()) {
+ return JptUiDetailsMessages.MapAsComposite_virtualAttributeText;
}
- public String getMappingText() {
- AttributeMapping mapping = getSubject().getMapping();
- String mappingKey = mapping.getKey();
+ return JptUiDetailsMessages.MapAsComposite_unmappedAttributeText;
+ }
- if (mappingKey == null) {
- return JptUiDetailsMessages.MapAsComposite_changeMappingType;
- }
+ public String getMappingText() {
+ AttributeMapping mapping = getSubject().getMapping();
+ String mappingKey = mapping.getKey();
- return mapping.isDefault() ?
- getDefaultDefinition(mappingKey).getLinkLabel() :
- getMappingUiDefinition(mappingKey).getLinkLabel();
- }
-
- public void morphMapping(MappingUiDefinition definition) {
- ((PersistentAttribute) getSubject()).setMappingKey(definition.getKey());
+ if (mappingKey == null) {
+ return JptUiDetailsMessages.MapAsComposite_changeMappingType;
}
-
- public String getName() {
- return getSubject().getName();
- }
-
- public Iterator<? extends MappingUiDefinition<? extends ReadOnlyPersistentAttribute, ?>> mappingUiDefinitions() {
- return attributeMappingUiDefinitions();
- }
- };
+
+ return mapping.isDefault() ?
+ getDefaultDefinition(mappingKey).getLinkLabel() :
+ getMappingUiDefinition(mappingKey).getLinkLabel();
+ }
+
+ public void morphMapping(MappingUiDefinition definition) {
+ ((PersistentAttribute) getSubject()).setMappingKey(definition.getKey());
+ }
+
+ public String getName() {
+ return getSubject().getName();
+ }
+
+ public Iterable<? extends MappingUiDefinition<? extends ReadOnlyPersistentAttribute, ?>> getMappingUiDefinitions() {
+ return getAttributeMappingUiDefinitions();
+ }
+
+ public MappingUiDefinition getMappingUiDefinition(String mappingKey) {
+ return getAttributeMappingUiDefinition(mappingKey);
+ }
+ }
+
+ protected Iterable<? extends MappingUiDefinition<? extends ReadOnlyPersistentAttribute, ?>> getAttributeMappingUiDefinitions() {
+ return getJpaPlatformUi().getAttributeMappingUiDefinitions(getSubject().getResourceType());
}
- protected Iterator<? extends MappingUiDefinition<? extends ReadOnlyPersistentAttribute, ?>> attributeMappingUiDefinitions() {
- return getJpaPlatformUi().attributeMappingUiDefinitions(getSubject().getResourceType());
+ protected MappingUiDefinition<? extends ReadOnlyPersistentAttribute, ?> getAttributeMappingUiDefinition(String mappingKey) {
+ return getJpaPlatformUi().getAttributeMappingUiDefinition(getSubject().getResourceType(), mappingKey);
}
@Override
@@ -120,7 +133,7 @@ public class PersistentAttributeMapAsComposite
@Override
protected MappingUiDefinition getMappingUiDefinition(String mappingKey) {
MappingUiDefinition definition = super.getMappingUiDefinition(mappingKey);
- return (definition != null) ? definition : UnsupportedOrmMappingUiDefinition.instance();
+ return (definition != null) ? definition : UnsupportedOrmAttributeMappingUiDefinition.instance();
}
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/PersistentTypeDetailsPage.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/PersistentTypeDetailsPage.java
index 11fc61aaaf..ddad4f332a 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/PersistentTypeDetailsPage.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/PersistentTypeDetailsPage.java
@@ -12,7 +12,6 @@ package org.eclipse.jpt.jpa.ui.internal.details;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.jpt.common.ui.WidgetFactory;
-import org.eclipse.jpt.common.ui.internal.Tracing;
import org.eclipse.jpt.common.ui.internal.util.ControlSwitcher;
import org.eclipse.jpt.common.utility.Filter;
import org.eclipse.jpt.common.utility.internal.Transformer;
@@ -22,6 +21,7 @@ import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
import org.eclipse.jpt.jpa.core.context.PersistentType;
import org.eclipse.jpt.jpa.core.context.TypeMapping;
import org.eclipse.jpt.jpa.ui.details.JpaComposite;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
@@ -125,7 +125,7 @@ public class PersistentTypeDetailsPage extends AbstractJpaDetailsPage<Persistent
}
- private JpaComposite getMappingComposite(String key) {
+ /* CU private */ JpaComposite getMappingComposite(String key) {
JpaComposite mappingComposite = this.mappingComposites.get(key);
if (mappingComposite != null) {
return mappingComposite;
@@ -152,7 +152,7 @@ public class PersistentTypeDetailsPage extends AbstractJpaDetailsPage<Persistent
@Override
public void dispose() {
- log(Tracing.UI_DETAILS_VIEW, "PersistentTypeDetailsPage.dispose()");
+ JptJpaUiPlugin.instance().trace(TRACE_OPTION, "dispose"); //$NON-NLS-1$
for (JpaComposite mappingComposite : this.mappingComposites.values()) {
mappingComposite.dispose();
@@ -161,4 +161,5 @@ public class PersistentTypeDetailsPage extends AbstractJpaDetailsPage<Persistent
super.dispose();
}
+ private static final String TRACE_OPTION = PersistentTypeDetailsPage.class.getSimpleName();
} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/PersistentTypeMapAsComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/PersistentTypeMapAsComposite.java
index c1a29c5066..f60709d864 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/PersistentTypeMapAsComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/PersistentTypeMapAsComposite.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2012 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -51,40 +51,41 @@ public class PersistentTypeMapAsComposite
@Override
protected MappingChangeHandler buildMappingChangeHandler() {
- return new MappingChangeHandler() {
-
- public String getLabelText() {
- String mappingKey = getMappingKey();
-
- if (mappingKey != null) {
- return JptUiDetailsMessages.MapAsComposite_mappedTypeText;
- }
-
- return JptUiDetailsMessages.MapAsComposite_unmappedTypeText;
- }
+ return new TypeMappingChangeHandler();
+ }
- public String getMappingText() {
- String mappingKey = getMappingKey();
+ protected class TypeMappingChangeHandler
+ implements MappingChangeHandler
+ {
+ public String getLabelText() {
+ String mappingKey = getMappingKey();
+ return (mappingKey != null) ?
+ JptUiDetailsMessages.MapAsComposite_mappedTypeText :
+ JptUiDetailsMessages.MapAsComposite_unmappedTypeText;
+ }
- if (mappingKey == null) {
- return JptUiDetailsMessages.MapAsComposite_changeMappingType;
- }
+ public String getMappingText() {
+ String mappingKey = getMappingKey();
+ return (mappingKey == null) ?
+ JptUiDetailsMessages.MapAsComposite_changeMappingType :
+ getMappingUiDefinition(mappingKey).getLinkLabel();
+ }
- return getMappingUiDefinition(mappingKey).getLinkLabel();
- }
+ public void morphMapping(MappingUiDefinition definition) {
+ getSubject().setMappingKey(definition.getKey());
+ }
- public void morphMapping(MappingUiDefinition definition) {
- getSubject().setMappingKey(definition.getKey());
- }
+ public String getName() {
+ return getSubject().getSimpleName();
+ }
- public String getName() {
- return getSubject().getSimpleName();
- }
+ public Iterable<? extends MappingUiDefinition<? extends PersistentType, ?>> getMappingUiDefinitions() {
+ return getTypeMappingUiDefinitions();
+ }
- public Iterator<? extends MappingUiDefinition<? extends PersistentType, ?>> mappingUiDefinitions() {
- return typeMappingUiDefinitions();
- }
- };
+ public MappingUiDefinition getMappingUiDefinition(String mappingKey) {
+ return getTypeMappingUiDefinition(mappingKey);
+ }
}
/**
@@ -92,8 +93,12 @@ public class PersistentTypeMapAsComposite
*
* @return The supported types of mapping
*/
- protected Iterator<? extends MappingUiDefinition<? extends PersistentType, ?>> typeMappingUiDefinitions() {
- return getJpaPlatformUi().typeMappingUiDefinitions(getSubject().getResourceType());
+ protected Iterable<? extends MappingUiDefinition<? extends PersistentType, ?>> getTypeMappingUiDefinitions() {
+ return getJpaPlatformUi().getTypeMappingUiDefinitions(getSubject().getResourceType());
+ }
+
+ protected MappingUiDefinition<? extends PersistentType, ?> getTypeMappingUiDefinition(String mappingKey) {
+ return getJpaPlatformUi().getTypeMappingUiDefinition(getSubject().getResourceType(), mappingKey);
}
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/db/DatabaseObjectCombo.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/db/DatabaseObjectCombo.java
index 582c9da344..dd5e73b32f 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/db/DatabaseObjectCombo.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/db/DatabaseObjectCombo.java
@@ -9,7 +9,6 @@
******************************************************************************/
package org.eclipse.jpt.jpa.ui.internal.details.db;
-import org.eclipse.jpt.common.ui.internal.Tracing;
import org.eclipse.jpt.common.ui.internal.listeners.SWTPropertyChangeListenerWrapper;
import org.eclipse.jpt.common.ui.internal.widgets.ComboPane;
import org.eclipse.jpt.common.ui.internal.widgets.Pane;
@@ -30,6 +29,7 @@ import org.eclipse.jpt.jpa.db.Schema;
import org.eclipse.jpt.jpa.db.Sequence;
import org.eclipse.jpt.jpa.db.Table;
import org.eclipse.jpt.jpa.ui.internal.listeners.SWTConnectionListenerWrapper;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
import org.eclipse.swt.widgets.Composite;
/**
@@ -267,15 +267,6 @@ public abstract class DatabaseObjectCombo<T extends JpaNode>
// do nothing by default
}
- @Override
- protected void log(String flag, String message) {
- if (flag.equals(Tracing.UI_DB) && Tracing.booleanDebugOption(Tracing.UI_DB)) {
- this.log(message);
- } else {
- super.log(flag, message);
- }
- }
-
// broaden accessibility a bit
@Override
protected void repopulateComboBox() {
@@ -293,66 +284,63 @@ public abstract class DatabaseObjectCombo<T extends JpaNode>
}
public void opened(ConnectionProfile profile) {
- this.log("opened: " + profile.getName());
+ JptJpaUiPlugin.instance().trace(TRACE_OPTION, "opened: {0}", profile);
DatabaseObjectCombo.this.repopulateComboBox();
}
public void modified(ConnectionProfile profile) {
- this.log("modified: " + profile.getName());
+ JptJpaUiPlugin.instance().trace(TRACE_OPTION, "modified: {0}", profile);
DatabaseObjectCombo.this.repopulateComboBox();
}
public boolean okToClose(ConnectionProfile profile) {
- this.log("OK to close: " + profile.getName());
+ JptJpaUiPlugin.instance().trace(TRACE_OPTION, "OK to close: {0}", profile);
return true;
}
public void aboutToClose(ConnectionProfile profile) {
- this.log("about to close: " + profile.getName());
+ JptJpaUiPlugin.instance().trace(TRACE_OPTION, "about to close: {0}", profile);
}
public void closed(ConnectionProfile profile) {
- this.log("closed: " + profile.getName());
+ JptJpaUiPlugin.instance().trace(TRACE_OPTION, "closed: {0}", profile);
DatabaseObjectCombo.this.repopulateComboBox();
}
public void databaseChanged(ConnectionProfile profile, Database database) {
- this.log("database changed: " + database.getName());
+ JptJpaUiPlugin.instance().trace(TRACE_OPTION, "database changed: {0}", database);
DatabaseObjectCombo.this.databaseChanged(database);
}
public void catalogChanged(ConnectionProfile profile, Catalog catalog) {
- this.log("catalog changed: " + catalog.getName());
+ JptJpaUiPlugin.instance().trace(TRACE_OPTION, "catalog changed: {0}", catalog);
DatabaseObjectCombo.this.catalogChanged(catalog);
}
public void schemaChanged(ConnectionProfile profile, Schema schema) {
- this.log("schema changed: " + schema.getName());
+ JptJpaUiPlugin.instance().trace(TRACE_OPTION, "schema changed: {0}", schema);
DatabaseObjectCombo.this.schemaChanged(schema);
}
public void sequenceChanged(ConnectionProfile profile, Sequence sequence) {
- this.log("sequence changed: " + sequence.getName());
+ JptJpaUiPlugin.instance().trace(TRACE_OPTION, "sequence changed: {0}", sequence);
DatabaseObjectCombo.this.sequenceChanged(sequence);
}
public void tableChanged(ConnectionProfile profile, Table table) {
- this.log("table changed: " + table.getName());
+ JptJpaUiPlugin.instance().trace(TRACE_OPTION, "table changed: {0}", table);
DatabaseObjectCombo.this.tableChanged(table);
}
public void columnChanged(ConnectionProfile profile, Column column) {
- this.log("column changed: " + column.getName());
+ JptJpaUiPlugin.instance().trace(TRACE_OPTION, "column changed: {0}", column);
DatabaseObjectCombo.this.columnChanged(column);
}
public void foreignKeyChanged(ConnectionProfile profile, ForeignKey foreignKey) {
- this.log("foreign key changed: " + foreignKey.getName());
+ JptJpaUiPlugin.instance().trace(TRACE_OPTION, "foreign key changed: {0}", foreignKey);
DatabaseObjectCombo.this.foreignKeyChanged(foreignKey);
}
-
- protected void log(String message) {
- DatabaseObjectCombo.this.log(Tracing.UI_DB, message);
- }
}
+ /* CU private */ static final String TRACE_OPTION = DatabaseObjectCombo.class.getSimpleName();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/AbstractJavaResourceUiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/AbstractJavaResourceUiDefinition.java
index 8b05eeea5f..66110dbeee 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/AbstractJavaResourceUiDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/AbstractJavaResourceUiDefinition.java
@@ -10,22 +10,19 @@
package org.eclipse.jpt.jpa.ui.internal.details.java;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
-import java.util.ListIterator;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
import org.eclipse.jpt.common.core.JptResourceType;
import org.eclipse.jpt.common.ui.WidgetFactory;
import org.eclipse.jpt.common.ui.internal.jface.SimpleItemTreeStateProviderFactoryProvider;
import org.eclipse.jpt.common.ui.jface.ItemTreeStateProviderFactoryProvider;
import org.eclipse.jpt.common.utility.internal.Tools;
-import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.common.utility.internal.iterators.ArrayListIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.SuperIterableWrapper;
import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
import org.eclipse.jpt.jpa.core.context.AttributeMapping;
import org.eclipse.jpt.jpa.core.context.PersistentType;
import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.internal.context.java.JavaSourceFileDefinition;
import org.eclipse.jpt.jpa.ui.MappingResourceUiDefinition;
import org.eclipse.jpt.jpa.ui.details.JpaComposite;
import org.eclipse.jpt.jpa.ui.details.MappingUiDefinition;
@@ -39,214 +36,178 @@ import org.eclipse.jpt.jpa.ui.internal.structure.JavaStructureItemLabelProviderF
import org.eclipse.swt.widgets.Composite;
/**
- * All the state in the definition should be "static" (i.e. unchanging once it is initialized).
+ * All the state in the definition should be "static"
+ * (i.e. unchanging once it is initialized).
*/
public abstract class AbstractJavaResourceUiDefinition
implements MappingResourceUiDefinition
{
- private JavaTypeMappingUiDefinition<? extends TypeMapping>[] specifiedTypeMappingUiDefinitions;
-
- private JavaAttributeMappingUiDefinition<? extends AttributeMapping>[] specifiedAttributeMappingUiDefinitions;
-
- private DefaultJavaAttributeMappingUiDefinition<?>[] defaultAttributeMappingUiDefinitions;
-
private final JavaUiFactory factory;
-
-
+
+ private ArrayList<JavaTypeMappingUiDefinition<? extends TypeMapping>> specifiedTypeMappingUiDefinitions;
+
+ private ArrayList<JavaAttributeMappingUiDefinition<? extends AttributeMapping>> specifiedAttributeMappingUiDefinitions;
+
+ private ArrayList<DefaultJavaAttributeMappingUiDefinition<?>> defaultAttributeMappingUiDefinitions;
+
+
/**
* zero-argument constructor
*/
protected AbstractJavaResourceUiDefinition() {
super();
- this.factory = buildJavaUiFactory();
+ this.factory = this.buildJavaUiFactory();
}
-
-
+
+
protected abstract JavaUiFactory buildJavaUiFactory();
-
- public JavaUiFactory getFactory() {
- return this.factory;
- }
-
+
public boolean providesUi(JptResourceType resourceType) {
- return resourceType.equals(JptCommonCorePlugin.JAVA_SOURCE_RESOURCE_TYPE);
+ return resourceType.equals(JavaSourceFileDefinition.instance().getResourceType());
}
public ItemTreeStateProviderFactoryProvider getStructureViewFactoryProvider() {
return STRUCTURE_VIEW_FACTORY_PROVIDER;
}
-
- public static final ItemTreeStateProviderFactoryProvider STRUCTURE_VIEW_FACTORY_PROVIDER =
+
+ private static final ItemTreeStateProviderFactoryProvider STRUCTURE_VIEW_FACTORY_PROVIDER =
new SimpleItemTreeStateProviderFactoryProvider(
JavaStructureItemContentProviderFactory.instance(),
JavaStructureItemLabelProviderFactory.instance()
);
-
-
-
- // ********** type mapping ui definitions **********
-
- public JpaComposite buildTypeMappingComposite(
- String key,
- PropertyValueModel<TypeMapping> mappingHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- JavaTypeMappingUiDefinition<TypeMapping> mappingUiDefinition = getJavaTypeMappingUiDefinition(mappingHolder.getValue());
- return mappingUiDefinition.buildTypeMappingComposite(
- getFactory(),
- mappingHolder,
- parent,
- widgetFactory);
- }
-
+
+
+ // ********** type mappings **********
+
+ public JpaComposite buildTypeMappingComposite(String mappingKey, PropertyValueModel<TypeMapping> mappingModel, Composite parent, WidgetFactory widgetFactory) {
+ JavaTypeMappingUiDefinition<TypeMapping> definition = this.getJavaTypeMappingUiDefinition(mappingModel.getValue());
+ return definition.buildTypeMappingComposite(this.factory, mappingModel, parent, widgetFactory);
+ }
+
@SuppressWarnings("unchecked")
protected JavaTypeMappingUiDefinition<TypeMapping> getJavaTypeMappingUiDefinition(TypeMapping typeMapping) {
- if (typeMapping == null || typeMapping.getKey() == null) {
- return (JavaTypeMappingUiDefinition<TypeMapping>) getDefaultTypeMappingUiDefinition();
- }
- return (JavaTypeMappingUiDefinition<TypeMapping>) getSpecifiedJavaTypeMappingUiDefinition(typeMapping.getKey());
+ return (JavaTypeMappingUiDefinition<TypeMapping>) this.getJavaTypeMappingUiDefinition_(typeMapping);
+ }
+
+ protected JavaTypeMappingUiDefinition<? extends TypeMapping> getJavaTypeMappingUiDefinition_(TypeMapping typeMapping) {
+ String mappingKey = (typeMapping == null) ? null : typeMapping.getKey();
+ return (mappingKey == null) ?
+ this.getDefaultTypeMappingUiDefinition() :
+ this.getSpecifiedJavaTypeMappingUiDefinition(mappingKey);
}
-
+
+ public MappingUiDefinition<PersistentType, ? extends TypeMapping> getTypeMappingUiDefinition(String mappingKey) {
+ return this.getSpecifiedJavaTypeMappingUiDefinition(mappingKey);
+ }
+
protected JavaTypeMappingUiDefinition<? extends TypeMapping> getSpecifiedJavaTypeMappingUiDefinition(String mappingKey) {
- for (JavaTypeMappingUiDefinition<? extends TypeMapping> definition : getSpecifiedTypeMappingUiDefinitions()) {
+ for (JavaTypeMappingUiDefinition<? extends TypeMapping> definition : this.getSpecifiedTypeMappingUiDefinitions()) {
if (Tools.valuesAreEqual(definition.getKey(), mappingKey)) {
return definition;
}
}
throw new IllegalArgumentException("Illegal type mapping key: " + mappingKey); //$NON-NLS-1$
}
-
- public Iterator<MappingUiDefinition<PersistentType, ? extends TypeMapping>> typeMappingUiDefinitions() {
- return new ArrayIterator<MappingUiDefinition<PersistentType, ? extends TypeMapping>>(
- getSpecifiedTypeMappingUiDefinitions());
+
+ public Iterable<MappingUiDefinition<PersistentType, ? extends TypeMapping>> getTypeMappingUiDefinitions() {
+ return new SuperIterableWrapper<MappingUiDefinition<PersistentType, ? extends TypeMapping>>(this.getSpecifiedTypeMappingUiDefinitions());
}
-
- protected synchronized JavaTypeMappingUiDefinition<? extends TypeMapping>[] getSpecifiedTypeMappingUiDefinitions() {
+
+ protected synchronized Iterable<JavaTypeMappingUiDefinition<? extends TypeMapping>> getSpecifiedTypeMappingUiDefinitions() {
if (this.specifiedTypeMappingUiDefinitions == null) {
- this.specifiedTypeMappingUiDefinitions = buildSpecifiedTypeMappingUiDefinitions();
+ this.specifiedTypeMappingUiDefinitions = this.buildSpecifiedTypeMappingUiDefinitions();
}
return this.specifiedTypeMappingUiDefinitions;
}
-
- /**
- * Return an array of mapping definitions to use for types in mapping files of this type.
- * The order is unimportant.
- */
- protected JavaTypeMappingUiDefinition<? extends TypeMapping>[] buildSpecifiedTypeMappingUiDefinitions() {
- ArrayList<JavaTypeMappingUiDefinition<? extends TypeMapping>> definitions =
- new ArrayList<JavaTypeMappingUiDefinition<? extends TypeMapping>>();
- addSpecifiedTypeMappingUiDefinitionsTo(definitions);
- @SuppressWarnings("unchecked")
- JavaTypeMappingUiDefinition<? extends TypeMapping>[] definitionArray =
- definitions.toArray(new JavaTypeMappingUiDefinition[definitions.size()]);
- return definitionArray;
- }
-
- protected abstract void addSpecifiedTypeMappingUiDefinitionsTo(
- List<JavaTypeMappingUiDefinition<? extends TypeMapping>> definitions);
-
+
+ protected ArrayList<JavaTypeMappingUiDefinition<? extends TypeMapping>> buildSpecifiedTypeMappingUiDefinitions() {
+ ArrayList<JavaTypeMappingUiDefinition<? extends TypeMapping>> definitions = new ArrayList<JavaTypeMappingUiDefinition<? extends TypeMapping>>();
+ this.addSpecifiedTypeMappingUiDefinitionsTo(definitions);
+ return definitions;
+ }
+
+ protected abstract void addSpecifiedTypeMappingUiDefinitionsTo(List<JavaTypeMappingUiDefinition<? extends TypeMapping>> definitions);
+
public DefaultJavaTypeMappingUiDefinition<? extends TypeMapping> getDefaultTypeMappingUiDefinition() {
return NullJavaTypeMappingUiDefinition.instance();
}
-
-
- // ********** attributes mapping UI definitions **********
-
- public JpaComposite buildAttributeMappingComposite(
- String key,
- PropertyValueModel<AttributeMapping> mappingHolder,
- PropertyValueModel<Boolean> enabledModel,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- JavaAttributeMappingUiDefinition<AttributeMapping> mappingUiDefinition =
- getAttributeMappingUiDefinition(mappingHolder.getValue());
- return mappingUiDefinition.buildAttributeMappingComposite(
- getFactory(),
- mappingHolder,
- enabledModel,
- parent,
- widgetFactory);
- }
-
+
+
+ // ********** attribute mappings **********
+
+ public JpaComposite buildAttributeMappingComposite(String mappingKey, PropertyValueModel<AttributeMapping> mappingModel,PropertyValueModel<Boolean> enabledModel, Composite parent, WidgetFactory widgetFactory) {
+ JavaAttributeMappingUiDefinition<AttributeMapping> definition = this.getAttributeMappingUiDefinition(mappingModel.getValue());
+ return definition.buildAttributeMappingComposite(this.factory, mappingModel, enabledModel, parent, widgetFactory);
+ }
+
@SuppressWarnings("unchecked")
protected JavaAttributeMappingUiDefinition<AttributeMapping> getAttributeMappingUiDefinition(AttributeMapping attributeMapping) {
- String key = attributeMapping == null ? null : attributeMapping.getKey();
- if (attributeMapping == null || attributeMapping.isDefault()) {
- return (JavaAttributeMappingUiDefinition<AttributeMapping>) getDefaultAttributeMappingUiDefinition(key);
- }
- return (JavaAttributeMappingUiDefinition<AttributeMapping>) getSpecifiedAttributeMappingUiDefinition(key);
+ return (JavaAttributeMappingUiDefinition<AttributeMapping>) this.getAttributeMappingUiDefinition_(attributeMapping);
}
-
+
+ protected JavaAttributeMappingUiDefinition<? extends AttributeMapping> getAttributeMappingUiDefinition_(AttributeMapping attributeMapping) {
+ String mappingKey = (attributeMapping == null) ? null : attributeMapping.getKey();
+ return ((attributeMapping == null) || attributeMapping.isDefault()) ?
+ this.getDefaultAttributeMappingUiDefinition(mappingKey) :
+ this.getSpecifiedAttributeMappingUiDefinition(mappingKey);
+ }
+
+ public MappingUiDefinition<ReadOnlyPersistentAttribute, ? extends AttributeMapping> getAttributeMappingUiDefinition(String mappingKey) {
+ return this.getSpecifiedAttributeMappingUiDefinition(mappingKey);
+ }
+
protected JavaAttributeMappingUiDefinition<? extends AttributeMapping> getSpecifiedAttributeMappingUiDefinition(String mappingKey) {
- for (JavaAttributeMappingUiDefinition<? extends AttributeMapping> definition : getSpecifiedAttributeMappingUiDefinitions()) {
+ for (JavaAttributeMappingUiDefinition<? extends AttributeMapping> definition : this.getSpecifiedAttributeMappingUiDefinitions()) {
if (Tools.valuesAreEqual(definition.getKey(), mappingKey)) {
return definition;
}
}
throw new IllegalArgumentException("Illegal attribute mapping key: " + mappingKey); //$NON-NLS-1$
}
-
- public ListIterator<MappingUiDefinition<ReadOnlyPersistentAttribute, ? extends AttributeMapping>>
- attributeMappingUiDefinitions() {
-
- return new ArrayListIterator<MappingUiDefinition<ReadOnlyPersistentAttribute, ? extends AttributeMapping>>(
- getSpecifiedAttributeMappingUiDefinitions());
+
+ public Iterable<MappingUiDefinition<ReadOnlyPersistentAttribute, ? extends AttributeMapping>> getAttributeMappingUiDefinitions() {
+ return new SuperIterableWrapper<MappingUiDefinition<ReadOnlyPersistentAttribute, ? extends AttributeMapping>>(this.getSpecifiedAttributeMappingUiDefinitions());
}
-
- protected synchronized JavaAttributeMappingUiDefinition<? extends AttributeMapping>[] getSpecifiedAttributeMappingUiDefinitions() {
+
+ protected synchronized ArrayList<JavaAttributeMappingUiDefinition<? extends AttributeMapping>> getSpecifiedAttributeMappingUiDefinitions() {
if (this.specifiedAttributeMappingUiDefinitions == null) {
- this.specifiedAttributeMappingUiDefinitions = buildSpecifiedAttributeMappingUiDefinitions();
+ this.specifiedAttributeMappingUiDefinitions = this.buildSpecifiedAttributeMappingUiDefinitions();
}
return this.specifiedAttributeMappingUiDefinitions;
}
-
- /**
- * Return an array of mapping definitions to use for attributes in mapping files of this type.
- * The order is unimportant.
- */
- protected JavaAttributeMappingUiDefinition<? extends AttributeMapping>[] buildSpecifiedAttributeMappingUiDefinitions() {
- ArrayList<JavaAttributeMappingUiDefinition<? extends AttributeMapping>> definitions =
- new ArrayList<JavaAttributeMappingUiDefinition<? extends AttributeMapping>>();
- addSpecifiedAttributeMappingUiDefinitionsTo(definitions);
- @SuppressWarnings("unchecked")
- JavaAttributeMappingUiDefinition<? extends AttributeMapping>[] definitionArray =
- definitions.toArray(new JavaAttributeMappingUiDefinition[definitions.size()]);
- return definitionArray;
- }
-
- protected abstract void addSpecifiedAttributeMappingUiDefinitionsTo(
- List<JavaAttributeMappingUiDefinition<? extends AttributeMapping>> definitions);
-
-
- // ********** default Java attribute mapping UI providers **********
-
- public DefaultJavaAttributeMappingUiDefinition<? extends AttributeMapping> getDefaultAttributeMappingUiDefinition(String key) {
- for (DefaultJavaAttributeMappingUiDefinition<? extends AttributeMapping> definition : getDefaultAttributeMappingUiDefinitions()) {
- if (Tools.valuesAreEqual(definition.getDefaultKey(), key)) {
+
+ protected ArrayList<JavaAttributeMappingUiDefinition<? extends AttributeMapping>> buildSpecifiedAttributeMappingUiDefinitions() {
+ ArrayList<JavaAttributeMappingUiDefinition<? extends AttributeMapping>> definitions = new ArrayList<JavaAttributeMappingUiDefinition<? extends AttributeMapping>>();
+ this.addSpecifiedAttributeMappingUiDefinitionsTo(definitions);
+ return definitions;
+ }
+
+ protected abstract void addSpecifiedAttributeMappingUiDefinitionsTo(List<JavaAttributeMappingUiDefinition<? extends AttributeMapping>> definitions);
+
+
+ // ********** default attribute mappings **********
+
+ public DefaultJavaAttributeMappingUiDefinition<? extends AttributeMapping> getDefaultAttributeMappingUiDefinition(String mappingKey) {
+ for (DefaultJavaAttributeMappingUiDefinition<? extends AttributeMapping> definition : this.getDefaultAttributeMappingUiDefinitions()) {
+ if (Tools.valuesAreEqual(definition.getDefaultKey(), mappingKey)) {
return definition;
}
}
- throw new IllegalArgumentException("Illegal attribute mapping key: " + key); //$NON-NLS-1$
+ throw new IllegalArgumentException("Illegal attribute mapping key: " + mappingKey); //$NON-NLS-1$
}
-
- protected synchronized DefaultJavaAttributeMappingUiDefinition<? extends AttributeMapping>[] getDefaultAttributeMappingUiDefinitions() {
+
+ protected synchronized ArrayList<DefaultJavaAttributeMappingUiDefinition<? extends AttributeMapping>> getDefaultAttributeMappingUiDefinitions() {
if (this.defaultAttributeMappingUiDefinitions == null) {
this.defaultAttributeMappingUiDefinitions = this.buildDefaultAttributeMappingUiDefinitions();
}
return this.defaultAttributeMappingUiDefinitions;
}
-
- protected DefaultJavaAttributeMappingUiDefinition<?>[] buildDefaultAttributeMappingUiDefinitions() {
- ArrayList<DefaultJavaAttributeMappingUiDefinition<?>> definitions =
- new ArrayList<DefaultJavaAttributeMappingUiDefinition<?>>();
- addDefaultAttributeMappingUiDefinitionsTo(definitions);
- DefaultJavaAttributeMappingUiDefinition<?>[] definitionArray =
- definitions.toArray(new DefaultJavaAttributeMappingUiDefinition[definitions.size()]);
- return definitionArray;
- }
-
- protected abstract void addDefaultAttributeMappingUiDefinitionsTo(
- List<DefaultJavaAttributeMappingUiDefinition<?>> definitions);
+
+ protected ArrayList<DefaultJavaAttributeMappingUiDefinition<?>> buildDefaultAttributeMappingUiDefinitions() {
+ ArrayList<DefaultJavaAttributeMappingUiDefinition<?>> definitions = new ArrayList<DefaultJavaAttributeMappingUiDefinition<?>>();
+ this.addDefaultAttributeMappingUiDefinitionsTo(definitions);
+ return definitions;
+ }
+
+ protected abstract void addDefaultAttributeMappingUiDefinitionsTo(List<DefaultJavaAttributeMappingUiDefinition<?>> definitions);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/DefaultBasicMappingUiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/DefaultBasicMappingUiDefinition.java
index 04fe0bff40..7e911adfc0 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/DefaultBasicMappingUiDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/DefaultBasicMappingUiDefinition.java
@@ -17,10 +17,8 @@ import org.eclipse.jpt.jpa.core.context.java.JavaBasicMapping;
import org.eclipse.jpt.jpa.ui.details.JpaComposite;
import org.eclipse.jpt.jpa.ui.details.java.DefaultJavaAttributeMappingUiDefinition;
import org.eclipse.jpt.jpa.ui.details.java.JavaUiFactory;
-import org.eclipse.jpt.jpa.ui.internal.JpaMappingImageHelper;
import org.eclipse.jpt.jpa.ui.internal.details.AbstractBasicMappingUiDefinition;
import org.eclipse.jpt.jpa.ui.internal.details.JptUiDetailsMessages;
-import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
public class DefaultBasicMappingUiDefinition
@@ -28,35 +26,34 @@ public class DefaultBasicMappingUiDefinition
implements DefaultJavaAttributeMappingUiDefinition<JavaBasicMapping>
{
// singleton
- private static final DefaultBasicMappingUiDefinition INSTANCE =
- new DefaultBasicMappingUiDefinition();
-
-
+ private static final DefaultBasicMappingUiDefinition INSTANCE = new DefaultBasicMappingUiDefinition();
+
+
/**
* Return the singleton.
*/
public static DefaultJavaAttributeMappingUiDefinition<JavaBasicMapping> instance() {
return INSTANCE;
}
-
-
+
+
/**
* Ensure single instance.
*/
private DefaultBasicMappingUiDefinition() {
super();
}
-
-
+
+
@Override
public String getKey() {
return null;
}
-
+
public String getDefaultKey() {
return MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY;
}
-
+
@Override
public String getLabel() {
return JptUiDetailsMessages.DefaultBasicMappingUiProvider_label;
@@ -67,18 +64,13 @@ public class DefaultBasicMappingUiDefinition
return JptUiDetailsMessages.DefaultBasicMappingUiProvider_linkLabel;
}
- @Override
- public Image getImage() {
- return JpaMappingImageHelper.imageForAttributeMapping(getDefaultKey());
- }
-
public JpaComposite buildAttributeMappingComposite(
JavaUiFactory factory,
PropertyValueModel<JavaBasicMapping> subjectHolder,
PropertyValueModel<Boolean> enabledModel,
Composite parent,
WidgetFactory widgetFactory) {
-
+
return factory.createJavaBasicMappingComposite(subjectHolder, enabledModel, parent, widgetFactory);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/DefaultEmbeddedMappingUiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/DefaultEmbeddedMappingUiDefinition.java
index 19fc95b2d4..03ee6da4e2 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/DefaultEmbeddedMappingUiDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/DefaultEmbeddedMappingUiDefinition.java
@@ -17,10 +17,8 @@ import org.eclipse.jpt.jpa.core.context.java.JavaEmbeddedMapping;
import org.eclipse.jpt.jpa.ui.details.JpaComposite;
import org.eclipse.jpt.jpa.ui.details.java.DefaultJavaAttributeMappingUiDefinition;
import org.eclipse.jpt.jpa.ui.details.java.JavaUiFactory;
-import org.eclipse.jpt.jpa.ui.internal.JpaMappingImageHelper;
import org.eclipse.jpt.jpa.ui.internal.details.AbstractEmbeddedMappingUiDefinition;
import org.eclipse.jpt.jpa.ui.internal.details.JptUiDetailsMessages;
-import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
public class DefaultEmbeddedMappingUiDefinition
@@ -28,35 +26,33 @@ public class DefaultEmbeddedMappingUiDefinition
implements DefaultJavaAttributeMappingUiDefinition<JavaEmbeddedMapping>
{
// singleton
- private static final DefaultEmbeddedMappingUiDefinition INSTANCE =
- new DefaultEmbeddedMappingUiDefinition();
-
-
+ private static final DefaultEmbeddedMappingUiDefinition INSTANCE = new DefaultEmbeddedMappingUiDefinition();
+
/**
* Return the singleton.
*/
public static DefaultJavaAttributeMappingUiDefinition<JavaEmbeddedMapping> instance() {
return INSTANCE;
}
-
-
+
+
/**
* Ensure single instance.
*/
private DefaultEmbeddedMappingUiDefinition() {
super();
}
-
-
+
+
@Override
public String getKey() {
return null;
}
-
+
public String getDefaultKey() {
return MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY;
}
-
+
@Override
public String getLabel() {
return JptUiDetailsMessages.DefaultEmbeddedMappingUiProvider_label;
@@ -67,18 +63,7 @@ public class DefaultEmbeddedMappingUiDefinition
return JptUiDetailsMessages.DefaultEmbeddedMappingUiProvider_linkLabel;
}
- @Override
- public Image getImage() {
- return JpaMappingImageHelper.imageForAttributeMapping(getDefaultKey());
- }
-
- public JpaComposite buildAttributeMappingComposite(
- JavaUiFactory factory,
- PropertyValueModel<JavaEmbeddedMapping> subjectHolder,
- PropertyValueModel<Boolean> enabledModel,
- Composite parent,
- WidgetFactory widgetFactory) {
-
+ public JpaComposite buildAttributeMappingComposite(JavaUiFactory factory, PropertyValueModel<JavaEmbeddedMapping> subjectHolder, PropertyValueModel<Boolean> enabledModel, Composite parent, WidgetFactory widgetFactory) {
return factory.createJavaEmbeddedMappingComposite(subjectHolder, enabledModel, parent, widgetFactory);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/GenericJavaResourceUiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/GenericJavaResourceUiDefinition.java
index 48cbee1fb8..b01899325d 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/GenericJavaResourceUiDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/GenericJavaResourceUiDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2012 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -18,7 +18,8 @@ import org.eclipse.jpt.jpa.ui.details.java.JavaAttributeMappingUiDefinition;
import org.eclipse.jpt.jpa.ui.details.java.JavaTypeMappingUiDefinition;
import org.eclipse.jpt.jpa.ui.details.java.JavaUiFactory;
-public class GenericJavaResourceUiDefinition extends AbstractJavaResourceUiDefinition
+public class GenericJavaResourceUiDefinition
+ extends AbstractJavaResourceUiDefinition
{
// singleton
private static final ResourceUiDefinition INSTANCE = new GenericJavaResourceUiDefinition();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/JavaPersistentAttributeDetailsProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/JavaPersistentAttributeDetailsProvider.java
index 1e009461ec..5432a24951 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/JavaPersistentAttributeDetailsProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/JavaPersistentAttributeDetailsProvider.java
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.ui.internal.details.java;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceCompilationUnit;
import org.eclipse.jpt.common.ui.WidgetFactory;
import org.eclipse.jpt.common.utility.internal.Tools;
import org.eclipse.jpt.jpa.core.JpaStructureNode;
@@ -47,7 +47,7 @@ public class JavaPersistentAttributeDetailsProvider
public boolean providesDetails(JpaStructureNode structureNode) {
return Tools.valuesAreEqual(structureNode.getType(), JavaPersistentAttribute.class)
- && structureNode.getResourceType().getContentType().equals(JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE);
+ && structureNode.getResourceType().getContentType().equals(JavaResourceCompilationUnit.CONTENT_TYPE);
}
public JpaDetailsPageManager<JavaPersistentAttribute> buildDetailsPageManager(
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/JavaPersistentTypeDetailsProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/JavaPersistentTypeDetailsProvider.java
index ff85ccc133..05198a93df 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/JavaPersistentTypeDetailsProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/JavaPersistentTypeDetailsProvider.java
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.ui.internal.details.java;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceCompilationUnit;
import org.eclipse.jpt.common.ui.WidgetFactory;
import org.eclipse.jpt.common.utility.internal.Tools;
import org.eclipse.jpt.jpa.core.JpaStructureNode;
@@ -49,7 +49,7 @@ public class JavaPersistentTypeDetailsProvider
public boolean providesDetails(JpaStructureNode structureNode) {
return Tools.valuesAreEqual(structureNode.getType(), JavaPersistentType.class)
- && structureNode.getResourceType().getContentType().equals(JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE);
+ && structureNode.getResourceType().getContentType().equals(JavaResourceCompilationUnit.CONTENT_TYPE);
}
public JpaDetailsPageManager<PersistentType> buildDetailsPageManager(
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/NullJavaAttributeMappingUiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/NullJavaAttributeMappingUiDefinition.java
index 6088fb286a..c2a53db169 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/NullJavaAttributeMappingUiDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/NullJavaAttributeMappingUiDefinition.java
@@ -18,10 +18,9 @@ import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
import org.eclipse.jpt.jpa.ui.details.JpaComposite;
import org.eclipse.jpt.jpa.ui.details.java.DefaultJavaAttributeMappingUiDefinition;
import org.eclipse.jpt.jpa.ui.details.java.JavaUiFactory;
-import org.eclipse.jpt.jpa.ui.internal.JpaMappingImageHelper;
+import org.eclipse.jpt.jpa.ui.internal.JptUiIcons;
import org.eclipse.jpt.jpa.ui.internal.details.AbstractMappingUiDefinition;
import org.eclipse.jpt.jpa.ui.internal.details.JptUiDetailsMessages;
-import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
public class NullJavaAttributeMappingUiDefinition
@@ -29,17 +28,16 @@ public class NullJavaAttributeMappingUiDefinition
implements DefaultJavaAttributeMappingUiDefinition<JavaAttributeMapping>
{
// singleton
- private static final NullJavaAttributeMappingUiDefinition INSTANCE =
- new NullJavaAttributeMappingUiDefinition();
-
+ private static final NullJavaAttributeMappingUiDefinition INSTANCE = new NullJavaAttributeMappingUiDefinition();
+
/**
* Return the singleton.
*/
public static DefaultJavaAttributeMappingUiDefinition<JavaAttributeMapping> instance() {
return INSTANCE;
}
-
-
+
+
/**
* Ensure single instance.
*/
@@ -47,47 +45,45 @@ public class NullJavaAttributeMappingUiDefinition
super();
}
- public Image getImage() {
- return JpaMappingImageHelper.imageForAttributeMapping(getKey());
+ public String getKey() {
+ return MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY;
}
-
+
+ public String getDefaultKey() {
+ return MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY;
+ }
+
public String getLabel() {
return JptUiDetailsMessages.NullAttributeMappingUiProvider_label;
}
-
+
public String getLinkLabel() {
return null;
}
-
- public String getKey() {
- return null;
- }
-
- public String getDefaultKey() {
- return MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY;
+
+ @Override
+ protected String getImageKey() {
+ return JptUiIcons.NULL_ATTRIBUTE_MAPPING;
}
-
- public JpaComposite buildAttributeMappingComposite(
- JavaUiFactory factory,
- PropertyValueModel<JavaAttributeMapping> subjectHolder,
- PropertyValueModel<Boolean> enabledModel,
- Composite parent,
- WidgetFactory widgetFactory) {
- return new NullComposite(subjectHolder, parent, widgetFactory);
+
+ public JpaComposite buildAttributeMappingComposite(JavaUiFactory factory, PropertyValueModel<JavaAttributeMapping> mappingModel, PropertyValueModel<Boolean> enabledModel, Composite parent, WidgetFactory widgetFactory) {
+ return new NullComposite(mappingModel, parent, widgetFactory);
}
-
- public static class NullComposite extends Pane<JavaAttributeMapping>
+
+ // ********** null composite **********
+
+ /* CU private */ static class NullComposite
+ extends Pane<JavaAttributeMapping>
implements JpaComposite
{
- NullComposite(
- PropertyValueModel<JavaAttributeMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
- super(subjectHolder, parent, widgetFactory);
+ NullComposite(PropertyValueModel<JavaAttributeMapping> mappingModel, Composite parent, WidgetFactory widgetFactory) {
+ super(mappingModel, parent, widgetFactory);
}
@Override
- protected void initializeLayout(Composite container) {}
+ protected void initializeLayout(Composite container) {
+ // NOP
+ }
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/NullJavaTypeMappingUiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/NullJavaTypeMappingUiDefinition.java
index bd70844d8a..afedc0713b 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/NullJavaTypeMappingUiDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/NullJavaTypeMappingUiDefinition.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.
@@ -12,15 +12,15 @@ package org.eclipse.jpt.jpa.ui.internal.details.java;
import org.eclipse.jpt.common.ui.WidgetFactory;
import org.eclipse.jpt.common.ui.internal.widgets.Pane;
import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
+import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.PersistentType;
import org.eclipse.jpt.jpa.core.context.java.JavaTypeMapping;
import org.eclipse.jpt.jpa.ui.details.JpaComposite;
import org.eclipse.jpt.jpa.ui.details.java.DefaultJavaTypeMappingUiDefinition;
import org.eclipse.jpt.jpa.ui.details.java.JavaUiFactory;
-import org.eclipse.jpt.jpa.ui.internal.JpaMappingImageHelper;
+import org.eclipse.jpt.jpa.ui.internal.JptUiIcons;
import org.eclipse.jpt.jpa.ui.internal.details.AbstractMappingUiDefinition;
import org.eclipse.jpt.jpa.ui.internal.details.JptUiDetailsMessages;
-import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
public class NullJavaTypeMappingUiDefinition
@@ -29,8 +29,7 @@ public class NullJavaTypeMappingUiDefinition
{
// singleton
private static final NullJavaTypeMappingUiDefinition INSTANCE = new NullJavaTypeMappingUiDefinition();
-
-
+
/**
* Return the singleton.
*/
@@ -45,51 +44,46 @@ public class NullJavaTypeMappingUiDefinition
private NullJavaTypeMappingUiDefinition() {
super();
}
-
-
- public Image getImage() {
- return JpaMappingImageHelper.imageForTypeMapping(null);
+
+ public String getKey() {
+ return MappingKeys.NULL_TYPE_MAPPING_KEY;
}
-
+
+ public String getDefaultKey() {
+ return MappingKeys.NULL_TYPE_MAPPING_KEY;
+ }
+
public String getLabel() {
return JptUiDetailsMessages.NullTypeMappingUiProvider_label;
}
-
+
public String getLinkLabel() {
return null;
}
-
- public String getKey() {
- return null;
- }
-
- public String getDefaultKey() {
- return null;
+
+ @Override
+ protected String getImageKey() {
+ return JptUiIcons.NULL_TYPE_MAPPING;
}
-
- public JpaComposite buildTypeMappingComposite(
- JavaUiFactory factory,
- PropertyValueModel<JavaTypeMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- return new NullComposite(subjectHolder, parent, widgetFactory);
+
+ public JpaComposite buildTypeMappingComposite(JavaUiFactory factory, PropertyValueModel<JavaTypeMapping> mappingModel, Composite parent, WidgetFactory widgetFactory) {
+ return new NullComposite(mappingModel, parent, widgetFactory);
}
-
- public static class NullComposite
+
+
+ // ********** null composite **********
+
+ /* CU private */ static class NullComposite
extends Pane<JavaTypeMapping>
implements JpaComposite
{
- NullComposite(
- PropertyValueModel<JavaTypeMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- super(subjectHolder, parent, widgetFactory);
+ NullComposite(PropertyValueModel<JavaTypeMapping> mappingModel, Composite parent, WidgetFactory widgetFactory) {
+ super(mappingModel, parent, widgetFactory);
}
-
-
+
@Override
- protected void initializeLayout(Composite container) {}
+ protected void initializeLayout(Composite container) {
+ // NOP
+ }
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/AbstractOrmXmlResourceUiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/AbstractOrmXmlResourceUiDefinition.java
index 7939454d60..a4760535f2 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/AbstractOrmXmlResourceUiDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/AbstractOrmXmlResourceUiDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2012 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,13 +10,10 @@
package org.eclipse.jpt.jpa.ui.internal.details.orm;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
-import java.util.ListIterator;
import org.eclipse.jpt.common.ui.WidgetFactory;
import org.eclipse.jpt.common.utility.internal.Tools;
-import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.common.utility.internal.iterators.ArrayListIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.SuperIterableWrapper;
import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
import org.eclipse.jpt.jpa.core.context.AttributeMapping;
import org.eclipse.jpt.jpa.core.context.PersistentType;
@@ -37,144 +34,126 @@ import org.eclipse.swt.widgets.Composite;
public abstract class AbstractOrmXmlResourceUiDefinition
implements MappingResourceUiDefinition
{
-
- private OrmTypeMappingUiDefinition<? extends TypeMapping>[] ormTypeMappingUiDefinitions;
- private OrmAttributeMappingUiDefinition<? extends AttributeMapping>[] ormAttributeMappingUiDefinitions;
-
+ private ArrayList<OrmTypeMappingUiDefinition<? extends TypeMapping>> ormTypeMappingUiDefinitions;
+
+ private ArrayList<OrmAttributeMappingUiDefinition<? extends AttributeMapping>> ormAttributeMappingUiDefinitions;
+
private final OrmXmlUiFactory factory;
-
-
+
+
/**
* zero-argument constructor
*/
protected AbstractOrmXmlResourceUiDefinition() {
super();
- this.factory = buildOrmXmlUiFactory();
+ this.factory = this.buildOrmXmlUiFactory();
}
-
-
+
+
protected abstract OrmXmlUiFactory buildOrmXmlUiFactory();
-
- public OrmXmlUiFactory getFactory() {
- return this.factory;
- }
-
-
- // ********** ORM type mappings **********
-
- public JpaComposite buildTypeMappingComposite(String key, PropertyValueModel<TypeMapping> mappingHolder, Composite parent, WidgetFactory widgetFactory) {
- OrmTypeMappingUiDefinition<TypeMapping> mappingUiDefinition =
- (OrmTypeMappingUiDefinition<TypeMapping>) getOrmTypeMappingUiDefinition(key);
- return mappingUiDefinition.buildTypeMappingComposite(
- getFactory(),
- mappingHolder,
- parent,
- widgetFactory
- );
- }
-
- protected OrmTypeMappingUiDefinition<? extends TypeMapping> getOrmTypeMappingUiDefinition(String mappingKey) {
- for (OrmTypeMappingUiDefinition<? extends TypeMapping> definition : getOrmTypeMappingUiDefinitions()) {
+
+
+ // ********** type mappings **********
+
+ public JpaComposite buildTypeMappingComposite(String mappingKey, PropertyValueModel<TypeMapping> mappingModel, Composite parent, WidgetFactory widgetFactory) {
+ OrmTypeMappingUiDefinition<TypeMapping> definition = this.getOrmTypeMappingUiDefinition(mappingKey);
+ return definition.buildTypeMappingComposite(this.factory, mappingModel, parent, widgetFactory);
+ }
+
+ public MappingUiDefinition<PersistentType, ? extends TypeMapping> getTypeMappingUiDefinition(String mappingKey) {
+ return this.getOrmTypeMappingUiDefinition_(mappingKey);
+ }
+
+ @SuppressWarnings("unchecked")
+ protected OrmTypeMappingUiDefinition<TypeMapping> getOrmTypeMappingUiDefinition(String mappingKey) {
+ return (OrmTypeMappingUiDefinition<TypeMapping>) this.getOrmTypeMappingUiDefinition_(mappingKey);
+ }
+
+ protected OrmTypeMappingUiDefinition<? extends TypeMapping> getOrmTypeMappingUiDefinition_(String mappingKey) {
+ for (OrmTypeMappingUiDefinition<? extends TypeMapping> definition : this.getOrmTypeMappingUiDefinitions()) {
if (Tools.valuesAreEqual(definition.getKey(), mappingKey)) {
return definition;
}
}
throw new IllegalArgumentException("Illegal type mapping key: " + mappingKey); //$NON-NLS-1$
}
-
- public Iterator<MappingUiDefinition<PersistentType, ? extends TypeMapping>>
- typeMappingUiDefinitions() {
-
- return new ArrayIterator<MappingUiDefinition<PersistentType, ? extends TypeMapping>>(
- getOrmTypeMappingUiDefinitions());
+
+ public Iterable<MappingUiDefinition<PersistentType, ? extends TypeMapping>> getTypeMappingUiDefinitions() {
+ return new SuperIterableWrapper<MappingUiDefinition<PersistentType, ? extends TypeMapping>>(this.getOrmTypeMappingUiDefinitions());
}
-
- protected synchronized OrmTypeMappingUiDefinition<? extends TypeMapping>[] getOrmTypeMappingUiDefinitions() {
+
+ protected synchronized Iterable<OrmTypeMappingUiDefinition<? extends TypeMapping>> getOrmTypeMappingUiDefinitions() {
if (this.ormTypeMappingUiDefinitions == null) {
this.ormTypeMappingUiDefinitions = this.buildOrmTypeMappingUiDefinitions();
}
return this.ormTypeMappingUiDefinitions;
}
-
-
- /**
- * Return an array of mapping definitions to use for types in mapping files of this type.
- * The order is unimportant.
- */
- protected OrmTypeMappingUiDefinition<? extends TypeMapping>[] buildOrmTypeMappingUiDefinitions() {
+
+ protected ArrayList<OrmTypeMappingUiDefinition<? extends TypeMapping>> buildOrmTypeMappingUiDefinitions() {
ArrayList<OrmTypeMappingUiDefinition<? extends TypeMapping>> definitions = new ArrayList<OrmTypeMappingUiDefinition<? extends TypeMapping>>();
this.addOrmTypeMappingUiDefinitionsTo(definitions);
- @SuppressWarnings("unchecked")
- OrmTypeMappingUiDefinition<? extends TypeMapping>[] definitionArray = definitions.toArray(new OrmTypeMappingUiDefinition[definitions.size()]);
- return definitionArray;
- }
-
- protected abstract void addOrmTypeMappingUiDefinitionsTo(
- List<OrmTypeMappingUiDefinition<? extends TypeMapping>> definitions);
-
+ return definitions;
+ }
+
+ protected abstract void addOrmTypeMappingUiDefinitionsTo(List<OrmTypeMappingUiDefinition<? extends TypeMapping>> definitions);
+
public DefaultMappingUiDefinition<PersistentType, ? extends TypeMapping> getDefaultTypeMappingUiDefinition() {
//there is no way to choose an type in the orm.xml that doesn't have a specified mapping so we can return null here
return null;
}
-
- // ********** ORM attribute mappings **********
-
- public JpaComposite buildAttributeMappingComposite(
- String key,
- PropertyValueModel<AttributeMapping> mappingHolder,
- PropertyValueModel<Boolean> enabledModel,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- OrmAttributeMappingUiDefinition<AttributeMapping> mappingUiDefinition =
- (OrmAttributeMappingUiDefinition<AttributeMapping>) getOrmAttributeMappingUiDefinition(key);
- return mappingUiDefinition.buildAttributeMappingComposite(
- getFactory(),
- mappingHolder,
- enabledModel,
- parent,
- widgetFactory
- );
- }
-
- protected OrmAttributeMappingUiDefinition<? extends AttributeMapping> getOrmAttributeMappingUiDefinition(String mappingKey) {
- for (OrmAttributeMappingUiDefinition<? extends AttributeMapping> definition : getOrmAttributeMappingUiDefinitions()) {
+
+
+ // ********** attribute mappings **********
+
+ public JpaComposite buildAttributeMappingComposite(String mappingKey, PropertyValueModel<AttributeMapping> mappingModel, PropertyValueModel<Boolean> enabledModel, Composite parent, WidgetFactory widgetFactory) {
+ OrmAttributeMappingUiDefinition<AttributeMapping> definition = this.getOrmAttributeMappingUiDefinition(mappingKey);
+ return definition.buildAttributeMappingComposite(this.factory, mappingModel, enabledModel, parent, widgetFactory);
+ }
+
+ public MappingUiDefinition<ReadOnlyPersistentAttribute, ? extends AttributeMapping> getAttributeMappingUiDefinition(String mappingKey) {
+ return this.getOrmAttributeMappingUiDefinition_(mappingKey);
+ }
+
+ @SuppressWarnings("unchecked")
+ protected OrmAttributeMappingUiDefinition<AttributeMapping> getOrmAttributeMappingUiDefinition(String mappingKey) {
+ return (OrmAttributeMappingUiDefinition<AttributeMapping>) this.getOrmAttributeMappingUiDefinition_(mappingKey);
+ }
+
+ protected OrmAttributeMappingUiDefinition<? extends AttributeMapping> getOrmAttributeMappingUiDefinition_(String mappingKey) {
+ for (OrmAttributeMappingUiDefinition<? extends AttributeMapping> definition : this.getOrmAttributeMappingUiDefinitions()) {
if (Tools.valuesAreEqual(definition.getKey(), mappingKey)) {
return definition;
}
}
- return UnsupportedOrmMappingUiDefinition.instance();
+ return this.getUnsupportedOrmAttributeMappingUiDefinition();
}
-
- public ListIterator<MappingUiDefinition<ReadOnlyPersistentAttribute, ? extends AttributeMapping>> attributeMappingUiDefinitions() {
- return new ArrayListIterator<MappingUiDefinition<ReadOnlyPersistentAttribute, ? extends AttributeMapping>>(
- getOrmAttributeMappingUiDefinitions());
+
+ @SuppressWarnings("unchecked")
+ protected OrmAttributeMappingUiDefinition<? extends AttributeMapping> getUnsupportedOrmAttributeMappingUiDefinition() {
+ return UnsupportedOrmAttributeMappingUiDefinition.instance();
+ }
+
+ public Iterable<MappingUiDefinition<ReadOnlyPersistentAttribute, ? extends AttributeMapping>> getAttributeMappingUiDefinitions() {
+ return new SuperIterableWrapper<MappingUiDefinition<ReadOnlyPersistentAttribute, ? extends AttributeMapping>>(this.getOrmAttributeMappingUiDefinitions());
}
-
- protected synchronized OrmAttributeMappingUiDefinition<? extends AttributeMapping>[] getOrmAttributeMappingUiDefinitions() {
+
+ protected synchronized Iterable<OrmAttributeMappingUiDefinition<? extends AttributeMapping>> getOrmAttributeMappingUiDefinitions() {
if (this.ormAttributeMappingUiDefinitions == null) {
this.ormAttributeMappingUiDefinitions = this.buildOrmAttributeMappingUiDefinitions();
}
return this.ormAttributeMappingUiDefinitions;
}
-
- /**
- * Return an array of mapping definitions to use for attributes in mapping files of this type.
- * The order is unimportant.
- */
- protected OrmAttributeMappingUiDefinition<? extends AttributeMapping>[] buildOrmAttributeMappingUiDefinitions() {
+
+ protected ArrayList<OrmAttributeMappingUiDefinition<? extends AttributeMapping>> buildOrmAttributeMappingUiDefinitions() {
ArrayList<OrmAttributeMappingUiDefinition<? extends AttributeMapping>> definitions = new ArrayList<OrmAttributeMappingUiDefinition<? extends AttributeMapping>>();
this.addOrmAttributeMappingUiDefinitionsTo(definitions);
- @SuppressWarnings("unchecked")
- OrmAttributeMappingUiDefinition<? extends AttributeMapping>[] definitionArray = definitions.toArray(new OrmAttributeMappingUiDefinition[definitions.size()]);
- return definitionArray;
- }
-
- protected abstract void addOrmAttributeMappingUiDefinitionsTo(
- List<OrmAttributeMappingUiDefinition<? extends AttributeMapping>> definitions);
-
- public DefaultMappingUiDefinition<ReadOnlyPersistentAttribute, ? extends AttributeMapping> getDefaultAttributeMappingUiDefinition(String key) {
+ return definitions;
+ }
+
+ protected abstract void addOrmAttributeMappingUiDefinitionsTo(List<OrmAttributeMappingUiDefinition<? extends AttributeMapping>> definitions);
+
+ public DefaultMappingUiDefinition<ReadOnlyPersistentAttribute, ? extends AttributeMapping> getDefaultAttributeMappingUiDefinition(String mappingKey) {
return null;
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/EntityMappingsDetailsProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/EntityMappingsDetailsProvider.java
index c6fe8e4a0f..bd3c90517f 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/EntityMappingsDetailsProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/EntityMappingsDetailsProvider.java
@@ -11,8 +11,8 @@ package org.eclipse.jpt.jpa.ui.internal.details.orm;
import org.eclipse.jpt.common.core.JptResourceType;
import org.eclipse.jpt.common.ui.WidgetFactory;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.orm.EntityMappings;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmXmlDefinition;
import org.eclipse.jpt.jpa.ui.details.JpaDetailsPageManager;
import org.eclipse.jpt.jpa.ui.details.JpaDetailsProvider;
import org.eclipse.jpt.jpa.ui.internal.details.AbstractEntityMappingsDetailsProvider;
@@ -48,7 +48,7 @@ public class EntityMappingsDetailsProvider
@Override
protected boolean providesDetails(JptResourceType resourceType) {
- return resourceType.equals(JptJpaCorePlugin.ORM_XML_1_0_RESOURCE_TYPE);
+ return resourceType.equals(GenericOrmXmlDefinition.instance().getResourceType());
}
public JpaDetailsPageManager<EntityMappings> buildDetailsPageManager(
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/OrmPersistentAttributeDetailsProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/OrmPersistentAttributeDetailsProvider.java
index b4411fcaf4..2d6622f46e 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/OrmPersistentAttributeDetailsProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/OrmPersistentAttributeDetailsProvider.java
@@ -12,9 +12,9 @@ package org.eclipse.jpt.jpa.ui.internal.details.orm;
import org.eclipse.jpt.common.ui.WidgetFactory;
import org.eclipse.jpt.common.utility.internal.Tools;
import org.eclipse.jpt.jpa.core.JpaStructureNode;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyPersistentAttribute;
+import org.eclipse.jpt.jpa.core.resource.ResourceMappingFile;
import org.eclipse.jpt.jpa.ui.details.JpaDetailsPageManager;
import org.eclipse.jpt.jpa.ui.details.JpaDetailsProvider;
import org.eclipse.swt.widgets.Composite;
@@ -49,7 +49,7 @@ public class OrmPersistentAttributeDetailsProvider
public boolean providesDetails(JpaStructureNode structureNode) {
return Tools.valuesAreEqual(structureNode.getType(), OrmPersistentAttribute.class)
- && structureNode.getResourceType().getContentType().isKindOf(JptJpaCorePlugin.MAPPING_FILE_CONTENT_TYPE);
+ && structureNode.getResourceType().getContentType().isKindOf(ResourceMappingFile.Root.CONTENT_TYPE);
}
public JpaDetailsPageManager<OrmReadOnlyPersistentAttribute> buildDetailsPageManager(
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/OrmPersistentTypeDetailsProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/OrmPersistentTypeDetailsProvider.java
index c9e82513d4..4d108d0a58 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/OrmPersistentTypeDetailsProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/OrmPersistentTypeDetailsProvider.java
@@ -12,9 +12,9 @@ package org.eclipse.jpt.jpa.ui.internal.details.orm;
import org.eclipse.jpt.common.ui.WidgetFactory;
import org.eclipse.jpt.common.utility.internal.Tools;
import org.eclipse.jpt.jpa.core.JpaStructureNode;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.PersistentType;
import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
+import org.eclipse.jpt.jpa.core.resource.ResourceMappingFile;
import org.eclipse.jpt.jpa.ui.details.JpaDetailsPageManager;
import org.eclipse.jpt.jpa.ui.details.JpaDetailsProvider;
import org.eclipse.jpt.jpa.ui.internal.details.PersistentTypeDetailsPage;
@@ -50,7 +50,7 @@ public class OrmPersistentTypeDetailsProvider
public boolean providesDetails(JpaStructureNode structureNode) {
return Tools.valuesAreEqual(structureNode.getType(), OrmPersistentType.class)
- && structureNode.getResourceType().getContentType().isKindOf(JptJpaCorePlugin.MAPPING_FILE_CONTENT_TYPE);
+ && structureNode.getResourceType().getContentType().isKindOf(ResourceMappingFile.Root.CONTENT_TYPE);
}
public JpaDetailsPageManager<PersistentType> buildDetailsPageManager(
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/OrmXmlUiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/OrmXmlUiDefinition.java
index 19af51e450..ec317cabf5 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/OrmXmlUiDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/OrmXmlUiDefinition.java
@@ -13,9 +13,9 @@ import java.util.List;
import org.eclipse.jpt.common.core.JptResourceType;
import org.eclipse.jpt.common.ui.internal.jface.SimpleItemTreeStateProviderFactoryProvider;
import org.eclipse.jpt.common.ui.jface.ItemTreeStateProviderFactoryProvider;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.AttributeMapping;
import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmXmlDefinition;
import org.eclipse.jpt.jpa.ui.ResourceUiDefinition;
import org.eclipse.jpt.jpa.ui.details.orm.OrmAttributeMappingUiDefinition;
import org.eclipse.jpt.jpa.ui.details.orm.OrmTypeMappingUiDefinition;
@@ -52,7 +52,7 @@ public class OrmXmlUiDefinition
}
public boolean providesUi(JptResourceType resourceType) {
- return resourceType.equals(JptJpaCorePlugin.ORM_XML_1_0_RESOURCE_TYPE);
+ return resourceType.equals(GenericOrmXmlDefinition.instance().getResourceType());
}
public ItemTreeStateProviderFactoryProvider getStructureViewFactoryProvider() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/UnsupportedOrmMappingUiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/UnsupportedOrmAttributeMappingUiDefinition.java
index d58cab8283..fa650579d8 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/UnsupportedOrmMappingUiDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/UnsupportedOrmAttributeMappingUiDefinition.java
@@ -16,20 +16,16 @@ import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
import org.eclipse.jpt.jpa.ui.details.JpaComposite;
import org.eclipse.jpt.jpa.ui.details.orm.OrmAttributeMappingUiDefinition;
import org.eclipse.jpt.jpa.ui.details.orm.OrmXmlUiFactory;
-import org.eclipse.jpt.jpa.ui.internal.JpaMappingImageHelper;
import org.eclipse.jpt.jpa.ui.internal.details.AbstractMappingUiDefinition;
-import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
-public class UnsupportedOrmMappingUiDefinition
+public class UnsupportedOrmAttributeMappingUiDefinition
extends AbstractMappingUiDefinition
implements OrmAttributeMappingUiDefinition
{
// singleton
- private static final UnsupportedOrmMappingUiDefinition INSTANCE =
- new UnsupportedOrmMappingUiDefinition();
-
-
+ private static final OrmAttributeMappingUiDefinition INSTANCE = new UnsupportedOrmAttributeMappingUiDefinition();
+
/**
* Return the singleton.
*/
@@ -41,14 +37,13 @@ public class UnsupportedOrmMappingUiDefinition
/**
* Ensure single instance.
*/
- private UnsupportedOrmMappingUiDefinition() {
+ private UnsupportedOrmAttributeMappingUiDefinition() {
super();
}
-
-
- public Image getImage() {
- return JpaMappingImageHelper.imageForAttributeMapping(getKey());
- }
+
+ public String getKey() {
+ return null;
+ }
public String getLabel() {
return JptUiDetailsOrmMessages.UnsupportedOrmMappingUiProvider_label;
@@ -58,32 +53,20 @@ public class UnsupportedOrmMappingUiDefinition
return JptUiDetailsOrmMessages.UnsupportedOrmMappingUiProvider_linkLabel;
}
- public String getKey() {
- return null;
- }
- public JpaComposite buildAttributeMappingComposite(
- OrmXmlUiFactory factory,
- PropertyValueModel subjectHolder,
- PropertyValueModel enabledModel,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- return new NullComposite(subjectHolder, parent, widgetFactory);
+ public JpaComposite buildAttributeMappingComposite(OrmXmlUiFactory factory, PropertyValueModel mappingModel, PropertyValueModel enabledModel, Composite parent, WidgetFactory widgetFactory) {
+ return new NullComposite(mappingModel, parent, widgetFactory);
}
- public static class NullComposite extends Pane<JavaAttributeMapping>
+ public static class NullComposite
+ extends Pane<JavaAttributeMapping>
implements JpaComposite
{
- NullComposite(
- PropertyValueModel<JavaAttributeMapping> subjectHolder,
- Composite parent,
- WidgetFactory widgetFactory) {
-
- super(subjectHolder, parent, widgetFactory);
+ NullComposite(PropertyValueModel<JavaAttributeMapping> mappingModel, Composite parent, WidgetFactory widgetFactory) {
+ super(mappingModel, parent, widgetFactory);
}
-
-
@Override
- protected void initializeLayout(Composite container) {}
+ protected void initializeLayout(Composite container) {
+ // NOP
+ }
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/dialogs/AddPersistentAttributeToXmlAndMapDialog.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/dialogs/AddPersistentAttributeToXmlAndMapDialog.java
index bc71dfa1ca..5ecaf26276 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/dialogs/AddPersistentAttributeToXmlAndMapDialog.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/dialogs/AddPersistentAttributeToXmlAndMapDialog.java
@@ -26,9 +26,9 @@ import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator;
import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyPersistentAttribute;
import org.eclipse.jpt.jpa.ui.JpaPlatformUi;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
import org.eclipse.jpt.jpa.ui.details.MappingUiDefinition;
import org.eclipse.jpt.jpa.ui.internal.JptUiMessages;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
@@ -85,7 +85,7 @@ public class AddPersistentAttributeToXmlAndMapDialog extends StatusDialog
return ArrayTools.array(
CollectionTools.sort(
new FilteringIterator<MappingUiDefinition<ReadOnlyPersistentAttribute, ?>>(
- ((JpaPlatformUi) inputElement).attributeMappingUiDefinitions(unmappedPersistentAttribute.getResourceType())) {
+ ((JpaPlatformUi) inputElement).getAttributeMappingUiDefinitions(unmappedPersistentAttribute.getResourceType())) {
@Override
protected boolean accept(MappingUiDefinition<ReadOnlyPersistentAttribute, ?> o) {
return o.isEnabledFor(AddPersistentAttributeToXmlAndMapDialog.this.unmappedPersistentAttribute);
@@ -179,10 +179,7 @@ public class AddPersistentAttributeToXmlAndMapDialog extends StatusDialog
//
String mappingKey = getMappingKey();
if (mappingKey == null) {
- updateStatus(
- new Status(
- IStatus.ERROR, JptJpaUiPlugin.PLUGIN_ID,
- JptUiMessages.AddPersistentAttributeDialog_noMappingKeyError));
+ updateStatus(JptJpaUiPlugin.instance().buildErrorStatus(JptUiMessages.AddPersistentAttributeDialog_noMappingKeyError));
return;
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/dialogs/AddPersistentClassDialog.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/dialogs/AddPersistentClassDialog.java
index 392d44c5df..470c79bc73 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/dialogs/AddPersistentClassDialog.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/dialogs/AddPersistentClassDialog.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -36,12 +36,12 @@ import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.context.orm.EntityMappings;
import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
import org.eclipse.jpt.jpa.ui.details.MappingUiDefinition;
import org.eclipse.jpt.jpa.ui.internal.JptUiMessages;
import org.eclipse.jpt.jpa.ui.internal.details.orm.OrmEmbeddableUiDefinition;
import org.eclipse.jpt.jpa.ui.internal.details.orm.OrmEntityUiDefinition;
import org.eclipse.jpt.jpa.ui.internal.details.orm.OrmMappedSuperclassUiDefinition;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
@@ -194,7 +194,7 @@ public class AddPersistentClassDialog extends StatusDialog
try {
return this.getJpaProject().getJavaProject().getPackageFragmentRoots()[0];
} catch (JavaModelException ex) {
- JptJpaUiPlugin.log(ex);
+ JptJpaUiPlugin.instance().logError(ex);
return null;
}
}
@@ -241,7 +241,7 @@ public class AddPersistentClassDialog extends StatusDialog
false, getClassName());
}
catch (JavaModelException e) {
- JptJpaUiPlugin.log(e);
+ JptJpaUiPlugin.instance().logError(e);
throw new RuntimeException(e);
}
typeSelectionDialog.setTitle(JptUiMessages.AddPersistentClassDialog_classDialog_title);
@@ -257,10 +257,7 @@ public class AddPersistentClassDialog extends StatusDialog
String className = getClassName();
if (StringTools.stringIsEmpty(className)) {
- updateStatus(
- new Status(
- IStatus.ERROR, JptJpaUiPlugin.PLUGIN_ID,
- JptUiMessages.AddPersistentClassDialog_noClassError));
+ updateStatus(JptJpaUiPlugin.instance().buildErrorStatus(JptUiMessages.AddPersistentClassDialog_noClassError));
return;
}
className = className.replace('$', '.');
@@ -274,27 +271,18 @@ public class AddPersistentClassDialog extends StatusDialog
}
if (type == null) {
- updateStatus(
- new Status(
- IStatus.WARNING, JptJpaUiPlugin.PLUGIN_ID,
- JptUiMessages.AddPersistentClassDialog_classNotFoundWarning));
+ updateStatus(JptJpaUiPlugin.instance().buildWarningStatus(JptUiMessages.AddPersistentClassDialog_classNotFoundWarning));
return;
}
if (this.entityMappings.containsPersistentType(className)) {
- updateStatus(
- new Status(
- IStatus.WARNING, JptJpaUiPlugin.PLUGIN_ID,
- JptUiMessages.AddPersistentClassDialog_duplicateClassWarning));
+ updateStatus(JptJpaUiPlugin.instance().buildWarningStatus(JptUiMessages.AddPersistentClassDialog_duplicateClassWarning));
return;
}
String mappingKey = getMappingKey();
if (mappingKey == null) {
- updateStatus(
- new Status(
- IStatus.ERROR, JptJpaUiPlugin.PLUGIN_ID,
- JptUiMessages.AddPersistentClassDialog_noMappingKeyError));
+ updateStatus(JptJpaUiPlugin.instance().buildErrorStatus(JptUiMessages.AddPersistentClassDialog_noMappingKeyError));
return;
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/editors/PersistenceEditor.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/editors/PersistenceEditor.java
index 93d91766b5..d5e013e492 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/editors/PersistenceEditor.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/editors/PersistenceEditor.java
@@ -34,6 +34,7 @@ import org.eclipse.jpt.common.utility.model.value.ModifiablePropertyValueModel;
import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.context.JpaRootContextNode;
+import org.eclipse.jpt.jpa.core.context.XmlFile;
import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
@@ -184,10 +185,10 @@ public class PersistenceEditor
}
private PropertyValueModel<Persistence> buildPersistenceHolder() {
- return new PropertyAspectAdapter<PersistenceXml, Persistence>(buildPersistenceXmlHolder(), PersistenceXml.PERSISTENCE_PROPERTY) {
+ return new PropertyAspectAdapter<PersistenceXml, Persistence>(buildPersistenceXmlHolder(), XmlFile.ROOT_PROPERTY) {
@Override
protected Persistence buildValue_() {
- return subject.getPersistence();
+ return subject.getRoot();
}
};
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jface/XmlMappingFileViewerFilter.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jface/XmlMappingFileViewerFilter.java
index 18bf64e481..df32cb684f 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jface/XmlMappingFileViewerFilter.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jface/XmlMappingFileViewerFilter.java
@@ -20,15 +20,13 @@ import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.jpt.common.core.resource.ProjectResourceLocator;
import org.eclipse.jpt.jpa.core.JpaFile;
import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
/**
* This filter will deny showing any file that are not XML mapping files or folders
* that don't contain any XML mapping files in its sub-hierarchy. An XML mapping
* file is one that has a corresponding JpaFile in the project with a mapping file
* content type.
- * @see JptJpaCorePlugin.MAPPING_FILE_CONTENT_TYPE
*/
public class XmlMappingFileViewerFilter
extends ViewerFilter {
@@ -64,7 +62,7 @@ public class XmlMappingFileViewerFilter
}
catch (CoreException ce) {
// fall through
- JptJpaUiPlugin.log(ce);
+ JptJpaUiPlugin.instance().logError(ce);
}
}
}
@@ -77,6 +75,6 @@ public class XmlMappingFileViewerFilter
*/
private boolean isMappingFile(IFile file) {
JpaFile jpaFile = this.jpaProject.getJpaFile(file);
- return jpaFile != null ? jpaFile.getContentType().isKindOf(contentType): false;
+ return jpaFile != null ? jpaFile.getContentType().isKindOf(this.contentType): false;
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/Jpa2_0FlagTransformer.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/Jpa2_0FlagTransformer.java
index 3e71baf8ef..ab4fa52384 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/Jpa2_0FlagTransformer.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/Jpa2_0FlagTransformer.java
@@ -10,12 +10,12 @@
package org.eclipse.jpt.jpa.ui.internal.jpa2;
import java.io.Serializable;
-import org.eclipse.jpt.common.utility.internal.Transformer;
import org.eclipse.jpt.common.utility.internal.AbstractTransformer;
+import org.eclipse.jpt.common.utility.internal.Transformer;
import org.eclipse.jpt.common.utility.internal.model.value.TransformationPropertyValueModel;
import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
import org.eclipse.jpt.jpa.core.JpaNode;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.jpa2.JpaProject2_0;
/**
* Transform a JPA node into a
@@ -50,7 +50,7 @@ public final class Jpa2_0FlagTransformer<T extends JpaNode>
@Override
protected Boolean transform_(T jpaNode) {
- return Boolean.valueOf(JptJpaCorePlugin.nodeIsJpa2_0Compatible(jpaNode));
+ return Boolean.valueOf(jpaNode.getJpaProject().getJpaPlatform().getJpaVersion().isCompatibleWithJpaVersion(JpaProject2_0.FACET_VERSION_STRING));
}
private static final long serialVersionUID = 1L;
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/Jpa2_0XmlFlagModel.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/OrmXml2_0FlagModel.java
index 6be27abd7b..ad3304e542 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/Jpa2_0XmlFlagModel.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/OrmXml2_0FlagModel.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.
@@ -9,20 +9,20 @@
******************************************************************************/
package org.eclipse.jpt.jpa.ui.internal.jpa2;
+import org.eclipse.jpt.common.core.JptResourceTypeReference;
import org.eclipse.jpt.common.utility.internal.model.value.TransformationPropertyValueModel;
import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.GenericOrmXml2_0Definition;
-public class Jpa2_0XmlFlagModel<T extends XmlContextNode> extends
- TransformationPropertyValueModel<T, Boolean> {
-
- public Jpa2_0XmlFlagModel(PropertyValueModel<T> valueModel) {
+public class OrmXml2_0FlagModel<R extends JptResourceTypeReference>
+ extends TransformationPropertyValueModel<R, Boolean>
+{
+ public OrmXml2_0FlagModel(PropertyValueModel<R> valueModel) {
super(valueModel);
}
@Override
- protected Boolean transform_(T value) {
- return Boolean.valueOf(JptJpaCorePlugin.nodeIsXml2_0Compatible(value));
+ protected Boolean transform_(R ref) {
+ return Boolean.valueOf(ref.getResourceType().isKindOf(GenericOrmXml2_0Definition.instance().getResourceType()));
}
-} \ No newline at end of file
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/AbstractElementCollectionMapping2_0UiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/AbstractElementCollectionMapping2_0UiDefinition.java
index d7f1921540..c4a40b7ecd 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/AbstractElementCollectionMapping2_0UiDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/AbstractElementCollectionMapping2_0UiDefinition.java
@@ -1,20 +1,18 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
+ * Copyright (c) 2009, 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
package org.eclipse.jpt.jpa.ui.internal.jpa2.details;
import org.eclipse.jpt.jpa.core.jpa2.MappingKeys2_0;
import org.eclipse.jpt.jpa.core.jpa2.context.ElementCollectionMapping2_0;
-import org.eclipse.jpt.jpa.ui.internal.JpaMappingImageHelper;
+import org.eclipse.jpt.jpa.ui.internal.JptUiIcons;
import org.eclipse.jpt.jpa.ui.internal.details.AbstractMappingUiDefinition;
-import org.eclipse.swt.graphics.Image;
public abstract class AbstractElementCollectionMapping2_0UiDefinition<M, T extends ElementCollectionMapping2_0>
extends AbstractMappingUiDefinition<M, T>
@@ -22,21 +20,21 @@ public abstract class AbstractElementCollectionMapping2_0UiDefinition<M, T exten
protected AbstractElementCollectionMapping2_0UiDefinition() {
super();
}
-
-
- public Image getImage() {
- return JpaMappingImageHelper.imageForAttributeMapping(getKey());
+
+ public String getKey() {
+ return MappingKeys2_0.ELEMENT_COLLECTION_ATTRIBUTE_MAPPING_KEY;
}
-
+
public String getLabel() {
return JptUiDetailsMessages2_0.ElementCollectionMapping2_0_label;
}
-
+
public String getLinkLabel() {
return JptUiDetailsMessages2_0.ElementCollectionMapping2_0_linkLabel;
}
-
- public String getKey() {
- return MappingKeys2_0.ELEMENT_COLLECTION_ATTRIBUTE_MAPPING_KEY;
+
+ @Override
+ protected String getImageKey() {
+ return JptUiIcons.ELEMENT_COLLECTION;
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/java/Generic2_0JavaResourceUiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/java/Generic2_0JavaResourceUiDefinition.java
index f4964985db..6d7da67e92 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/java/Generic2_0JavaResourceUiDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/java/Generic2_0JavaResourceUiDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2012 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -35,7 +35,8 @@ import org.eclipse.jpt.jpa.ui.internal.details.java.JavaTransientMappingUiDefini
import org.eclipse.jpt.jpa.ui.internal.details.java.JavaVersionMappingUiDefinition;
import org.eclipse.jpt.jpa.ui.internal.details.java.NullJavaAttributeMappingUiDefinition;
-public class Generic2_0JavaResourceUiDefinition extends AbstractJavaResourceUiDefinition
+public class Generic2_0JavaResourceUiDefinition
+ extends AbstractJavaResourceUiDefinition
{
// singleton
private static final ResourceUiDefinition INSTANCE = new Generic2_0JavaResourceUiDefinition();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/orm/EntityMappings2_0DetailsProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/orm/EntityMappings2_0DetailsProvider.java
index cda365b761..503d4eceb4 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/orm/EntityMappings2_0DetailsProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/orm/EntityMappings2_0DetailsProvider.java
@@ -1,18 +1,18 @@
/*******************************************************************************
-* Copyright (c) 2009, 2012 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
+ * Copyright (c) 2009, 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
package org.eclipse.jpt.jpa.ui.internal.jpa2.details.orm;
import org.eclipse.jpt.common.core.JptResourceType;
import org.eclipse.jpt.common.ui.WidgetFactory;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.orm.EntityMappings;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.GenericOrmXml2_0Definition;
import org.eclipse.jpt.jpa.ui.details.JpaDetailsPageManager;
import org.eclipse.jpt.jpa.ui.details.JpaDetailsProvider;
import org.eclipse.jpt.jpa.ui.internal.details.AbstractEntityMappingsDetailsProvider;
@@ -46,7 +46,7 @@ public class EntityMappings2_0DetailsProvider
@Override
protected boolean providesDetails(JptResourceType resourceType) {
- return resourceType.equals(JptJpaCorePlugin.ORM_XML_2_0_RESOURCE_TYPE);
+ return resourceType.equals(GenericOrmXml2_0Definition.instance().getResourceType());
}
public JpaDetailsPageManager<EntityMappings> buildDetailsPageManager(
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/orm/OrmXml2_0UiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/orm/OrmXml2_0UiDefinition.java
index c3b0db29e3..c286c1fccd 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/orm/OrmXml2_0UiDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/orm/OrmXml2_0UiDefinition.java
@@ -12,9 +12,9 @@ package org.eclipse.jpt.jpa.ui.internal.jpa2.details.orm;
import java.util.List;
import org.eclipse.jpt.common.core.JptResourceType;
import org.eclipse.jpt.common.ui.jface.ItemTreeStateProviderFactoryProvider;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.AttributeMapping;
import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.GenericOrmXml2_0Definition;
import org.eclipse.jpt.jpa.ui.ResourceUiDefinition;
import org.eclipse.jpt.jpa.ui.details.orm.OrmAttributeMappingUiDefinition;
import org.eclipse.jpt.jpa.ui.details.orm.OrmTypeMappingUiDefinition;
@@ -65,7 +65,7 @@ public class OrmXml2_0UiDefinition
}
public boolean providesUi(JptResourceType resourceType) {
- return resourceType.equals(JptJpaCorePlugin.ORM_XML_2_0_RESOURCE_TYPE);
+ return resourceType.equals(GenericOrmXml2_0Definition.instance().getResourceType());
}
public ItemTreeStateProviderFactoryProvider getStructureViewFactoryProvider() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/persistence/GenericPersistenceUnit2_0OptionsTab.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/persistence/GenericPersistenceUnit2_0OptionsTab.java
index 855e5071ea..174e855b4b 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/persistence/GenericPersistenceUnit2_0OptionsTab.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/persistence/GenericPersistenceUnit2_0OptionsTab.java
@@ -25,10 +25,10 @@ import org.eclipse.jface.window.Window;
import org.eclipse.jpt.common.ui.WidgetFactory;
import org.eclipse.jpt.common.ui.internal.JptCommonUiMessages;
import org.eclipse.jpt.common.ui.internal.widgets.AddRemoveListPane;
+import org.eclipse.jpt.common.ui.internal.widgets.AddRemovePane.Adapter;
import org.eclipse.jpt.common.ui.internal.widgets.EnumFormComboViewer;
import org.eclipse.jpt.common.ui.internal.widgets.IntegerCombo;
import org.eclipse.jpt.common.ui.internal.widgets.Pane;
-import org.eclipse.jpt.common.ui.internal.widgets.AddRemovePane.Adapter;
import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.common.utility.internal.model.value.ListAspectAdapter;
import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapter;
@@ -42,8 +42,8 @@ import org.eclipse.jpt.jpa.core.jpa2.context.persistence.PersistenceUnit2_0;
import org.eclipse.jpt.jpa.core.jpa2.context.persistence.options.JpaOptions2_0;
import org.eclipse.jpt.jpa.core.jpa2.context.persistence.options.SharedCacheMode;
import org.eclipse.jpt.jpa.core.jpa2.context.persistence.options.ValidationMode;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
import org.eclipse.jpt.jpa.ui.editors.JpaPageComposite;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.PlatformUI;
@@ -423,7 +423,7 @@ public class GenericPersistenceUnit2_0OptionsTab extends Pane<JpaOptions2_0>
);
}
catch (JavaModelException e) {
- JptJpaUiPlugin.log(e);
+ JptJpaUiPlugin.instance().logError(e);
return null;
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/persistence/JdbcConnectionPropertiesComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/persistence/JdbcConnectionPropertiesComposite.java
index b8d0c4a7fa..5961e5e1f7 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/persistence/JdbcConnectionPropertiesComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/persistence/JdbcConnectionPropertiesComposite.java
@@ -10,11 +10,10 @@
package org.eclipse.jpt.jpa.ui.internal.jpa2.persistence;
import java.util.Comparator;
-
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.IDialogSettings;
@@ -29,8 +28,7 @@ import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
import org.eclipse.jpt.jpa.core.jpa2.context.persistence.connection.JpaConnection2_0;
import org.eclipse.jpt.jpa.db.ConnectionProfile;
import org.eclipse.jpt.jpa.db.ConnectionProfileFactory;
-import org.eclipse.jpt.jpa.db.JptJpaDbPlugin;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
@@ -172,7 +170,7 @@ public class JdbcConnectionPropertiesComposite extends Pane<JpaConnection2_0>
// take the settings from it (user, password, etc.) and give them
// to the persistence connection, so we go
// to the db plug-in directly to get the factory
- return JptJpaDbPlugin.getConnectionProfileFactory();
+ return (ConnectionProfileFactory) ResourcesPlugin.getWorkspace().getAdapter(ConnectionProfileFactory.class);
}
// broaden access a bit
@@ -311,11 +309,8 @@ public class JdbcConnectionPropertiesComposite extends Pane<JpaConnection2_0>
@Override
protected IStatus validateItem(Object item) {
-
- if (item == null) {
- return new Status(IStatus.ERROR, JptJpaUiPlugin.PLUGIN_ID, IStatus.ERROR, "", null);
- }
- return Status.OK_STATUS;
+ int severity = (item == null) ? IStatus.ERROR : IStatus.OK;
+ return JptJpaUiPlugin.instance().buildStatus(severity);
}
/**
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/persistence/PersistenceXml2_0UiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/persistence/PersistenceXml2_0UiDefinition.java
index e51da28c41..548f3410a6 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/persistence/PersistenceXml2_0UiDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/persistence/PersistenceXml2_0UiDefinition.java
@@ -11,7 +11,7 @@ package org.eclipse.jpt.jpa.ui.internal.jpa2.persistence;
import org.eclipse.jpt.common.core.JptResourceType;
import org.eclipse.jpt.common.ui.jface.ItemTreeStateProviderFactoryProvider;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence.GenericPersistenceXml2_0Definition;
import org.eclipse.jpt.jpa.ui.ResourceUiDefinition;
import org.eclipse.jpt.jpa.ui.internal.persistence.AbstractPersistenceXmlResourceUiDefinition;
import org.eclipse.jpt.jpa.ui.internal.persistence.PersistenceXmlUiDefinition;
@@ -46,7 +46,7 @@ public class PersistenceXml2_0UiDefinition
}
public boolean providesUi(JptResourceType resourceType) {
- return resourceType.equals(JptJpaCorePlugin.PERSISTENCE_XML_2_0_RESOURCE_TYPE);
+ return resourceType.equals(GenericPersistenceXml2_0Definition.instance().getResourceType());
}
public ItemTreeStateProviderFactoryProvider getStructureViewFactoryProvider() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpaJpqlContentProposalProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpaJpqlContentProposalProvider.java
index 4a82c9c368..a47da63408 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpaJpqlContentProposalProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpaJpqlContentProposalProvider.java
@@ -64,10 +64,10 @@ import org.eclipse.jpt.common.ui.internal.listeners.SWTPropertyChangeListenerWra
import org.eclipse.jpt.common.utility.internal.StringTools;
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.PropertyValueModel;
import org.eclipse.jpt.common.utility.model.value.ModifiablePropertyValueModel;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
import org.eclipse.jpt.jpa.core.context.NamedQuery;
+import org.eclipse.jpt.jpa.core.jpql.JpaJpqlQueryHelper;
import org.eclipse.jpt.jpa.ui.internal.JptUiMessages;
import org.eclipse.osgi.util.NLS;
import org.eclipse.persistence.jpa.jpql.JPQLQueryProblem;
@@ -77,6 +77,7 @@ import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;
@@ -519,7 +520,7 @@ public final class JpaJpqlContentProposalProvider extends JpqlCompletionProposal
resourceBundle = ResourceBundle.getBundle(
"jpa_jpql_validation",
Locale.getDefault(),
- JptJpaCorePlugin.class.getClassLoader()
+ JpaJpqlQueryHelper.class.getClassLoader()
);
}
return resourceBundle;
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpaJpqlJavaCompletionProposalComputer.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpaJpqlJavaCompletionProposalComputer.java
index cf10b337bf..be029b1946 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpaJpqlJavaCompletionProposalComputer.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpaJpqlJavaCompletionProposalComputer.java
@@ -41,14 +41,13 @@ import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.jpa.core.JpaFile;
import org.eclipse.jpt.jpa.core.JpaStructureNode;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.NamedQuery;
import org.eclipse.jpt.jpa.core.context.Query;
import org.eclipse.jpt.jpa.core.context.java.JavaNamedQuery;
import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
import org.eclipse.jpt.jpa.core.context.java.JavaTypeMapping;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
import org.eclipse.jpt.jpa.ui.internal.JptUiMessages;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
import org.eclipse.persistence.jpa.jpql.ExpressionTools;
import org.eclipse.swt.graphics.Image;
@@ -108,8 +107,8 @@ public final class JpaJpqlJavaCompletionProposalComputer extends JpqlCompletionP
try {
return computeCompletionProposals((JavaContentAssistInvocationContext) context, monitor);
}
- catch (Exception e) {
- JptJpaUiPlugin.log(JptUiMessages.JpaJpqlJavaCompletionProposalComputer_Error, e);
+ catch (Exception ex) {
+ JptJpaUiPlugin.instance().logError(ex, JptUiMessages.JpaJpqlJavaCompletionProposalComputer_Error);
}
finally {
monitor.done();
@@ -196,7 +195,7 @@ public final class JpaJpqlJavaCompletionProposalComputer extends JpqlCompletionP
return (IFile) compilationUnit.getCorrespondingResource();
}
catch (JavaModelException ex) {
- JptJpaCorePlugin.log(ex);
+ JptJpaUiPlugin.instance().logError(ex);
return null;
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpaJpqlSseCompletionProposalComputer.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpaJpqlSseCompletionProposalComputer.java
index fb36549fe1..92b4bb3fe9 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpaJpqlSseCompletionProposalComputer.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpaJpqlSseCompletionProposalComputer.java
@@ -36,8 +36,8 @@ import org.eclipse.jpt.jpa.core.context.orm.EntityMappings;
import org.eclipse.jpt.jpa.core.context.orm.OrmEntity;
import org.eclipse.jpt.jpa.core.context.orm.OrmNamedQuery;
import org.eclipse.jpt.jpa.core.context.orm.OrmQueryContainer;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
import org.eclipse.jpt.jpa.ui.internal.JptUiMessages;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
import org.eclipse.persistence.jpa.jpql.ExpressionTools;
import org.eclipse.swt.graphics.Image;
import org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext;
@@ -124,8 +124,8 @@ public final class JpaJpqlSseCompletionProposalComputer extends JpqlCompletionPr
String jpqlQuery = jpqlQuery(namedQuery, context.getDocument());
return buildProposals(namedQuery, jpqlQuery, tokenStart, position[0]);
}
- catch (Exception e) {
- JptJpaUiPlugin.log(JptUiMessages.JpaJpqlSseCompletionProposalComputer_Error, e);
+ catch (Exception ex) {
+ JptJpaUiPlugin.instance().logError(ex, JptUiMessages.JpaJpqlSseCompletionProposalComputer_Error);
}
finally {
monitor.done();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpqlCompletionProposalComputer.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpqlCompletionProposalComputer.java
index b9f18eb9c5..0278cc3888 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpqlCompletionProposalComputer.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpql/JpqlCompletionProposalComputer.java
@@ -13,6 +13,16 @@
******************************************************************************/
package org.eclipse.jpt.jpa.ui.internal.jpql;
+import static org.eclipse.persistence.jpa.jpql.spi.IMappingType.BASIC;
+import static org.eclipse.persistence.jpa.jpql.spi.IMappingType.ELEMENT_COLLECTION;
+import static org.eclipse.persistence.jpa.jpql.spi.IMappingType.EMBEDDED;
+import static org.eclipse.persistence.jpa.jpql.spi.IMappingType.EMBEDDED_ID;
+import static org.eclipse.persistence.jpa.jpql.spi.IMappingType.ID;
+import static org.eclipse.persistence.jpa.jpql.spi.IMappingType.MANY_TO_MANY;
+import static org.eclipse.persistence.jpa.jpql.spi.IMappingType.MANY_TO_ONE;
+import static org.eclipse.persistence.jpa.jpql.spi.IMappingType.ONE_TO_MANY;
+import static org.eclipse.persistence.jpa.jpql.spi.IMappingType.ONE_TO_ONE;
+import static org.eclipse.persistence.jpa.jpql.spi.IMappingType.VERSION;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
@@ -20,11 +30,11 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.jpa.core.JpaPreferences;
import org.eclipse.jpt.jpa.core.context.NamedQuery;
import org.eclipse.jpt.jpa.core.jpql.JpaJpqlQueryHelper;
-import org.eclipse.jpt.jpa.core.prefs.JpaJpqlPreferencesManager;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
import org.eclipse.jpt.jpa.ui.internal.JptUiIcons;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
import org.eclipse.persistence.jpa.jpql.ContentAssistProposals;
import org.eclipse.persistence.jpa.jpql.WordParser;
import org.eclipse.persistence.jpa.jpql.parser.Expression;
@@ -34,8 +44,6 @@ import org.eclipse.persistence.jpa.jpql.spi.IMapping;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;
-import static org.eclipse.persistence.jpa.jpql.spi.IMappingType.*;
-
/**
* The abstract definition of JPQL content assist support.
*
@@ -329,20 +337,20 @@ abstract class JpqlCompletionProposalComputer<T> {
}
private Image getImage(String key) {
- ImageRegistry imageRegistry = getImageRegistry();
- Image image = imageRegistry.get(key);
+ ImageRegistry registry = getImageRegistry();
+ Image image = registry.get(key);
if (image == null) {
- imageRegistry.put(key, getImageDescriptor(key));
- image = imageRegistry.get(key);
+ registry.put(key, buildImageDescriptor(key));
+ image = registry.get(key);
}
return image;
}
- private ImageDescriptor getImageDescriptor(String key) {
- return JptJpaUiPlugin.getImageDescriptor(key);
+ private ImageDescriptor buildImageDescriptor(String key) {
+ return JptJpaUiPlugin.instance().buildImageDescriptor(key);
}
- private ImageRegistry getImageRegistry() {
+ private synchronized ImageRegistry getImageRegistry() {
if (imageRegistry == null) {
imageRegistry = new ImageRegistry(Display.getCurrent());
}
@@ -430,12 +438,11 @@ abstract class JpqlCompletionProposalComputer<T> {
}
private boolean shouldMatchFirstCharacterCase() {
- return JpaJpqlPreferencesManager.getMatchFirstCharacterCaseWorkspacePreference();
+ return JpaPreferences.getJpqlIdentifierMatchFirstCharacterCase();
}
private boolean shouldUseLowercaseIdentifiers() {
- String value = JpaJpqlPreferencesManager.getIdentifiersCaseWorkspacePreference();
- return JpaJpqlPreferencesManager.JPQL_IDENTIFIER_LOWERCASE_PREF_VALUE.equals(value);
+ return JpaPreferences.getJpqlIdentifierLowercase();
}
private <I extends Comparable<? super I>> Iterable<I> sort(Iterable<I> iterator) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/menus/MapAsContribution.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/menus/MapAsContribution.java
index a77968e76a..ac77b59a96 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/menus/MapAsContribution.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/menus/MapAsContribution.java
@@ -11,7 +11,6 @@ package org.eclipse.jpt.jpa.ui.internal.menus;
import java.util.Comparator;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.Map;
import org.eclipse.jface.action.IContributionItem;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -19,9 +18,9 @@ import org.eclipse.jpt.common.core.JptResourceType;
import org.eclipse.jpt.common.ui.internal.jface.ImageImageDescriptor;
import org.eclipse.jpt.common.utility.internal.ArrayTools;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.iterators.CompositeIterator;
-import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator;
-import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator;
+import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
+import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
import org.eclipse.jpt.jpa.core.JpaPlatform;
import org.eclipse.jpt.jpa.core.JpaStructureNode;
import org.eclipse.jpt.jpa.ui.JpaPlatformUi;
@@ -85,7 +84,7 @@ public abstract class MapAsContribution<T extends JpaStructureNode>
return
ArrayTools.array(
- new TransformationIterator<MappingUiDefinition<T, ?>, IContributionItem>(mappingUiDefinitions(node)) {
+ new TransformationIterable<MappingUiDefinition<T, ?>, IContributionItem>(this.getMappingUiDefinitions(node)) {
@Override
protected IContributionItem transform(MappingUiDefinition<T, ?> next) {
return createContributionItem(next);
@@ -114,13 +113,13 @@ public abstract class MapAsContribution<T extends JpaStructureNode>
* of providers to return
* @return The list of registered {@link MappingUiDefinition}s
*/
- protected <U extends T> Iterator<? extends MappingUiDefinition<T, ?>> mappingUiDefinitions(final T node) {
+ protected <U extends T> Iterable<? extends MappingUiDefinition<T, ?>> getMappingUiDefinitions(final T node) {
JpaPlatformUi jpaPlatformUi = (JpaPlatformUi) node.getJpaPlatform().getAdapter(JpaPlatformUi.class);
- Iterator<? extends MappingUiDefinition<T, ?>> sortedMappingUiDefinitions =
+ Iterable<? extends MappingUiDefinition<T, ?>> sortedMappingUiDefinitions =
CollectionTools.sort(
- new FilteringIterator<MappingUiDefinition<T, ?>>(
- mappingUiDefinitions(jpaPlatformUi, node.getResourceType())) {
+ new FilteringIterable<MappingUiDefinition<T, ?>>(
+ getMappingUiDefinitions(jpaPlatformUi, node.getResourceType())) {
@Override
protected boolean accept(MappingUiDefinition<T, ?> o) {
return o.isEnabledFor(node);
@@ -129,10 +128,9 @@ public abstract class MapAsContribution<T extends JpaStructureNode>
getDefinitionsComparator());
DefaultMappingUiDefinition<T, ?> defaultDefinition = getDefaultMappingUiDefinition(jpaPlatformUi, node);
- if (defaultDefinition != null) {
- return new CompositeIterator<MappingUiDefinition<T, ?>>(defaultDefinition, sortedMappingUiDefinitions);
- }
- return sortedMappingUiDefinitions;
+ return (defaultDefinition == null) ?
+ sortedMappingUiDefinitions :
+ new CompositeIterable<MappingUiDefinition<T, ?>>(defaultDefinition, sortedMappingUiDefinitions);
}
/**
@@ -145,8 +143,7 @@ public abstract class MapAsContribution<T extends JpaStructureNode>
* @param node A test node to determine type of providers to return
* @return The list of registered {@link MappingUiDefinition}s
*/
- protected abstract Iterator<? extends MappingUiDefinition<T, ?>>
- mappingUiDefinitions(JpaPlatformUi platformUi, JptResourceType resourceType);
+ protected abstract Iterable<? extends MappingUiDefinition<T, ?>> getMappingUiDefinitions(JpaPlatformUi platformUi, JptResourceType resourceType);
/**
* Creates the default provider responsible for clearing the mapping type.
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/menus/PersistentAttributeMapAsContribution.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/menus/PersistentAttributeMapAsContribution.java
index 45e1c6393b..cd5f4876a9 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/menus/PersistentAttributeMapAsContribution.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/menus/PersistentAttributeMapAsContribution.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2012 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,7 +9,6 @@
******************************************************************************/
package org.eclipse.jpt.jpa.ui.internal.menus;
-import java.util.Iterator;
import org.eclipse.jpt.common.core.JptResourceType;
import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
@@ -62,10 +61,8 @@ public class PersistentAttributeMapAsContribution
}
@Override
- protected Iterator<? extends MappingUiDefinition<ReadOnlyPersistentAttribute, ?>> mappingUiDefinitions(
- JpaPlatformUi jpaPlatformUi, JptResourceType resourceType) {
-
- return jpaPlatformUi.attributeMappingUiDefinitions(resourceType);
+ protected Iterable<? extends MappingUiDefinition<ReadOnlyPersistentAttribute, ?>> getMappingUiDefinitions(JpaPlatformUi jpaPlatformUi, JptResourceType resourceType) {
+ return jpaPlatformUi.getAttributeMappingUiDefinitions(resourceType);
}
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/menus/PersistentTypeMapAsContribution.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/menus/PersistentTypeMapAsContribution.java
index ac878eb934..1d343b374b 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/menus/PersistentTypeMapAsContribution.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/menus/PersistentTypeMapAsContribution.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2012 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,7 +9,6 @@
******************************************************************************/
package org.eclipse.jpt.jpa.ui.internal.menus;
-import java.util.Iterator;
import org.eclipse.jpt.common.core.JptResourceType;
import org.eclipse.jpt.jpa.core.JpaPlatform;
import org.eclipse.jpt.jpa.core.context.PersistentType;
@@ -49,16 +48,12 @@ public class PersistentTypeMapAsContribution
}
@Override
- protected Iterator<? extends MappingUiDefinition<PersistentType, ?>> mappingUiDefinitions(
- JpaPlatformUi jpaPlatformUi, JptResourceType resourceType) {
-
- return jpaPlatformUi.typeMappingUiDefinitions(resourceType);
+ protected Iterable<? extends MappingUiDefinition<PersistentType, ?>> getMappingUiDefinitions(JpaPlatformUi jpaPlatformUi, JptResourceType resourceType) {
+ return jpaPlatformUi.getTypeMappingUiDefinitions(resourceType);
}
@Override
- protected DefaultMappingUiDefinition<PersistentType, ?> getDefaultMappingUiDefinition(
- JpaPlatformUi jpaPlatformUi, PersistentType node) {
-
+ protected DefaultMappingUiDefinition<PersistentType, ?> getDefaultMappingUiDefinition(JpaPlatformUi jpaPlatformUi, PersistentType node) {
return jpaPlatformUi.getDefaultTypeMappingUiDefinition(node.getResourceType());
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/navigator/RootContextNodeModelItemLabelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/navigator/RootContextNodeModelItemLabelProvider.java
index a46fe977c5..d194ec6d6e 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/navigator/RootContextNodeModelItemLabelProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/navigator/RootContextNodeModelItemLabelProvider.java
@@ -17,9 +17,9 @@ import org.eclipse.jpt.common.utility.internal.model.value.TransformationPropert
import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
import org.eclipse.jpt.jpa.core.context.JpaRootContextNode;
import org.eclipse.jpt.jpa.ui.JpaRootContextNodeModel;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
import org.eclipse.jpt.jpa.ui.internal.JptUiIcons;
import org.eclipse.jpt.jpa.ui.internal.JptUiMessages;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
import org.eclipse.swt.graphics.Image;
public class RootContextNodeModelItemLabelProvider
@@ -41,9 +41,7 @@ public class RootContextNodeModelItemLabelProvider
{
@Override
public Image transform(JpaRootContextNode root) {
- return (root != null) ?
- JptJpaUiPlugin.getImage(JptUiIcons.JPA_CONTENT) :
- JptUiIcons.ghost(JptUiIcons.JPA_CONTENT);
+ return JptJpaUiPlugin.instance().getImage(JptUiIcons.JPA_CONTENT, (root == null));
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/ArchiveFileSelectionDialog.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/ArchiveFileSelectionDialog.java
index ab2170d652..bff80288ee 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/ArchiveFileSelectionDialog.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/ArchiveFileSelectionDialog.java
@@ -10,24 +10,22 @@
package org.eclipse.jpt.jpa.ui.internal.persistence;
import java.util.Collections;
-
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.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jpt.common.core.internal.utility.ProjectTools;
import org.eclipse.jpt.common.ui.internal.jface.ArchiveFileViewerFilter;
import org.eclipse.jpt.common.ui.internal.utility.swt.SWTTools;
import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel;
import org.eclipse.jpt.common.utility.model.value.ModifiablePropertyValueModel;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
@@ -140,15 +138,15 @@ public class ArchiveFileSelectionDialog
public IStatus validate(Object[] selection) {
int nSelected= selection.length;
if (nSelected == 0 || (nSelected > 1)) {
- return new Status(IStatus.ERROR, JptJpaUiPlugin.PLUGIN_ID, ""); //$NON-NLS-1$
+ return JptJpaUiPlugin.instance().buildErrorStatus();
}
for (int i= 0; i < selection.length; i++) {
Object curr= selection[i];
if (curr instanceof IFile) {
- return new Status(IStatus.OK, JptJpaUiPlugin.PLUGIN_ID, ""); //$NON-NLS-1$
+ return JptJpaUiPlugin.instance().buildOKStatus();
}
}
- return new Status(IStatus.ERROR, JptJpaUiPlugin.PLUGIN_ID, ""); //$NON-NLS-1$
+ return JptJpaUiPlugin.instance().buildErrorStatus();
}
}
@@ -206,7 +204,7 @@ public class ArchiveFileSelectionDialog
}
}
catch (CoreException ce) {
- JptJpaUiPlugin.log(ce);
+ JptJpaUiPlugin.instance().logError(ce);
}
return null;
@@ -214,7 +212,7 @@ public class ArchiveFileSelectionDialog
protected String calculatePersistenceRootRelativePath(IVirtualFile vFile) {
IProject project = vFile.getProject();
- IPath puRootPath = JptJpaCorePlugin.getJarRuntimeRootPath(project);
+ IPath puRootPath = ProjectTools.getJarRuntimeRootPath(project);
IPath path = vFile.getRuntimePath().makeRelativeTo(puRootPath);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/PersistenceUnitClassesComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/PersistenceUnitClassesComposite.java
index ae0f616427..38eebd7b38 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/PersistenceUnitClassesComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/PersistenceUnitClassesComposite.java
@@ -37,13 +37,16 @@ import org.eclipse.jpt.common.utility.model.value.ListValueModel;
import org.eclipse.jpt.common.utility.model.value.ModifiableCollectionValueModel;
import org.eclipse.jpt.common.utility.model.value.ModifiablePropertyValueModel;
import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
+import org.eclipse.jpt.jpa.core.context.PersistentType;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
import org.eclipse.jpt.jpa.core.context.persistence.ClassRef;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
+import org.eclipse.jpt.jpa.ui.JpaPlatformUi;
+import org.eclipse.jpt.jpa.ui.details.MappingUiDefinition;
import org.eclipse.jpt.jpa.ui.internal.JpaHelpContextIds;
-import org.eclipse.jpt.jpa.ui.internal.JpaMappingImageHelper;
import org.eclipse.jpt.jpa.ui.internal.JptUiIcons;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
@@ -229,17 +232,25 @@ public class PersistenceUnitClassesComposite extends Pane<PersistenceUnit>
public Image getImage(Object element) {
ClassRef classRef = (ClassRef) element;
JavaPersistentType persistentType = classRef.getJavaPersistentType();
- Image image = null;
-
if (persistentType != null) {
- image = JpaMappingImageHelper.imageForTypeMapping(persistentType.getMappingKey());
+ String mappingKey = persistentType.getMappingKey();
+ if (mappingKey != null) {
+ return this.getImage(persistentType, mappingKey);
+ }
}
+ return JptJpaUiPlugin.instance().getImage(JptUiIcons.WARNING);
+ }
- if (image != null) {
- return image;
- }
+ private Image getImage(JavaPersistentType persistentType, String mappingKey) {
+ return this.getTypeMappingUiDefinition(persistentType, mappingKey).getImage();
+ }
+
+ private MappingUiDefinition<PersistentType, ? extends TypeMapping> getTypeMappingUiDefinition(JavaPersistentType persistentType, String mappingKey) {
+ return this.getJpaPlatformUi(persistentType).getTypeMappingUiDefinition(persistentType.getResourceType(), mappingKey);
+ }
- return JptJpaUiPlugin.getImage(JptUiIcons.WARNING);
+ private JpaPlatformUi getJpaPlatformUi(JavaPersistentType persistentType) {
+ return (JpaPlatformUi) persistentType.getJpaPlatform().getAdapter(JpaPlatformUi.class);
}
@Override
@@ -306,7 +317,7 @@ public class PersistenceUnitClassesComposite extends Pane<PersistenceUnit>
);
}
catch (JavaModelException e) {
- JptJpaUiPlugin.log(e);
+ JptJpaUiPlugin.instance().logError(e);
return null;
}
@@ -328,7 +339,7 @@ public class PersistenceUnitClassesComposite extends Pane<PersistenceUnit>
return getSubject().getJpaProject().getJavaProject().findType(className.replace('$', '.'));
}
catch (JavaModelException e) {
- JptJpaUiPlugin.log(e);
+ JptJpaUiPlugin.instance().logError(e);
}
}
@@ -345,10 +356,10 @@ public class PersistenceUnitClassesComposite extends Pane<PersistenceUnit>
JavaUI.openInEditor(javaElement, true, true);
}
catch (PartInitException e) {
- JptJpaUiPlugin.log(e);
+ JptJpaUiPlugin.instance().logError(e);
}
catch (JavaModelException e) {
- JptJpaUiPlugin.log(e);
+ JptJpaUiPlugin.instance().logError(e);
}
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/PersistenceUnitJarFilesComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/PersistenceUnitJarFilesComposite.java
index 73de8285cc..dc7a9d4f83 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/PersistenceUnitJarFilesComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/PersistenceUnitJarFilesComposite.java
@@ -14,8 +14,8 @@ import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.window.Window;
import org.eclipse.jpt.common.ui.internal.widgets.AddRemoveListPane;
-import org.eclipse.jpt.common.ui.internal.widgets.Pane;
import org.eclipse.jpt.common.ui.internal.widgets.AddRemovePane.Adapter;
+import org.eclipse.jpt.common.ui.internal.widgets.Pane;
import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.common.utility.internal.model.value.ItemPropertyListValueModelAdapter;
import org.eclipse.jpt.common.utility.internal.model.value.ListAspectAdapter;
@@ -26,9 +26,9 @@ import org.eclipse.jpt.common.utility.model.value.ModifiableCollectionValueModel
import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
import org.eclipse.jpt.jpa.core.context.persistence.JarFileRef;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
import org.eclipse.jpt.jpa.ui.internal.JpaHelpContextIds;
import org.eclipse.jpt.jpa.ui.internal.JptUiIcons;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
@@ -136,7 +136,7 @@ public abstract class PersistenceUnitJarFilesComposite
return new LabelProvider() {
@Override
public Image getImage(Object element) {
- return JptJpaUiPlugin.getImage(JptUiIcons.JAR_FILE_REF);
+ return JptJpaUiPlugin.instance().getImage(JptUiIcons.JAR_FILE_REF);
}
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/PersistenceUnitMappingFilesComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/PersistenceUnitMappingFilesComposite.java
index 6a14546b4f..201a722537 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/PersistenceUnitMappingFilesComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/PersistenceUnitMappingFilesComposite.java
@@ -14,7 +14,6 @@ import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.window.Window;
@@ -30,13 +29,13 @@ import org.eclipse.jpt.common.utility.model.value.CollectionValueModel;
import org.eclipse.jpt.common.utility.model.value.ListValueModel;
import org.eclipse.jpt.common.utility.model.value.ModifiableCollectionValueModel;
import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
+import org.eclipse.jpt.jpa.core.resource.ResourceMappingFile;
import org.eclipse.jpt.jpa.ui.internal.JpaHelpContextIds;
import org.eclipse.jpt.jpa.ui.internal.JptUiIcons;
import org.eclipse.jpt.jpa.ui.internal.jface.XmlMappingFileViewerFilter;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
@@ -86,7 +85,7 @@ public abstract class PersistenceUnitMappingFilesComposite
dialog.setValidator(buildValidator());
dialog.setTitle(JptUiPersistenceMessages.PersistenceUnitMappingFilesComposite_mappingFileDialog_title);
dialog.setMessage(JptUiPersistenceMessages.PersistenceUnitMappingFilesComposite_mappingFileDialog_message);
- dialog.addFilter(new XmlMappingFileViewerFilter(getSubject().getJpaProject(), JptJpaCorePlugin.MAPPING_FILE_CONTENT_TYPE));
+ dialog.addFilter(new XmlMappingFileViewerFilter(getSubject().getJpaProject(), ResourceMappingFile.Root.CONTENT_TYPE));
dialog.setInput(getSubject().getJpaProject().getProject());
dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
@@ -136,7 +135,7 @@ public abstract class PersistenceUnitMappingFilesComposite
return new LabelProvider() {
@Override
public Image getImage(Object element) {
- return JptJpaUiPlugin.getImage(JptUiIcons.MAPPING_FILE_REF);
+ return JptJpaUiPlugin.instance().getImage(JptUiIcons.MAPPING_FILE_REF);
}
@Override
@@ -187,17 +186,17 @@ public abstract class PersistenceUnitMappingFilesComposite
public IStatus validate(Object[] selection) {
if (selection.length == 0) {
- return new Status(IStatus.ERROR, JptJpaUiPlugin.PLUGIN_ID, "");
+ return JptJpaUiPlugin.instance().buildErrorStatus();
}
for (Object item : selection) {
if (item instanceof IFolder) {
- return new Status(IStatus.ERROR, JptJpaUiPlugin.PLUGIN_ID, "");
+ return JptJpaUiPlugin.instance().buildErrorStatus();
}
}
- return new Status(IStatus.OK, JptJpaUiPlugin.PLUGIN_ID, "");
+ return JptJpaUiPlugin.instance().buildOKStatus();
}
};
}
-} \ No newline at end of file
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/PersistenceXmlUiDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/PersistenceXmlUiDefinition.java
index 26ce655779..249e2aa6dd 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/PersistenceXmlUiDefinition.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/PersistenceXmlUiDefinition.java
@@ -12,7 +12,7 @@ package org.eclipse.jpt.jpa.ui.internal.persistence;
import org.eclipse.jpt.common.core.JptResourceType;
import org.eclipse.jpt.common.ui.internal.jface.SimpleItemTreeStateProviderFactoryProvider;
import org.eclipse.jpt.common.ui.jface.ItemTreeStateProviderFactoryProvider;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.GenericPersistenceXmlDefinition;
import org.eclipse.jpt.jpa.ui.ResourceUiDefinition;
import org.eclipse.jpt.jpa.ui.internal.structure.PersistenceStructureItemContentProviderFactory;
import org.eclipse.jpt.jpa.ui.internal.structure.PersistenceStructureItemLabelProviderFactory;
@@ -46,7 +46,7 @@ public class PersistenceXmlUiDefinition
}
public boolean providesUi(JptResourceType resourceType) {
- return resourceType.equals(JptJpaCorePlugin.PERSISTENCE_XML_1_0_RESOURCE_TYPE);
+ return resourceType.equals(GenericPersistenceXmlDefinition.instance().getResourceType());
}
public ItemTreeStateProviderFactoryProvider getStructureViewFactoryProvider() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/JpaPlatformUiRegistry.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/JpaPlatformUiRegistry.java
index 5d617afb1f..33eeed1514 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/JpaPlatformUiRegistry.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/JpaPlatformUiRegistry.java
@@ -1,11 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2006, 2009 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: Oracle. - initial API and implementation
- *******************************************************************************/
+ * Copyright (c) 2006, 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
package org.eclipse.jpt.jpa.ui.internal.platform;
import java.util.HashMap;
@@ -22,7 +23,7 @@ import org.eclipse.jpt.common.utility.internal.iterators.CompositeIterator;
import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator;
import org.eclipse.jpt.jpa.ui.JpaPlatformUi;
import org.eclipse.jpt.jpa.ui.JpaPlatformUiFactory;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
public class JpaPlatformUiRegistry
{
@@ -136,7 +137,7 @@ public class JpaPlatformUiRegistry
private Iterator<IConfigurationElement> allConfigElements() {
IExtensionRegistry registry = Platform.getExtensionRegistry();
IExtensionPoint extensionPoint =
- registry.getExtensionPoint(JptJpaUiPlugin.PLUGIN_ID, EXTENSION_ID);
+ registry.getExtensionPoint(JptJpaUiPlugin.instance().getPluginID(), EXTENSION_ID);
IExtension[] extensions = extensionPoint.getExtensions();
return new CompositeIterator<IConfigurationElement>(
@@ -159,7 +160,7 @@ public class JpaPlatformUiRegistry
+ "\" is missing a required attribute \""
+ attributeName
+ "\".";
- JptJpaUiPlugin.log(message);
+ JptJpaUiPlugin.instance().logError(message);
}
// TODO externalize strings
@@ -172,7 +173,7 @@ public class JpaPlatformUiRegistry
+ otherConfigElement.getContributor().getName()
+ "\" have registered a duplicate attribute \"id\" "
+ "for the extension element \"jpaPlatformUi\".";
- JptJpaUiPlugin.log(message);
+ JptJpaUiPlugin.instance().logError(message);
}
// TODO externalize strings
@@ -185,6 +186,6 @@ public class JpaPlatformUiRegistry
+ "\" in the plugin \""
+ configElement.getContributor().getName()
+ "\".";
- JptJpaUiPlugin.log(message);
+ JptJpaUiPlugin.instance().logError(message);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/base/AbstractJpaPlatformUi.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/base/AbstractJpaPlatformUi.java
index 8617a8ee85..64f96c433e 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/base/AbstractJpaPlatformUi.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/base/AbstractJpaPlatformUi.java
@@ -9,7 +9,6 @@
******************************************************************************/
package org.eclipse.jpt.jpa.ui.internal.platform.base;
-import java.util.Iterator;
import java.util.ListIterator;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -30,7 +29,6 @@ import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
import org.eclipse.jpt.jpa.core.context.TypeMapping;
import org.eclipse.jpt.jpa.ui.JpaPlatformUi;
import org.eclipse.jpt.jpa.ui.JpaPlatformUiProvider;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
import org.eclipse.jpt.jpa.ui.MappingResourceUiDefinition;
import org.eclipse.jpt.jpa.ui.ResourceUiDefinition;
import org.eclipse.jpt.jpa.ui.details.DefaultMappingUiDefinition;
@@ -38,6 +36,7 @@ import org.eclipse.jpt.jpa.ui.details.JpaComposite;
import org.eclipse.jpt.jpa.ui.details.JpaDetailsPageManager;
import org.eclipse.jpt.jpa.ui.details.JpaDetailsProvider;
import org.eclipse.jpt.jpa.ui.details.MappingUiDefinition;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
import org.eclipse.jpt.jpa.ui.internal.wizards.conversion.java.JavaMetadataConversionWizard;
import org.eclipse.jpt.jpa.ui.internal.wizards.conversion.java.JavaMetadataConversionWizardPage;
import org.eclipse.swt.widgets.Composite;
@@ -47,10 +46,10 @@ public abstract class AbstractJpaPlatformUi
implements JpaPlatformUi
{
private final ItemTreeStateProviderFactoryProvider navigatorFactoryProvider;
-
+
private final JpaPlatformUiProvider platformUiProvider;
-
-
+
+
protected AbstractJpaPlatformUi(
ItemTreeStateProviderFactoryProvider navigatorFactoryProvider,
JpaPlatformUiProvider platformUiProvider
@@ -62,105 +61,114 @@ public abstract class AbstractJpaPlatformUi
this.navigatorFactoryProvider = navigatorFactoryProvider;
this.platformUiProvider = platformUiProvider;
}
-
-
+
+
// ********** navigator provider **********
-
+
public ItemTreeStateProviderFactoryProvider getNavigatorFactoryProvider() {
return this.navigatorFactoryProvider;
}
-
-
+
+
// ********** structure view factory providers **********
-
+
public ItemTreeStateProviderFactoryProvider getStructureViewFactoryProvider(JpaFile jpaFile) {
JptResourceType resourceType = jpaFile.getResourceModel().getResourceType();
return (resourceType == null) ? null : this.getStructureViewFactoryProvider(resourceType);
}
-
+
protected ItemTreeStateProviderFactoryProvider getStructureViewFactoryProvider(JptResourceType resourceType) {
try {
return this.getResourceUiDefinition(resourceType).getStructureViewFactoryProvider();
} catch (IllegalArgumentException iae) {
- JptJpaUiPlugin.log(iae);
+ JptJpaUiPlugin.instance().logError(iae);
return null;
}
}
-
-
+
+
// ********** details providers **********
-
+
public JpaDetailsPageManager<? extends JpaStructureNode> buildJpaDetailsPageManager(
Composite parent, JpaStructureNode structureNode, WidgetFactory widgetFactory) {
-
- JpaDetailsProvider jpaDetailsProvider = getDetailsProvider(structureNode);
+
+ JpaDetailsProvider jpaDetailsProvider = this.getDetailsProvider(structureNode);
return jpaDetailsProvider == null ? null : jpaDetailsProvider.buildDetailsPageManager(parent, widgetFactory);
}
-
+
protected JpaDetailsProvider getDetailsProvider(JpaStructureNode structureNode) {
- for (JpaDetailsProvider provider : CollectionTools.iterable(this.detailsProviders())) {
+ for (JpaDetailsProvider provider : this.getDetailsProviders()) {
if (provider.providesDetails(structureNode)) {
return provider;
}
}
return null;//return null, some structure nodes do not have a details page
}
-
- protected ListIterator<JpaDetailsProvider> detailsProviders() {
- return this.platformUiProvider.detailsProviders();
+
+ protected Iterable<JpaDetailsProvider> getDetailsProviders() {
+ return this.platformUiProvider.getDetailsProviders();
}
-
-
- // ********** mapping ui definitions **********
-
+
+
+ // ********** type mappings **********
+
public JpaComposite buildTypeMappingComposite(
- JptResourceType resourceType,
- String mappingKey,
- Composite parent,
- PropertyValueModel<TypeMapping> mappingHolder,
- WidgetFactory widgetFactory) {
-
- return getMappingResourceUiDefinition(resourceType).buildTypeMappingComposite(
- mappingKey, mappingHolder, parent, widgetFactory);
- }
-
- public JpaComposite buildAttributeMappingComposite(
- JptResourceType resourceType,
- String mappingKey,
- Composite parent,
- PropertyValueModel<AttributeMapping> mappingHolder,
- PropertyValueModel<Boolean> enabledModel,
- WidgetFactory widgetFactory) {
-
- return getMappingResourceUiDefinition(resourceType).buildAttributeMappingComposite(
- mappingKey, mappingHolder, enabledModel, parent, widgetFactory);
+ JptResourceType resourceType,
+ String mappingKey,
+ Composite parent,
+ PropertyValueModel<TypeMapping> mappingHolder,
+ WidgetFactory widgetFactory
+ ) {
+ return this.getMappingResourceUiDefinition(resourceType).buildTypeMappingComposite(mappingKey, mappingHolder, parent, widgetFactory);
}
-
- public DefaultMappingUiDefinition<ReadOnlyPersistentAttribute, ? extends AttributeMapping> getDefaultAttributeMappingUiDefinition(JptResourceType resourceType, String mappingKey) {
- return getMappingResourceUiDefinition(resourceType).getDefaultAttributeMappingUiDefinition(mappingKey);
+
+ public Iterable<MappingUiDefinition<PersistentType, ? extends TypeMapping>> getTypeMappingUiDefinitions(JptResourceType resourceType) {
+ return this.getMappingResourceUiDefinition(resourceType).getTypeMappingUiDefinitions();
}
-
- public Iterator<MappingUiDefinition<ReadOnlyPersistentAttribute, ? extends AttributeMapping>> attributeMappingUiDefinitions(JptResourceType resourceType) {
- return getMappingResourceUiDefinition(resourceType).attributeMappingUiDefinitions();
+
+ public MappingUiDefinition<PersistentType, ? extends TypeMapping> getTypeMappingUiDefinition(JptResourceType resourceType, String mappingKey) {
+ return this.getMappingResourceUiDefinition(resourceType).getTypeMappingUiDefinition(mappingKey);
}
-
+
public DefaultMappingUiDefinition<PersistentType, ? extends TypeMapping> getDefaultTypeMappingUiDefinition(JptResourceType resourceType) {
- return getMappingResourceUiDefinition(resourceType).getDefaultTypeMappingUiDefinition();
+ return this.getMappingResourceUiDefinition(resourceType).getDefaultTypeMappingUiDefinition();
}
-
- public Iterator<MappingUiDefinition<PersistentType, ? extends TypeMapping>> typeMappingUiDefinitions(JptResourceType resourceType) {
- return getMappingResourceUiDefinition(resourceType).typeMappingUiDefinitions();
+
+
+ // ********** attribute mappings **********
+
+ public JpaComposite buildAttributeMappingComposite(
+ JptResourceType resourceType,
+ String mappingKey,
+ Composite parent,
+ PropertyValueModel<AttributeMapping> mappingHolder,
+ PropertyValueModel<Boolean> enabledModel,
+ WidgetFactory widgetFactory
+ ) {
+ return this.getMappingResourceUiDefinition(resourceType).buildAttributeMappingComposite(mappingKey, mappingHolder, enabledModel, parent, widgetFactory);
}
-
-
+
+ public Iterable<MappingUiDefinition<ReadOnlyPersistentAttribute, ? extends AttributeMapping>> getAttributeMappingUiDefinitions(JptResourceType resourceType) {
+ return this.getMappingResourceUiDefinition(resourceType).getAttributeMappingUiDefinitions();
+ }
+
+ public MappingUiDefinition<ReadOnlyPersistentAttribute, ? extends AttributeMapping> getAttributeMappingUiDefinition(JptResourceType resourceType, String mappingKey) {
+ return this.getMappingResourceUiDefinition(resourceType).getAttributeMappingUiDefinition(mappingKey);
+ }
+
+ public DefaultMappingUiDefinition<ReadOnlyPersistentAttribute, ? extends AttributeMapping> getDefaultAttributeMappingUiDefinition(JptResourceType resourceType, String mappingKey) {
+ return this.getMappingResourceUiDefinition(resourceType).getDefaultAttributeMappingUiDefinition(mappingKey);
+ }
+
+
// ********** resource ui definitions **********
-
- protected ListIterator<ResourceUiDefinition> resourceUiDefinitions() {
- return this.platformUiProvider.resourceUiDefinitions();
+
+ protected Iterable<ResourceUiDefinition> getResourceUiDefinitions() {
+ return this.platformUiProvider.getResourceUiDefinitions();
}
-
+
public ResourceUiDefinition getResourceUiDefinition(JptResourceType resourceType) {
- for (ResourceUiDefinition definition : CollectionTools.iterable(this.resourceUiDefinitions())) {
+ for (ResourceUiDefinition definition : this.getResourceUiDefinitions()) {
if (definition.providesUi(resourceType)) {
return definition;
}
@@ -168,8 +176,8 @@ public abstract class AbstractJpaPlatformUi
// TODO (bug 313632) - return a null resource ui definition?
throw new IllegalArgumentException("No resource UI definition for the resource type: " + resourceType); //$NON-NLS-1$
}
-
- public MappingResourceUiDefinition getMappingResourceUiDefinition(JptResourceType resourceType) {
+
+ protected MappingResourceUiDefinition getMappingResourceUiDefinition(JptResourceType resourceType) {
ResourceUiDefinition def = this.getResourceUiDefinition(resourceType);
try {
return (MappingResourceUiDefinition) def;
@@ -178,23 +186,23 @@ public abstract class AbstractJpaPlatformUi
throw new IllegalArgumentException("No mapping resource UI definition for the resource type: " + resourceType, cce); //$NON-NLS-1$
}
}
-
-
+
+
// ********** entity generation **********
-
+
public void generateEntities(JpaProject project, IStructuredSelection selection) {
EntitiesGenerator.generate(project, selection);
}
-
-
+
+
// ********** convenience methods **********
-
+
protected void displayMessage(String title, String message) {
MessageDialog.openInformation(SWTUtil.getShell(), title, message);
}
protected void openInDialog(JavaMetadataConversionWizardPage wizardPage) {
- openInDialog(new JavaMetadataConversionWizard(wizardPage));
+ this.openInDialog(new JavaMetadataConversionWizard(wizardPage));
}
protected void openInDialog(IWizard wizard) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/ClassRefItemLabelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/ClassRefItemLabelProvider.java
index e13eaa0ab1..f7360811ec 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/ClassRefItemLabelProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/ClassRefItemLabelProvider.java
@@ -14,8 +14,8 @@ import org.eclipse.jpt.common.ui.jface.ItemLabelProvider;
import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapter;
import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
import org.eclipse.jpt.jpa.core.context.persistence.ClassRef;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
import org.eclipse.jpt.jpa.ui.internal.JptUiIcons;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
import org.eclipse.swt.graphics.Image;
public class ClassRefItemLabelProvider
@@ -34,9 +34,7 @@ public class ClassRefItemLabelProvider
}
protected Image buildImage() {
- return this.item.isVirtual() ?
- JptUiIcons.ghost(JptUiIcons.CLASS_REF) :
- JptJpaUiPlugin.getImage(JptUiIcons.CLASS_REF);
+ return JptJpaUiPlugin.instance().getImage(JptUiIcons.CLASS_REF, this.item.isVirtual());
}
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/GenericNavigatorItemLabelProviderFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/GenericNavigatorItemLabelProviderFactory.java
index 49676a4336..56b836bd63 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/GenericNavigatorItemLabelProviderFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/GenericNavigatorItemLabelProviderFactory.java
@@ -20,8 +20,8 @@ import org.eclipse.jpt.jpa.core.context.java.JarFile;
import org.eclipse.jpt.jpa.core.context.orm.OrmXml;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
import org.eclipse.jpt.jpa.ui.internal.JptUiIcons;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
/**
* This factory builds item label providers for the JPA content in the
@@ -105,7 +105,7 @@ public class GenericNavigatorItemLabelProviderFactory
protected ItemExtendedLabelProvider buildResourceItemLabelProvider(IResource resource, String imageKey) {
return new StaticItemExtendedLabelProvider(
- JptJpaUiPlugin.getImage(imageKey),
+ JptJpaUiPlugin.instance().getImage(imageKey),
resource.getName(),
this.buildResourceDescription(resource)
);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/JarFileRefItemLabelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/JarFileRefItemLabelProvider.java
index ed19a519c4..96c3b0395c 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/JarFileRefItemLabelProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/JarFileRefItemLabelProvider.java
@@ -14,8 +14,8 @@ import org.eclipse.jpt.common.ui.jface.ItemLabelProvider;
import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapter;
import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
import org.eclipse.jpt.jpa.core.context.persistence.JarFileRef;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
import org.eclipse.jpt.jpa.ui.internal.JptUiIcons;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
import org.eclipse.swt.graphics.Image;
public class JarFileRefItemLabelProvider
@@ -34,7 +34,7 @@ public class JarFileRefItemLabelProvider
}
protected Image buildImage() {
- return JptJpaUiPlugin.getImage(JptUiIcons.JAR_FILE_REF);
+ return JptJpaUiPlugin.instance().getImage(JptUiIcons.JAR_FILE_REF);
}
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/MappingFileRefItemLabelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/MappingFileRefItemLabelProvider.java
index 1a16a48ba6..7c24dd160c 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/MappingFileRefItemLabelProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/MappingFileRefItemLabelProvider.java
@@ -14,8 +14,8 @@ import org.eclipse.jpt.common.ui.jface.ItemLabelProvider;
import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapter;
import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
import org.eclipse.jpt.jpa.ui.internal.JptUiIcons;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
import org.eclipse.swt.graphics.Image;
public class MappingFileRefItemLabelProvider
@@ -34,9 +34,7 @@ public class MappingFileRefItemLabelProvider
}
protected Image buildImage() {
- return this.item.isImplied() ?
- JptUiIcons.ghost(JptUiIcons.MAPPING_FILE_REF) :
- JptJpaUiPlugin.getImage(JptUiIcons.MAPPING_FILE_REF);
+ return JptJpaUiPlugin.instance().getImage(JptUiIcons.MAPPING_FILE_REF, this.item.isDefault());
}
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/OrmXmlItemContentProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/OrmXmlItemContentProvider.java
index 2153137241..90e12d3e2f 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/OrmXmlItemContentProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/OrmXmlItemContentProvider.java
@@ -15,7 +15,7 @@ import org.eclipse.jpt.common.utility.internal.model.value.ListAspectAdapter;
import org.eclipse.jpt.common.utility.internal.model.value.ListCollectionValueModelAdapter;
import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapter;
import org.eclipse.jpt.common.utility.model.value.CollectionValueModel;
-import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
+import org.eclipse.jpt.jpa.core.context.XmlFile;
import org.eclipse.jpt.jpa.core.context.orm.EntityMappings;
import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
import org.eclipse.jpt.jpa.core.context.orm.OrmXml;
@@ -59,7 +59,7 @@ public class OrmXmlItemContentProvider
extends PropertyAspectAdapter<OrmXml, EntityMappings>
{
public EntityMappingsModel(OrmXml subject) {
- super(OrmXml.ROOT_PROPERTY, subject);
+ super(XmlFile.ROOT_PROPERTY, subject);
}
@Override
protected EntityMappings buildValue_() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/PersistenceUnitItemLabelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/PersistenceUnitItemLabelProvider.java
index 56a2990a1a..492f2909ad 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/PersistenceUnitItemLabelProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/PersistenceUnitItemLabelProvider.java
@@ -17,8 +17,8 @@ import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapter
import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
import org.eclipse.jpt.jpa.core.context.JpaContextNode;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
import org.eclipse.jpt.jpa.ui.internal.JptUiIcons;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
import org.eclipse.swt.graphics.Image;
public class PersistenceUnitItemLabelProvider
@@ -37,7 +37,7 @@ public class PersistenceUnitItemLabelProvider
}
protected Image buildImage() {
- return JptJpaUiPlugin.getImage(JptUiIcons.PERSISTENCE_UNIT);
+ return JptJpaUiPlugin.instance().getImage(JptUiIcons.PERSISTENCE_UNIT);
}
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/PersistenceXmlItemContentProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/PersistenceXmlItemContentProvider.java
index a84ff17038..d4e6ac0748 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/PersistenceXmlItemContentProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/PersistenceXmlItemContentProvider.java
@@ -16,6 +16,7 @@ import org.eclipse.jpt.common.utility.internal.model.value.ListCollectionValueMo
import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapter;
import org.eclipse.jpt.common.utility.model.value.CollectionValueModel;
import org.eclipse.jpt.jpa.core.context.JpaRootContextNode;
+import org.eclipse.jpt.jpa.core.context.XmlFile;
import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
@@ -58,11 +59,11 @@ public class PersistenceXmlItemContentProvider
extends PropertyAspectAdapter<PersistenceXml, Persistence>
{
public PersistenceModel(PersistenceXml subject) {
- super(PersistenceXml.PERSISTENCE_PROPERTY, subject);
+ super(XmlFile.ROOT_PROPERTY, subject);
}
@Override
protected Persistence buildValue_() {
- return this.subject.getPersistence();
+ return this.subject.getRoot();
}
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/PersistentAttributeItemLabelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/PersistentAttributeItemLabelProvider.java
index cffa203c34..50a1adb2c9 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/PersistentAttributeItemLabelProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/PersistentAttributeItemLabelProvider.java
@@ -11,11 +11,15 @@ package org.eclipse.jpt.jpa.ui.internal.platform.generic;
import org.eclipse.jpt.common.ui.internal.jface.AbstractItemExtendedLabelProvider;
import org.eclipse.jpt.common.ui.jface.ItemLabelProvider;
+import org.eclipse.jpt.common.utility.internal.Transformer;
+import org.eclipse.jpt.common.utility.internal.TransformerAdapter;
import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapter;
+import org.eclipse.jpt.common.utility.internal.model.value.TransformationPropertyValueModel;
import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
+import org.eclipse.jpt.jpa.core.context.AttributeMapping;
import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
-import org.eclipse.jpt.jpa.ui.internal.JpaMappingImageHelper;
-import org.eclipse.jpt.jpa.ui.internal.JptUiIcons;
+import org.eclipse.jpt.jpa.ui.JpaPlatformUi;
+import org.eclipse.jpt.jpa.ui.details.MappingUiDefinition;
import org.eclipse.swt.graphics.Image;
public class PersistentAttributeItemLabelProvider
@@ -25,26 +29,58 @@ public class PersistentAttributeItemLabelProvider
super(persistentAttribute, manager);
}
+
+ // ********** image **********
+
@Override
protected PropertyValueModel<Image> buildImageModel() {
- return new ImageModel(this.item);
+ return new TransformationPropertyValueModel<AttributeMapping, Image>(this.buildMappingModel(), IMAGE_TRANSFORMER);
}
- protected static class ImageModel
- extends PropertyAspectAdapter<ReadOnlyPersistentAttribute, Image>
+ protected PropertyValueModel<AttributeMapping> buildMappingModel() {
+ return new MappingModel(this.item);
+ }
+
+ protected static class MappingModel
+ extends PropertyAspectAdapter<ReadOnlyPersistentAttribute, AttributeMapping>
{
- public ImageModel(ReadOnlyPersistentAttribute subject) {
+ public MappingModel(ReadOnlyPersistentAttribute subject) {
super(ReadOnlyPersistentAttribute.MAPPING_PROPERTY, subject);
}
@Override
- protected Image buildValue_() {
- String mappingKey = this.subject.getMappingKey();
- return this.subject.isVirtual() ?
- JptUiIcons.ghost(JpaMappingImageHelper.iconKeyForAttributeMapping(mappingKey)) :
- JpaMappingImageHelper.imageForAttributeMapping(mappingKey);
+ protected AttributeMapping buildValue_() {
+ return this.subject.getMapping();
+ }
+ }
+
+ protected static final Transformer<AttributeMapping, Image> IMAGE_TRANSFORMER = new ImageTransformer();
+
+ /**
+ * Transform an attribute mapping into the appropriate image.
+ */
+ protected static class ImageTransformer
+ extends TransformerAdapter<AttributeMapping, Image>
+ {
+ @Override
+ public Image transform(AttributeMapping attributeMapping) {
+ MappingUiDefinition<? extends ReadOnlyPersistentAttribute, ?> definition = this.getAttributeMappingUiDefinition(attributeMapping);
+ return attributeMapping.getPersistentAttribute().isVirtual() ?
+ definition.getGhostImage() :
+ definition.getImage();
+ }
+
+ private MappingUiDefinition<? extends ReadOnlyPersistentAttribute, ?> getAttributeMappingUiDefinition(AttributeMapping attributeMapping) {
+ return this.getJpaPlatformUi(attributeMapping).getAttributeMappingUiDefinition(attributeMapping.getResourceType(), attributeMapping.getKey());
+ }
+
+ private JpaPlatformUi getJpaPlatformUi(AttributeMapping attributeMapping) {
+ return (JpaPlatformUi) attributeMapping.getJpaProject().getJpaPlatform().getAdapter(JpaPlatformUi.class);
}
}
+
+ // ********** text **********
+
@Override
protected PropertyValueModel<String> buildTextModel() {
return new TextModel(this.item);
@@ -62,6 +98,9 @@ public class PersistentAttributeItemLabelProvider
}
}
+
+ // ********** description **********
+
@Override
@SuppressWarnings("unchecked")
protected PropertyValueModel<String> buildDescriptionModel() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/PersistentTypeItemLabelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/PersistentTypeItemLabelProvider.java
index f1742adf2b..9177d3680d 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/PersistentTypeItemLabelProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/PersistentTypeItemLabelProvider.java
@@ -11,10 +11,15 @@ package org.eclipse.jpt.jpa.ui.internal.platform.generic;
import org.eclipse.jpt.common.ui.internal.jface.AbstractItemExtendedLabelProvider;
import org.eclipse.jpt.common.ui.jface.ItemLabelProvider;
+import org.eclipse.jpt.common.utility.internal.Transformer;
+import org.eclipse.jpt.common.utility.internal.TransformerAdapter;
import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapter;
+import org.eclipse.jpt.common.utility.internal.model.value.TransformationPropertyValueModel;
import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
import org.eclipse.jpt.jpa.core.context.PersistentType;
-import org.eclipse.jpt.jpa.ui.internal.JpaMappingImageHelper;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
+import org.eclipse.jpt.jpa.ui.JpaPlatformUi;
+import org.eclipse.jpt.jpa.ui.details.MappingUiDefinition;
import org.eclipse.swt.graphics.Image;
public class PersistentTypeItemLabelProvider
@@ -24,23 +29,55 @@ public class PersistentTypeItemLabelProvider
super(persistentType, manager);
}
+
+ // ********** image **********
+
@Override
protected PropertyValueModel<Image> buildImageModel() {
- return new ImageModel(this.item);
+ return new TransformationPropertyValueModel<TypeMapping, Image>(this.buildMappingModel(), IMAGE_TRANSFORMER);
}
- protected static class ImageModel
- extends PropertyAspectAdapter<PersistentType, Image>
+ protected PropertyValueModel<TypeMapping> buildMappingModel() {
+ return new MappingModel(this.item);
+ }
+
+ protected static class MappingModel
+ extends PropertyAspectAdapter<PersistentType, TypeMapping>
{
- public ImageModel(PersistentType subject) {
+ public MappingModel(PersistentType subject) {
super(PersistentType.MAPPING_PROPERTY, subject);
}
@Override
- protected Image buildValue_() {
- return JpaMappingImageHelper.imageForTypeMapping(this.subject.getMappingKey());
+ protected TypeMapping buildValue_() {
+ return this.subject.getMapping();
}
}
-
+
+ protected static final Transformer<TypeMapping, Image> IMAGE_TRANSFORMER = new ImageTransformer();
+
+ /**
+ * Transform a type mapping into the appropriate image.
+ */
+ protected static class ImageTransformer
+ extends TransformerAdapter<TypeMapping, Image>
+ {
+ @Override
+ public Image transform(TypeMapping typeMapping) {
+ return this.getTypeMappingUiDefinition(typeMapping).getImage();
+ }
+
+ private MappingUiDefinition<? extends PersistentType, ?> getTypeMappingUiDefinition(TypeMapping typeMapping) {
+ return this.getJpaPlatformUi(typeMapping).getTypeMappingUiDefinition(typeMapping.getResourceType(), typeMapping.getKey());
+ }
+
+ private JpaPlatformUi getJpaPlatformUi(TypeMapping typeMapping) {
+ return (JpaPlatformUi) typeMapping.getJpaProject().getJpaPlatform().getAdapter(JpaPlatformUi.class);
+ }
+ }
+
+
+ // ********** text **********
+
@Override
protected PropertyValueModel<String> buildTextModel() {
return new TextModel(this.item);
@@ -58,6 +95,9 @@ public class PersistentTypeItemLabelProvider
}
}
+
+ // ********** description **********
+
@Override
@SuppressWarnings("unchecked")
protected PropertyValueModel<String> buildDescriptionModel() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/JptJpaUiPlugin.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/plugin/JptJpaUiPlugin.java
index ce51a43065..f52a36aaed 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/JptJpaUiPlugin.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/plugin/JptJpaUiPlugin.java
@@ -7,21 +7,20 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.jpa.ui;
+package org.eclipse.jpt.jpa.ui.internal.plugin;
import org.eclipse.core.resources.ResourcesPlugin;
-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.JptUIPlugin;
import org.eclipse.jpt.common.utility.internal.AbstractBooleanReference;
+import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.jpa.core.JpaProjectManager;
+import org.eclipse.jpt.jpa.core.JpaWorkspace;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
-import org.osgi.framework.BundleContext;
/**
* Dali JPA UI plug-in.
@@ -32,7 +31,6 @@ import org.osgi.framework.BundleContext;
* pioneering adopters on the understanding that any code that uses this API
* will almost certainly be broken (repeatedly) as the API evolves.
*/
-@SuppressWarnings("nls")
public class JptJpaUiPlugin
extends JptUIPlugin
{
@@ -40,34 +38,8 @@ public class JptJpaUiPlugin
* @see #focusIn(Control)
*/
private final AsyncEventListenerFlag asyncEventListenerFlag = new AsyncEventListenerFlag();
- private final Listener focusListener;
-
-
- // ********** constants **********
-
- /**
- * The plug-in identifier of JPA UI support (value {@value}).
- */
- public static final String PLUGIN_ID = "org.eclipse.jpt.jpa.ui";
- public static final String PLUGIN_ID_ = PLUGIN_ID + '.';
-
- private static final String DALI_UI_KEY = PLUGIN_ID;
- private static final Object DALI_UI_DATA = new Object();
-
-
- // ********** Preference keys **********
- /**
- * The preference key used to retrieve the case used for JPQL identifiers.
- * @deprecated - Use JpaJpqlPreferencesManager instead
- */
- @Deprecated
- public static final String JPQL_IDENTIFIER_CASE_PREF_KEY = PLUGIN_ID + ".jpqlIdentifier.case";
- @Deprecated
- public static final String JPQL_IDENTIFIER_LOWERCASE_PREF_VALUE = "lowercase";
- @Deprecated
- public static final String JPQL_IDENTIFIER_UPPERCASE_PREF_VALUE = "uppercase";
- @Deprecated
- public static final String JPQL_IDENTIFIER_MATCH_FIRST_CHARACTER_CASE_PREF_KEY = PLUGIN_ID + ".jpqlIdentifier.matchFirstCharacterCase";
+ private Display display;
+ private final Listener focusListener = new FocusListener();
// ********** singleton **********
@@ -82,89 +54,82 @@ public class JptJpaUiPlugin
}
- // ********** logging **********
+ // ********** Dali plug-in **********
- /**
- * Log the specified message.
- */
- public static void log(String msg) {
- INSTANCE.logError(msg);
- }
+ public JptJpaUiPlugin() {
+ super();
+ }
- /**
- * Log the specified exception or error.
- */
- public static void log(Throwable throwable) {
- INSTANCE.logError(throwable);
+ @Override
+ protected void setInstance(JptPlugin plugin) {
+ INSTANCE = (JptJpaUiPlugin) plugin;
}
/**
- * Log the specified message and exception or error.
+ * Register our SWT listener with the display so we receive notification
+ * of every "focus in" event.
*/
- public static void log(String msg, Throwable throwable) {
- INSTANCE.logError(msg, throwable);
- }
+ @Override
+ public void start_() throws Exception {
+ super.start_();
+ // no leak here - the flag has no backpointer to the plug-in
+ this.getJpaProjectManager().addJavaEventListenerFlag(this.asyncEventListenerFlag);
+ // must be on UI thread...
+ this.display = Display.getCurrent();
+ // a little pre-construction leakage, but it should be OK as the listener
+ // interacts mostly with the 'asyncEventListenerFlag' and only once the
+ // plug-in is "active"
+ if ((this.display != null) && ( ! this.display.isDisposed())) {
+ this.display.addFilter(SWT.FocusIn, this.focusListener);
+ }
+ }
- // ********** images **********
+ private JpaProjectManager getJpaProjectManager() {
+ return this.getJpaWorkspace().getJpaProjectManager();
+ }
- /**
- * Return an image descriptor for the specified <code>.gif<code>
- * file in the icons folder.
- */
- public static ImageDescriptor getImageDescriptor(String key) {
- if ( ! key.startsWith("icons/")) {
- key = "icons/" + key;
- }
- if ( ! key.endsWith(".gif")) {
- key = key + ".gif";
- }
- return imageDescriptorFromPlugin(PLUGIN_ID, key);
+ private JpaWorkspace getJpaWorkspace() {
+ return (JpaWorkspace) ResourcesPlugin.getWorkspace().getAdapter(JpaWorkspace.class);
}
/**
- * Return an image for the specified <code>.gif<code>
- * file in the icons folder.
+ * Unregister our SWT listener with the display.
*/
- //TODO we are using the ImageRegistry here and storing all our icons for the life of the plugin,
- //which means until the workspace is closed. This is better than before where we constantly
- //created new images. Bug 306437 is about cleaning this up and using Local Resource Managers
- //on our views so that closing the JPA perspective would mean our icons are disposed.
- public static Image getImage(String key) {
- ImageRegistry imageRegistry = instance().getImageRegistry();
- Image image = imageRegistry.get(key);
- if (image == null) {
- imageRegistry.put(key, getImageDescriptor(key));
- image = imageRegistry.get(key);
+ @Override
+ public void stop_() throws Exception {
+ try {
+ // must be on UI thread...
+ if ((this.display != null) && ( ! this.display.isDisposed())) {
+ this.display.removeFilter(SWT.FocusIn, this.focusListener);
+ }
+ this.getJpaProjectManager().removeJavaEventListenerFlag(this.asyncEventListenerFlag);
+ } finally {
+ this.display = null;
+ super.stop_();
}
- return image;
}
- // ********** construction **********
-
- public JptJpaUiPlugin() {
- super();
- this.focusListener = this.buildFocusListener();
- if (INSTANCE != null) {
- throw new IllegalStateException();
- }
- INSTANCE = this;
- }
+ // ********** focus listener **********
/**
- * We are registered to receive only {@link SWT#FocusIn} events
+ * This listener is registered to receive only {@link SWT#FocusIn} events.
*/
- private Listener buildFocusListener() {
- return new Listener() {
- public void handleEvent(Event event) {
- JptJpaUiPlugin.this.focusIn((Control) event.widget);
- }
- };
+ /* CU private */ class FocusListener
+ implements Listener
+ {
+ public void handleEvent(Event event) {
+ JptJpaUiPlugin.this.focusIn((Control) event.widget);
+ }
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this);
+ }
}
- // ********** focus handling **********
+ // ********** focus event handling **********
/**
* This method is called whenever a {@link SWT#FocusIn} event is generated.
@@ -201,8 +166,12 @@ public class JptJpaUiPlugin
* @see #controlAffectsJavaSource(Control)
*/
private boolean controlIsDali(Control control) {
+ String id = this.getPluginID();
+ if (id == null) {
+ return false;
+ }
while (control != null) {
- if (control.getData(DALI_UI_KEY) == DALI_UI_DATA) {
+ if (control.getData(id) == DALI_UI_DATA) {
return true;
}
control = control.getParent();
@@ -218,40 +187,16 @@ public class JptJpaUiPlugin
* @see #controlIsDali(Control)
*/
public void controlAffectsJavaSource(Control control) {
- control.setData(DALI_UI_KEY, DALI_UI_DATA);
- }
-
-
- // ********** plug-in implementation **********
-
- /**
- * Register our SWT listener with the display so we receive notification
- * of every "focus in" event.
- */
- @Override
- public synchronized void start(BundleContext context) throws Exception {
- super.start(context);
- this.getJpaProjectManager().addJavaEventListenerFlag(this.asyncEventListenerFlag);
- Display.getDefault().addFilter(SWT.FocusIn, this.focusListener);
+ String id = this.getPluginID();
+ if (id != null) {
+ control.setData(id, DALI_UI_DATA);
+ }
}
- private JpaProjectManager getJpaProjectManager() {
- return (JpaProjectManager) ResourcesPlugin.getWorkspace().getAdapter(JpaProjectManager.class);
- }
+ private static final Object DALI_UI_DATA = new Object();
- /**
- * Unregister our SWT listener with the display.
- */
- @Override
- public synchronized void stop(BundleContext context) throws Exception {
- try {
- Display.getDefault().removeFilter(SWT.FocusIn, this.focusListener);
- this.getJpaProjectManager().removeJavaEventListenerFlag(this.asyncEventListenerFlag);
- } finally {
- super.stop(context);
- }
- }
+ // ********** async event listener flag **********
/**
* This flag's value depends on the current thread. If the current thread is
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/prefs/JpaEntityGenPreferencePage.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/prefs/JpaEntityGenPreferencePage.java
index 9f1dcd0dd9..b1e9b547fa 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/prefs/JpaEntityGenPreferencePage.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/prefs/JpaEntityGenPreferencePage.java
@@ -1,18 +1,18 @@
/*******************************************************************************
-* Copyright (c) 2012 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
+ * Copyright (c) 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
package org.eclipse.jpt.jpa.ui.internal.prefs;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.jpa.core.prefs.JpaEntityGenPreferencesManager;
+import org.eclipse.jpt.jpa.core.JpaPreferences;
import org.eclipse.jpt.jpa.ui.internal.JptUiMessages;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
@@ -26,7 +26,6 @@ import org.eclipse.ui.dialogs.PropertyPage;
public class JpaEntityGenPreferencePage extends PropertyPage {
- private JpaEntityGenPreferencesManager prefsManager;
private EntityGenComposite entityGenComposite;
// ********** constructors **********
@@ -49,7 +48,6 @@ public class JpaEntityGenPreferencePage extends PropertyPage {
@Override
protected Control createContents(Composite parent) {
- this.prefsManager = new JpaEntityGenPreferencesManager(this.getProject());
Composite composite = new Composite(parent, SWT.NULL);
composite.setLayout(new GridLayout());
@@ -62,13 +60,8 @@ public class JpaEntityGenPreferencePage extends PropertyPage {
// ********** preferences **********
private void updateProjectEntityGenPreferences() {
-
- if(StringTools.stringIsEmpty(this.getDefaultPackage())) {
- this.prefsManager.removeDefaultPackagePreference();
- }
- else {
- this.prefsManager.setDefaultPackagePreference(this.getDefaultPackage());
- }
+ String pkgName = this.getDefaultPackage();
+ JpaPreferences.setEntityGenDefaultPackageName(this.getProject(), (StringTools.stringIsNotEmpty(pkgName) ? pkgName : null));
}
// ********** internal methods **********
@@ -87,7 +80,7 @@ public class JpaEntityGenPreferencePage extends PropertyPage {
// ********** queries *********
private String getDefaultPackagePreference() {
- return this.prefsManager.getDefaultPackagePreference();
+ return JpaPreferences.getEntityGenDefaultPackageName(this.getProject());
}
// ********** EntityGenComposite **********
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/prefs/JpaPreferencesPage.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/prefs/JpaPreferencesPage.java
index d441aa41c6..d18cbafd86 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/prefs/JpaPreferencesPage.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/prefs/JpaPreferencesPage.java
@@ -14,10 +14,9 @@ import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.jpa.core.prefs.JpaEntityGenPreferencesManager;
-import org.eclipse.jpt.jpa.core.prefs.JpaJpqlPreferencesManager;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
+import org.eclipse.jpt.jpa.core.JpaPreferences;
import org.eclipse.jpt.jpa.ui.internal.JptUiMessages;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
@@ -88,19 +87,14 @@ public class JpaPreferencesPage extends PreferencePage
return parent;
}
- /**
- * {@inheritDoc}
- */
@Override
protected void performDefaults() {
// entitygen prefs
- String defaultPackage = JpaEntityGenPreferencesManager.getDefaultDefaultPackage();
- this.setDefaultPackage(defaultPackage);
- JpaEntityGenPreferencesManager.setDefaultPackageWorkspacePreference(defaultPackage);
+ this.setDefaultPackage(JpaPreferences.getEntityGenDefaultPackageName());
// jpql identifier prefs
this.lowercase = this.isDefaultJpqlIdentifierLowercase();
- this.matchFirstCharacterCase = this.shouldDefaultMatchFirstCharacterCase();
+ this.matchFirstCharacterCase = this.shouldMatchFirstCharacterCaseDefault();
this.lowerCaseRadioButton.setSelection(this.lowercase);
this.upperCaseRadioButton.setSelection( ! this.lowercase);
@@ -115,11 +109,11 @@ public class JpaPreferencesPage extends PreferencePage
@Override
public boolean performOk() {
// entitygen prefs
- JpaEntityGenPreferencesManager.setDefaultPackageWorkspacePreference(this.getDefaultPackage());
+ JpaPreferences.setEntityGenDefaultPackageName(this.getDefaultPackage());
// jpql identifier prefs
- JpaJpqlPreferencesManager.setIdentifiersCaseWorkspacePreference(this.jpqlIdentifierPreferenceValue());
- JpaJpqlPreferencesManager.setMatchFirstCharacterCaseWorkspacePreference(this.matchFirstCharacterCase);
+ JpaPreferences.setJpqlIdentifierLowercase(this.lowercase);
+ JpaPreferences.setJpqlIdentifierMatchFirstCharacterCase(this.matchFirstCharacterCase);
return super.performOk();
}
@@ -148,8 +142,7 @@ public class JpaPreferencesPage extends PreferencePage
// default package
this.buildLabel(group, 1, JptUiMessages.JpaPreferencesPage_entityGen_defaultPackageLabel);
this.defaultPackageText = this.buildText(group, 1);
- this.defaultPackageText.setText(
- JpaEntityGenPreferencesManager.getDefaultPackageWorkspacePreference());
+ this.defaultPackageText.setText(JpaPreferences.getEntityGenDefaultPackageName());
}
private void addJpqlEditorGroup(Composite parent) {
@@ -216,27 +209,19 @@ public class JpaPreferencesPage extends PreferencePage
}
private boolean isDefaultJpqlIdentifierLowercase() {
- String value = JpaJpqlPreferencesManager.getDefaultIdentifiersCase();
- return JpaJpqlPreferencesManager.JPQL_IDENTIFIER_LOWERCASE_PREF_VALUE.equals(value);
- }
-
- private String jpqlIdentifierPreferenceValue() {
- return this.lowercase ?
- JpaJpqlPreferencesManager.JPQL_IDENTIFIER_LOWERCASE_PREF_VALUE :
- JpaJpqlPreferencesManager.JPQL_IDENTIFIER_UPPERCASE_PREF_VALUE;
+ return JpaPreferences.getJpqlIdentifierLowercaseDefault();
}
- private boolean shouldDefaultMatchFirstCharacterCase() {
- return JpaJpqlPreferencesManager.getDefaultMatchFirstCharacterCase();
+ private boolean shouldMatchFirstCharacterCase() {
+ return JpaPreferences.getJpqlIdentifierMatchFirstCharacterCase();
}
- private boolean shouldMatchFirstCharacterCase() {
- return JpaJpqlPreferencesManager.getMatchFirstCharacterCaseWorkspacePreference();
+ private boolean shouldMatchFirstCharacterCaseDefault() {
+ return JpaPreferences.getJpqlIdentifierMatchFirstCharacterCaseDefault();
}
private boolean shouldUseLowercaseIdentifiers() {
- String value = JpaJpqlPreferencesManager.getIdentifiersCaseWorkspacePreference();
- return JpaJpqlPreferencesManager.JPQL_IDENTIFIER_LOWERCASE_PREF_VALUE.equals(value);
+ return JpaPreferences.getJpqlIdentifierLowercase();
}
private String getDefaultPackage() {
@@ -259,14 +244,14 @@ public class JpaPreferencesPage extends PreferencePage
IPreferenceStore preferences = JptJpaUiPlugin.instance().getPreferenceStore();
- String legacyCase = preferences.getString(JptJpaUiPlugin.JPQL_IDENTIFIER_CASE_PREF_KEY);
- boolean legacyMatchFirstCharacterCase = preferences.getBoolean(JptJpaUiPlugin.JPQL_IDENTIFIER_MATCH_FIRST_CHARACTER_CASE_PREF_KEY);
-
+ String legacyCase = preferences.getString(JPQL_IDENTIFIER_CASE_PREF_KEY);
if( ! StringTools.stringIsEmpty(legacyCase)) { // value is not empty when legacy preference exist
- JpaJpqlPreferencesManager.setIdentifiersCaseWorkspacePreference(legacyCase);
+ JpaPreferences.setJpqlIdentifierLowercase(legacyCase.equals("lowercase"));
}
+
+ boolean legacyMatchFirstCharacterCase = preferences.getBoolean(JPQL_IDENTIFIER_MATCH_FIRST_CHARACTER_CASE_PREF_KEY);
if(legacyMatchFirstCharacterCase) { // value is true when legacy preference exist
- JpaJpqlPreferencesManager.setMatchFirstCharacterCaseWorkspacePreference(legacyMatchFirstCharacterCase);
+ JpaPreferences.setJpqlIdentifierMatchFirstCharacterCase(legacyMatchFirstCharacterCase);
}
this.removeLegacyJpqlPreferences();
@@ -275,10 +260,13 @@ public class JpaPreferencesPage extends PreferencePage
private void removeLegacyJpqlPreferences() {
IPreferenceStore preferences = JptJpaUiPlugin.instance().getPreferenceStore();
- preferences.setToDefault(JptJpaUiPlugin.JPQL_IDENTIFIER_CASE_PREF_KEY);
- preferences.setToDefault(JptJpaUiPlugin.JPQL_IDENTIFIER_MATCH_FIRST_CHARACTER_CASE_PREF_KEY);
+ preferences.setToDefault(JPQL_IDENTIFIER_CASE_PREF_KEY);
+ preferences.setToDefault(JPQL_IDENTIFIER_MATCH_FIRST_CHARACTER_CASE_PREF_KEY);
}
+ private static final String JPQL_IDENTIFIER_CASE_PREF_KEY = JptJpaUiPlugin.instance().getPluginID() + ".jpqlIdentifier.case";
+ private static final String JPQL_IDENTIFIER_MATCH_FIRST_CHARACTER_CASE_PREF_KEY = JptJpaUiPlugin.instance().getPluginID() + ".jpqlIdentifier.matchFirstCharacterCase";
+
// ********** UI controls **********
private Text buildText(Composite parent, int horizontalSpan) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/prefs/JpaProblemSeveritiesPage.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/prefs/JpaProblemSeveritiesPage.java
index f8f8b044b6..816a1e157d 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/prefs/JpaProblemSeveritiesPage.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/prefs/JpaProblemSeveritiesPage.java
@@ -14,7 +14,6 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRunnable;
@@ -22,7 +21,6 @@ import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.internal.ui.preferences.PropertyAndPreferencePage;
import org.eclipse.jdt.internal.ui.preferences.ScrolledPageContent;
import org.eclipse.jface.dialogs.IDialogSettings;
@@ -31,11 +29,11 @@ import org.eclipse.jface.layout.PixelConverter;
import org.eclipse.jface.operation.IRunnableContext;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jpt.jpa.core.prefs.JpaValidationPreferencesManager;
+import org.eclipse.jpt.jpa.core.JpaPreferences;
import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
import org.eclipse.jpt.jpa.ui.internal.JptUiMessages;
import org.eclipse.jpt.jpa.ui.internal.JptUiValidationPreferenceMessages;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
@@ -151,8 +149,6 @@ public class JpaProblemSeveritiesPage extends PropertyAndPreferencePage {
public static final String SETTINGS_SECTION_NAME = "JpaProblemSeveritiesPage"; //$NON-NLS-1$
- private JpaValidationPreferencesManager preferencesManager;
-
private Boolean hasProjectSpecificPreferences = null;
/**
@@ -169,14 +165,6 @@ public class JpaProblemSeveritiesPage extends PropertyAndPreferencePage {
this.setDescription(JptUiMessages.JpaProblemSeveritiesPage_Description);
}
- @Override
- protected Control createContents(Composite parent) {
- if(this.isProjectPreferencePage()) {
- this.preferencesManager = new JpaValidationPreferencesManager(this.getProject());
- }
- return super.createContents(parent);
- }
-
protected void initialize() {
this.combos = new ArrayList<Combo>();
this.expandablePanes = new ArrayList<ExpandableComposite>();
@@ -189,22 +177,22 @@ public class JpaProblemSeveritiesPage extends PropertyAndPreferencePage {
protected Map<String, String> buildDefaultSeverities() {
Map<String, String> result = new HashMap<String, String>();
- result.put(JpaValidationMessages.PERSISTENCE_MULTIPLE_PERSISTENCE_UNITS, JpaValidationPreferencesManager.WARNING);
- result.put(JpaValidationMessages.PROJECT_NO_CONNECTION, JpaValidationPreferencesManager.WARNING);
- result.put(JpaValidationMessages.PROJECT_INVALID_CONNECTION, JpaValidationPreferencesManager.WARNING);
- result.put(JpaValidationMessages.PROJECT_INACTIVE_CONNECTION, JpaValidationPreferencesManager.WARNING);
- result.put(JpaValidationMessages.MAPPING_FILE_EXTRANEOUS_PERSISTENCE_UNIT_METADATA, JpaValidationPreferencesManager.WARNING);
- result.put(JpaValidationMessages.PERSISTENT_TYPE_DUPLICATE_CLASS, JpaValidationPreferencesManager.WARNING); //3.0 M7
- result.put(JpaValidationMessages.PERSISTENCE_UNIT_JAR_FILE_DEPLOYMENT_PATH_WARNING, JpaValidationPreferencesManager.WARNING);
- result.put(JpaValidationMessages.PERSISTENT_ATTRIBUTE_INHERITED_ATTRIBUTES_NOT_SUPPORTED, JpaValidationPreferencesManager.WARNING);
- result.put(JpaValidationMessages.PERSISTENT_TYPE_ANNOTATED_BUT_NOT_INCLUDED_IN_PERSISTENCE_UNIT, JpaValidationPreferencesManager.WARNING);
- result.put(JpaValidationMessages.ENTITY_ABSTRACT_DISCRIMINATOR_VALUE_DEFINED, JpaValidationPreferencesManager.WARNING);
- result.put(JpaValidationMessages.PERSISTENT_ATTRIBUTE_INVALID_VERSION_MAPPING_TYPE, JpaValidationPreferencesManager.WARNING); //3.0 M7
- result.put(JpaValidationMessages.ENTITY_TABLE_PER_CLASS_DISCRIMINATOR_VALUE_DEFINED, JpaValidationPreferencesManager.WARNING);
- result.put(JpaValidationMessages.ENTITY_TABLE_PER_CLASS_NOT_PORTABLE_ON_PLATFORM, JpaValidationPreferencesManager.WARNING);
-
- result.put(JpaValidationMessages.XML_VERSION_NOT_LATEST, JpaValidationPreferencesManager.INFO);
- result.put(JpaValidationMessages.PERSISTENCE_UNIT_REDUNDANT_CLASS, JpaValidationPreferencesManager.INFO);
+ result.put(JpaValidationMessages.PERSISTENCE_MULTIPLE_PERSISTENCE_UNITS, JpaPreferences.PROBLEM_WARNING);
+ result.put(JpaValidationMessages.PROJECT_NO_CONNECTION, JpaPreferences.PROBLEM_WARNING);
+ result.put(JpaValidationMessages.PROJECT_INVALID_CONNECTION, JpaPreferences.PROBLEM_WARNING);
+ result.put(JpaValidationMessages.PROJECT_INACTIVE_CONNECTION, JpaPreferences.PROBLEM_WARNING);
+ result.put(JpaValidationMessages.MAPPING_FILE_EXTRANEOUS_PERSISTENCE_UNIT_METADATA, JpaPreferences.PROBLEM_WARNING);
+ result.put(JpaValidationMessages.PERSISTENT_TYPE_DUPLICATE_CLASS, JpaPreferences.PROBLEM_WARNING); //3.0 M7
+ result.put(JpaValidationMessages.PERSISTENCE_UNIT_JAR_FILE_DEPLOYMENT_PATH_WARNING, JpaPreferences.PROBLEM_WARNING);
+ result.put(JpaValidationMessages.PERSISTENT_ATTRIBUTE_INHERITED_ATTRIBUTES_NOT_SUPPORTED, JpaPreferences.PROBLEM_WARNING);
+ result.put(JpaValidationMessages.PERSISTENT_TYPE_ANNOTATED_BUT_NOT_INCLUDED_IN_PERSISTENCE_UNIT, JpaPreferences.PROBLEM_WARNING);
+ result.put(JpaValidationMessages.ENTITY_ABSTRACT_DISCRIMINATOR_VALUE_DEFINED, JpaPreferences.PROBLEM_WARNING);
+ result.put(JpaValidationMessages.PERSISTENT_ATTRIBUTE_INVALID_VERSION_MAPPING_TYPE, JpaPreferences.PROBLEM_WARNING); //3.0 M7
+ result.put(JpaValidationMessages.ENTITY_TABLE_PER_CLASS_DISCRIMINATOR_VALUE_DEFINED, JpaPreferences.PROBLEM_WARNING);
+ result.put(JpaValidationMessages.ENTITY_TABLE_PER_CLASS_NOT_PORTABLE_ON_PLATFORM, JpaPreferences.PROBLEM_WARNING);
+
+ result.put(JpaValidationMessages.XML_VERSION_NOT_LATEST, JpaPreferences.PROBLEM_INFO);
+ result.put(JpaValidationMessages.PERSISTENCE_UNIT_REDUNDANT_CLASS, JpaPreferences.PROBLEM_INFO);
return result;
}
@@ -704,11 +692,10 @@ public class JpaProblemSeveritiesPage extends PropertyAndPreferencePage {
protected String getPreferenceValue(String preferenceKey) {
String preference = null;
if (this.isProjectPreferencePage() && this.hasProjectSpecificOptions(this.getProject())) { //useProjectSettings() won't work since the page is being built
- preference = this.preferencesManager.getProjectLevelProblemPreference(preferenceKey);
- }
- else {
+ preference = JpaPreferences.getProblemSeverity(this.getProject(), preferenceKey);
+ } else {
//don't get the workspace preference when the project has overridden workspace preferences
- preference = JpaValidationPreferencesManager.getWorkspaceLevelProblemPreference(preferenceKey);
+ preference = JpaPreferences.getProblemSeverity(preferenceKey);
}
if (preference == null) {
preference = getDefaultPreferenceValue(preferenceKey);
@@ -721,20 +708,20 @@ public class JpaProblemSeveritiesPage extends PropertyAndPreferencePage {
*/
protected String getDefaultPreferenceValue(String preferenceKey) {
String preference = this.defaultSeverities.get(preferenceKey);
- return preference == null ? JpaValidationPreferencesManager.ERROR : preference;
+ return preference == null ? JpaPreferences.PROBLEM_ERROR : preference;
}
protected int convertPreferenceValueToComboIndex(String preferenceValue) {
- if (JpaValidationPreferencesManager.ERROR.equals(preferenceValue)) {
+ if (JpaPreferences.PROBLEM_ERROR.equals(preferenceValue)) {
return ERROR_INDEX;
}
- if (JpaValidationPreferencesManager.WARNING.equals(preferenceValue)) {
+ if (JpaPreferences.PROBLEM_WARNING.equals(preferenceValue)) {
return WARNING_INDEX;
}
- if (JpaValidationPreferencesManager.INFO.equals(preferenceValue)) {
+ if (JpaPreferences.PROBLEM_INFO.equals(preferenceValue)) {
return INFO_INDEX;
}
- if (JpaValidationPreferencesManager.IGNORE.equals(preferenceValue)) {
+ if (JpaPreferences.PROBLEM_IGNORE.equals(preferenceValue)) {
return IGNORE_INDEX;
}
throw new IllegalStateException();
@@ -742,10 +729,10 @@ public class JpaProblemSeveritiesPage extends PropertyAndPreferencePage {
protected String convertToPreferenceValue(int selectionIndex) {
switch (selectionIndex) {
- case ERROR_INDEX: return JpaValidationPreferencesManager.ERROR;
- case WARNING_INDEX: return JpaValidationPreferencesManager.WARNING;
- case INFO_INDEX: return JpaValidationPreferencesManager.INFO;
- case IGNORE_INDEX: return JpaValidationPreferencesManager.IGNORE;
+ case ERROR_INDEX: return JpaPreferences.PROBLEM_ERROR;
+ case WARNING_INDEX: return JpaPreferences.PROBLEM_WARNING;
+ case INFO_INDEX: return JpaPreferences.PROBLEM_INFO;
+ case IGNORE_INDEX: return JpaPreferences.PROBLEM_IGNORE;
default: return null;
}
}
@@ -771,7 +758,7 @@ public class JpaProblemSeveritiesPage extends PropertyAndPreferencePage {
@Override
protected boolean hasProjectSpecificOptions(IProject project) {
- return this.preferencesManager.projectHasSpecificOptions();
+ return JpaPreferences.getWorkspaceValidationPreferencesOverridden(project);
}
@Override
@@ -821,7 +808,7 @@ public class JpaProblemSeveritiesPage extends PropertyAndPreferencePage {
protected void overrideWorkspacePreferences() {
for (Combo combo : this.combos) {
String preferenceKey = (String) combo.getData(PREFERENCE_KEY);
- String workspacePreference = JpaValidationPreferencesManager.getWorkspaceLevelProblemPreference(preferenceKey);
+ String workspacePreference = JpaPreferences.getProblemSeverity(preferenceKey);
String defaultPreference = getDefaultPreferenceValue(preferenceKey);
if (workspacePreference != null && !workspacePreference.equals(defaultPreference)) {
combo.select(convertPreferenceValueToComboIndex(workspacePreference));
@@ -840,7 +827,7 @@ public class JpaProblemSeveritiesPage extends PropertyAndPreferencePage {
public boolean performOk() {
super.performOk();
if (this.hasProjectSpecificPreferences != null) {
- this.preferencesManager.setProjectHasSpecificOptions(this.hasProjectSpecificPreferences.booleanValue());
+ JpaPreferences.setWorkspaceValidationPreferencesOverridden(this.getProject(), this.hasProjectSpecificPreferences.booleanValue());
}
for (String validationPreferenceKey : this.severityLevels.keySet()) {
this.updatePreference(validationPreferenceKey, this.severityLevels.get(validationPreferenceKey));
@@ -863,10 +850,9 @@ public class JpaProblemSeveritiesPage extends PropertyAndPreferencePage {
protected void updatePreference(String preferenceKey, String value) {
if (this.isProjectPreferencePage()) {
- this.preferencesManager.setProjectLevelProblemPreference(preferenceKey, value);
- }
- else {
- JpaValidationPreferencesManager.setWorkspaceLevelProblemPreference(preferenceKey, value);
+ JpaPreferences.setProblemSeverity(this.getProject(), preferenceKey, value);
+ } else {
+ JpaPreferences.setProblemSeverity(preferenceKey, value);
}
}
@@ -904,11 +890,15 @@ public class JpaProblemSeveritiesPage extends PropertyAndPreferencePage {
}
void performOk_(IProgressMonitor monitor) throws CoreException {
- //if project is null this is a workspace preference page
- if (this.getProject()==null) {
- JavaPlugin.getWorkspace().build(IncrementalProjectBuilder.FULL_BUILD, monitor);
+ int buildKind = IncrementalProjectBuilder.FULL_BUILD;
+ IProject project = this.getProject();
+ if (project != null) {
+ // project preference page
+ project.build(buildKind, monitor);
+ } else {
+ // workspace preference page
+ ResourcesPlugin.getWorkspace().build(buildKind, monitor);
}
- else this.getProject().build(IncrementalProjectBuilder.FULL_BUILD, monitor);
}
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/prefs/JptPreferencesPage.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/prefs/JptPreferencesPage.java
index 98bcd62638..d2d4f27d9d 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/prefs/JptPreferencesPage.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/prefs/JptPreferencesPage.java
@@ -1,10 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
package org.eclipse.jpt.jpa.ui.internal.prefs;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.jpt.common.ui.internal.dialogs.OptionalMessageDialog;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
import org.eclipse.jpt.jpa.ui.internal.JptUiMessages;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/properties/JpaProjectPropertiesPage.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/properties/JpaProjectPropertiesPage.java
index a45803935d..f5f12aeac9 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/properties/JpaProjectPropertiesPage.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/properties/JpaProjectPropertiesPage.java
@@ -14,12 +14,11 @@ import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
-import java.util.List;
import java.util.Map;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
import org.eclipse.jdt.core.ElementChangedEvent;
import org.eclipse.jdt.core.IElementChangedListener;
import org.eclipse.jdt.core.IJavaElement;
@@ -31,6 +30,7 @@ import org.eclipse.jpt.common.ui.internal.listeners.SWTPropertyChangeListenerWra
import org.eclipse.jpt.common.ui.internal.properties.JptProjectPropertiesPage;
import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
import org.eclipse.jpt.common.ui.internal.utility.swt.SWTTools;
+import org.eclipse.jpt.common.utility.internal.AbstractTransformer;
import org.eclipse.jpt.common.utility.internal.BitTools;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.FilterAdapter;
@@ -38,14 +38,12 @@ import org.eclipse.jpt.common.utility.internal.NotBooleanTransformer;
import org.eclipse.jpt.common.utility.internal.StringConverter;
import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.common.utility.internal.Transformer;
-import org.eclipse.jpt.common.utility.internal.AbstractTransformer;
import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
import org.eclipse.jpt.common.utility.internal.model.value.AbstractCollectionValueModel;
import org.eclipse.jpt.common.utility.internal.model.value.AspectCollectionValueModelAdapter;
import org.eclipse.jpt.common.utility.internal.model.value.AspectPropertyValueModelAdapter;
-import org.eclipse.jpt.common.utility.internal.model.value.BufferedWritablePropertyValueModel;
+import org.eclipse.jpt.common.utility.internal.model.value.BufferedModifiablePropertyValueModel;
import org.eclipse.jpt.common.utility.internal.model.value.CompositeCollectionValueModel;
import org.eclipse.jpt.common.utility.internal.model.value.CompositePropertyValueModel;
import org.eclipse.jpt.common.utility.internal.model.value.DoublePropertyValueModel;
@@ -55,25 +53,26 @@ import org.eclipse.jpt.common.utility.internal.model.value.PropertyCollectionVal
import org.eclipse.jpt.common.utility.internal.model.value.SetCollectionValueModel;
import org.eclipse.jpt.common.utility.internal.model.value.SortedListValueModelAdapter;
import org.eclipse.jpt.common.utility.internal.model.value.StaticCollectionValueModel;
+import org.eclipse.jpt.common.utility.internal.model.value.TransformationModifiablePropertyValueModel;
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.model.Model;
import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent;
import org.eclipse.jpt.common.utility.model.listener.PropertyChangeAdapter;
import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener;
import org.eclipse.jpt.common.utility.model.value.CollectionValueModel;
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.jpt.jpa.core.JpaDataSource;
-import org.eclipse.jpt.jpa.core.JpaFacet;
+import org.eclipse.jpt.jpa.core.JpaPreferences;
import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.JpaWorkspace;
import org.eclipse.jpt.jpa.core.internal.JptCoreMessages;
import org.eclipse.jpt.jpa.core.jpa2.JpaProject2_0;
import org.eclipse.jpt.jpa.core.libprov.JpaLibraryProviderInstallOperationConfig;
import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
import org.eclipse.jpt.jpa.core.platform.JpaPlatformGroupDescription;
+import org.eclipse.jpt.jpa.core.platform.JpaPlatformManager;
import org.eclipse.jpt.jpa.db.Catalog;
import org.eclipse.jpt.jpa.db.ConnectionAdapter;
import org.eclipse.jpt.jpa.db.ConnectionListener;
@@ -81,14 +80,13 @@ import org.eclipse.jpt.jpa.db.ConnectionProfile;
import org.eclipse.jpt.jpa.db.ConnectionProfileFactory;
import org.eclipse.jpt.jpa.db.ConnectionProfileListener;
import org.eclipse.jpt.jpa.db.Database;
-import org.eclipse.jpt.jpa.db.JptJpaDbPlugin;
import org.eclipse.jpt.jpa.db.SchemaContainer;
import org.eclipse.jpt.jpa.db.ui.internal.DTPUiTools;
import org.eclipse.jpt.jpa.ui.JpaProjectModel;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
import org.eclipse.jpt.jpa.ui.internal.JpaHelpContextIds;
import org.eclipse.jpt.jpa.ui.internal.JptUiMessages;
import org.eclipse.jpt.jpa.ui.internal.jpa2.Jpa2_0FlagTransformer;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
import org.eclipse.jst.common.project.facet.core.libprov.ILibraryProvider;
import org.eclipse.jst.common.project.facet.core.libprov.LibraryInstallDelegate;
import org.eclipse.jst.common.project.facet.core.libprov.LibraryProviderOperationConfig;
@@ -121,31 +119,31 @@ public class JpaProjectPropertiesPage
private PropertyValueModel<JpaProject> jpaProjectModel;
private PropertyValueModel<Boolean> jpaProjectNotNullFlagModel;
- private BufferedWritablePropertyValueModel<String> platformIdModel;
- private PropertyChangeListener platformIdListener;
+ private BufferedModifiablePropertyValueModel<JpaPlatformDescription> jpaPlatformDescriptionModel;
+ private PropertyChangeListener jpaPlatformDescriptionListener;
- private BufferedWritablePropertyValueModel<String> connectionModel;
+ private BufferedModifiablePropertyValueModel<String> connectionModel;
private PropertyValueModel<ConnectionProfile> connectionProfileModel;
private PropertyValueModel<Boolean> disconnectedModel;
private PropertyChangeListener disconnectedModelListener;
private Link connectLink;
- private BufferedWritablePropertyValueModel<Boolean> userOverrideDefaultCatalogFlagModel;
- private BufferedWritablePropertyValueModel<String> userOverrideDefaultCatalogModel;
+ private BufferedModifiablePropertyValueModel<Boolean> userOverrideDefaultCatalogFlagModel;
+ private BufferedModifiablePropertyValueModel<String> userOverrideDefaultCatalogModel;
private ModifiablePropertyValueModel<String> defaultCatalogModel;
private ListValueModel<String> catalogChoicesModel;
- private BufferedWritablePropertyValueModel<Boolean> userOverrideDefaultSchemaFlagModel;
- private BufferedWritablePropertyValueModel<String> userOverrideDefaultSchemaModel;
+ private BufferedModifiablePropertyValueModel<Boolean> userOverrideDefaultSchemaFlagModel;
+ private BufferedModifiablePropertyValueModel<String> userOverrideDefaultSchemaModel;
private ModifiablePropertyValueModel<String> defaultSchemaModel;
private ListValueModel<String> schemaChoicesModel;
- private BufferedWritablePropertyValueModel<Boolean> discoverAnnotatedClassesModel;
+ private BufferedModifiablePropertyValueModel<Boolean> discoverAnnotatedClassesModel;
private ModifiablePropertyValueModel<Boolean> listAnnotatedClassesModel;
private PropertyValueModel<Boolean> jpa2_0ProjectFlagModel;
- private BufferedWritablePropertyValueModel<String> metamodelSourceFolderModel;
+ private BufferedModifiablePropertyValueModel<String> metamodelSourceFolderModel;
private ListValueModel<String> javaSourceFolderChoicesModel;
private static final String BUILD_PATHS_PROPERTY_PAGE_ID = "org.eclipse.jdt.ui.propertyPages.BuildPathsPropertyPage"; //$NON-NLS-1$
@@ -163,8 +161,8 @@ public class JpaProjectPropertiesPage
this.jpaProjectModel = this.buildJpaProjectModel();
this.jpaProjectNotNullFlagModel = this.buildJpaProjectNotNullFlagModel();
- this.platformIdModel = this.buildPlatformIdModel();
- this.platformIdListener = this.buildPlatformIdListener();
+ this.jpaPlatformDescriptionModel = this.buildJpaPlatformDescriptionModel();
+ this.jpaPlatformDescriptionListener = this.buildJpaPlatformDescriptionListener();
this.connectionModel = this.buildConnectionModel();
this.connectionProfileModel = this.buildConnectionProfileModel();
@@ -226,25 +224,25 @@ public class JpaProjectPropertiesPage
}
}
- // ***** platform ID model
- private BufferedWritablePropertyValueModel<String> buildPlatformIdModel() {
- return new BufferedWritablePropertyValueModel<String>(new PlatformIdModel(this.jpaProjectModel), this.trigger);
+ // ***** JPA platform description model
+ private BufferedModifiablePropertyValueModel<JpaPlatformDescription> buildJpaPlatformDescriptionModel() {
+ return new BufferedModifiablePropertyValueModel<JpaPlatformDescription>(new JpaPlatformDescriptionModel(this.jpaProjectModel), this.trigger);
}
- private PropertyChangeListener buildPlatformIdListener(){
- return new PlatformIdListener();
+ private PropertyChangeListener buildJpaPlatformDescriptionListener(){
+ return new JpaPlatformDescriptionListener();
}
- /* CU private */ class PlatformIdListener
+ /* CU private */ class JpaPlatformDescriptionListener
extends PropertyChangeAdapter
{
@Override
public void propertyChanged(PropertyChangeEvent event) {
- JpaProjectPropertiesPage.this.platformIdChanged();
+ JpaProjectPropertiesPage.this.jpaPlatformDescriptionChanged();
}
}
- void platformIdChanged() {
+ void jpaPlatformDescriptionChanged() {
if ( ! this.getControl().isDisposed()) {
// handle null, in the case the jpa facet is changed via the facets page,
// the library install delegate is temporarily null
@@ -253,8 +251,8 @@ public class JpaProjectPropertiesPage
}
// ***** connection models
- private BufferedWritablePropertyValueModel<String> buildConnectionModel() {
- return new BufferedWritablePropertyValueModel<String>(new ConnectionModel(this.jpaProjectModel), this.trigger);
+ private BufferedModifiablePropertyValueModel<String> buildConnectionModel() {
+ return new BufferedModifiablePropertyValueModel<String>(new ConnectionModel(this.jpaProjectModel), this.trigger);
}
private PropertyValueModel<ConnectionProfile> buildConnectionProfileModel() {
@@ -266,12 +264,12 @@ public class JpaProjectPropertiesPage
}
// ***** catalog models
- private BufferedWritablePropertyValueModel<Boolean> buildUserOverrideDefaultCatalogFlagModel() {
- return new BufferedWritablePropertyValueModel<Boolean>(new UserOverrideDefaultCatalogFlagModel(this.jpaProjectModel), this.trigger);
+ private BufferedModifiablePropertyValueModel<Boolean> buildUserOverrideDefaultCatalogFlagModel() {
+ return new BufferedModifiablePropertyValueModel<Boolean>(new UserOverrideDefaultCatalogFlagModel(this.jpaProjectModel), this.trigger);
}
- private BufferedWritablePropertyValueModel<String> buildUserOverrideDefaultCatalogModel() {
- return new BufferedWritablePropertyValueModel<String>(new UserOverrideDefaultCatalogModel(this.jpaProjectModel), this.trigger);
+ private BufferedModifiablePropertyValueModel<String> buildUserOverrideDefaultCatalogModel() {
+ return new BufferedModifiablePropertyValueModel<String>(new UserOverrideDefaultCatalogModel(this.jpaProjectModel), this.trigger);
}
private ModifiablePropertyValueModel<String> buildDefaultCatalogModel() {
@@ -311,12 +309,12 @@ public class JpaProjectPropertiesPage
}
// ***** schema models
- private BufferedWritablePropertyValueModel<Boolean> buildUserOverrideDefaultSchemaFlagModel() {
- return new BufferedWritablePropertyValueModel<Boolean>(new UserOverrideDefaultSchemaFlagModel(this.jpaProjectModel), this.trigger);
+ private BufferedModifiablePropertyValueModel<Boolean> buildUserOverrideDefaultSchemaFlagModel() {
+ return new BufferedModifiablePropertyValueModel<Boolean>(new UserOverrideDefaultSchemaFlagModel(this.jpaProjectModel), this.trigger);
}
- private BufferedWritablePropertyValueModel<String> buildUserOverrideDefaultSchemaModel() {
- return new BufferedWritablePropertyValueModel<String>(new UserOverrideDefaultSchemaModel(this.jpaProjectModel), this.trigger);
+ private BufferedModifiablePropertyValueModel<String> buildUserOverrideDefaultSchemaModel() {
+ return new BufferedModifiablePropertyValueModel<String>(new UserOverrideDefaultSchemaModel(this.jpaProjectModel), this.trigger);
}
private ModifiablePropertyValueModel<String> buildDefaultSchemaModel() {
@@ -353,15 +351,15 @@ public class JpaProjectPropertiesPage
}
// ***** discover/list annotated classes models
- private BufferedWritablePropertyValueModel<Boolean> buildDiscoverAnnotatedClassesModel() {
- return new BufferedWritablePropertyValueModel<Boolean>(new DiscoverAnnotatedClassesModel(this.jpaProjectModel), this.trigger);
+ private BufferedModifiablePropertyValueModel<Boolean> buildDiscoverAnnotatedClassesModel() {
+ return new BufferedModifiablePropertyValueModel<Boolean>(new DiscoverAnnotatedClassesModel(this.jpaProjectModel), this.trigger);
}
/**
* The opposite of the "discover annotated classes" flag.
*/
private ModifiablePropertyValueModel<Boolean> buildListAnnotatedClassesModel() {
- return new TransformationWritablePropertyValueModel<Boolean, Boolean>(this.discoverAnnotatedClassesModel, NotBooleanTransformer.instance(), NotBooleanTransformer.instance());
+ return new TransformationModifiablePropertyValueModel<Boolean, Boolean>(this.discoverAnnotatedClassesModel, NotBooleanTransformer.instance(), NotBooleanTransformer.instance());
}
// ***** JPA 2.0 project flag
@@ -370,8 +368,8 @@ public class JpaProjectPropertiesPage
}
// ***** metamodel models
- private BufferedWritablePropertyValueModel<String> buildMetamodelSourceFolderModel() {
- return new BufferedWritablePropertyValueModel<String>(new MetamodelSourceFolderModel(this.jpaProjectModel), this.trigger);
+ private BufferedModifiablePropertyValueModel<String> buildMetamodelSourceFolderModel() {
+ return new BufferedModifiablePropertyValueModel<String>(new MetamodelSourceFolderModel(this.jpaProjectModel), this.trigger);
}
private ListValueModel<String> buildJavaSourceFolderChoicesModel() {
@@ -420,7 +418,7 @@ public class JpaProjectPropertiesPage
@Override
public IProjectFacetVersion getProjectFacetVersion() {
- return this.getFacetedProject().getInstalledVersion(JpaFacet.FACET);
+ return this.getFacetedProject().getInstalledVersion(JpaProject.FACET);
}
@Override
@@ -439,6 +437,10 @@ public class JpaProjectPropertiesPage
/* CU private */ class EmptyJpaPlatformDescription
implements JpaPlatformDescription
{
+ public JpaPlatformManager getJpaPlatformManager() {
+ return null;
+ }
+
public boolean supportsJpaFacetVersion(IProjectFacetVersion jpaFacetVersion) {
return false;
}
@@ -459,7 +461,7 @@ public class JpaProjectPropertiesPage
return null;
}
- public JpaPlatformGroupDescription getGroup() {
+ public JpaPlatformGroupDescription getGroupDescription() {
return null;
}
@@ -471,37 +473,34 @@ public class JpaProjectPropertiesPage
@Override
protected void adjustLibraryProviders() {
LibraryInstallDelegate lid = this.getLibraryInstallDelegate();
+ if (lid == null) {
+ return;
+ }
- if (lid != null) {
- JpaPlatformDescription jpaPlatform =
- JptJpaCorePlugin.getJpaPlatformManager().getJpaPlatform(this.platformIdModel.getValue());
- String jpaPlatformId = (jpaPlatform == null) ? "" : jpaPlatform.getId(); //$NON-NLS-1$
-
- lid.setEnablementContextVariable(
- JpaLibraryProviderInstallOperationConfig.JPA_PLATFORM_ENABLEMENT_EXP, jpaPlatformId);
- lid.setEnablementContextVariable(
- JpaLibraryProviderInstallOperationConfig.JPA_PLATFORM_DESCRIPTION_ENABLEMENT_EXP, jpaPlatform);
-
- List<JpaLibraryProviderInstallOperationConfig> jpaConfigs
- = new ArrayList<JpaLibraryProviderInstallOperationConfig>();
- // add the currently selected one first
- JpaLibraryProviderInstallOperationConfig currentJpaConfig = null;
- LibraryProviderOperationConfig config = lid.getLibraryProviderOperationConfig();
- if (config instanceof JpaLibraryProviderInstallOperationConfig) {
- currentJpaConfig = (JpaLibraryProviderInstallOperationConfig) config;
- jpaConfigs.add(currentJpaConfig);
- }
- for (ILibraryProvider lp : lid.getLibraryProviders()) {
- config = lid.getLibraryProviderOperationConfig(lp);
- if ((config instanceof JpaLibraryProviderInstallOperationConfig)
- && ! config.equals(currentJpaConfig)) {
- jpaConfigs.add((JpaLibraryProviderInstallOperationConfig) config);
- }
- }
- for (JpaLibraryProviderInstallOperationConfig jpaConfig : jpaConfigs) {
- jpaConfig.setJpaPlatform(jpaPlatform);
+ JpaPlatformDescription desc = this.jpaPlatformDescriptionModel.getValue();
+ String jpaPlatformID = (desc == null) ? "" : desc.getId(); //$NON-NLS-1$
+
+ lid.setEnablementContextVariable(JpaLibraryProviderInstallOperationConfig.JPA_PLATFORM_ENABLEMENT_EXP, jpaPlatformID);
+ lid.setEnablementContextVariable(JpaLibraryProviderInstallOperationConfig.JPA_PLATFORM_DESCRIPTION_ENABLEMENT_EXP, desc);
+
+ ArrayList<JpaLibraryProviderInstallOperationConfig> jpaConfigs = new ArrayList<JpaLibraryProviderInstallOperationConfig>();
+ // add the currently selected one first
+ JpaLibraryProviderInstallOperationConfig currentJpaConfig = null;
+ LibraryProviderOperationConfig config = lid.getLibraryProviderOperationConfig();
+ if (config instanceof JpaLibraryProviderInstallOperationConfig) {
+ currentJpaConfig = (JpaLibraryProviderInstallOperationConfig) config;
+ jpaConfigs.add(currentJpaConfig);
+ }
+ for (ILibraryProvider lp : lid.getLibraryProviders()) {
+ config = lid.getLibraryProviderOperationConfig(lp);
+ if ((config instanceof JpaLibraryProviderInstallOperationConfig)
+ && ! config.equals(currentJpaConfig)) {
+ jpaConfigs.add((JpaLibraryProviderInstallOperationConfig) config);
}
}
+ for (JpaLibraryProviderInstallOperationConfig jpaConfig : jpaConfigs) {
+ jpaConfig.setJpaPlatform(desc);
+ }
}
@@ -529,13 +528,13 @@ public class JpaProjectPropertiesPage
@Override
protected void engageListeners() {
super.engageListeners();
- this.platformIdModel.addPropertyChangeListener(PropertyValueModel.VALUE, this.platformIdListener);
+ this.jpaPlatformDescriptionModel.addPropertyChangeListener(PropertyValueModel.VALUE, this.jpaPlatformDescriptionListener);
this.disconnectedModel.addPropertyChangeListener(PropertyValueModel.VALUE, this.disconnectedModelListener);
}
@Override
protected void disengageListeners() {
- this.platformIdModel.removePropertyChangeListener(PropertyValueModel.VALUE, this.platformIdListener);
+ this.jpaPlatformDescriptionModel.removePropertyChangeListener(PropertyValueModel.VALUE, this.jpaPlatformDescriptionListener);
this.disconnectedModel.removePropertyChangeListener(PropertyValueModel.VALUE, this.disconnectedModelListener);
super.disengageListeners();
}
@@ -549,91 +548,103 @@ public class JpaProjectPropertiesPage
group.setLayout(new GridLayout());
group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- Combo platformDropDown = this.buildDropDown(group);
+ Combo jpaPlatformDropDown = this.buildDropDown(group);
SWTTools.bind(
- this.buildPlatformChoicesModel(),
- this.platformIdModel,
- platformDropDown,
- JPA_PLATFORM_LABEL_CONVERTER);
+ this.buildJpaPlatformDescriptionChoicesModel(),
+ this.jpaPlatformDescriptionModel,
+ jpaPlatformDropDown,
+ JPA_PLATFORM_DESCRIPTION_LABEL_CONVERTER);
Link facetsPageLink = this.buildFacetsPageLink(group, JptUiMessages.JpaFacetWizardPage_facetsPageLink);
- SWTTools.controlEnabledState(this.jpaProjectNotNullFlagModel, group, platformDropDown, facetsPageLink);
+ SWTTools.controlEnabledState(this.jpaProjectNotNullFlagModel, group, jpaPlatformDropDown, facetsPageLink);
}
/**
* Add the project's JPA platform if it is not on the list of valid
- * platforms.
+ * JPA platforms.
* <p>
* This is probably only useful if the project is corrupted
- * and has a platform that exists in the registry but is not on the
- * list of valid platforms for the project's JPA facet version.
+ * and has a JPA platform that exists in the registry but is not on the
+ * list of valid JPA platforms for the project's JPA facet version.
* Because, if the project's JPA platform is completely invalid, there
* would be no JPA project!
*/
- @SuppressWarnings("unchecked")
- private ListValueModel<String> buildPlatformChoicesModel() {
- return new SortedListValueModelAdapter<String>(
- new SetCollectionValueModel<String>(
- new CompositeCollectionValueModel<CollectionValueModel<String>, String>(
- new PropertyCollectionValueModelAdapter<String>(this.platformIdModel),
- this.buildRegistryPlatformsModel()
- )
+ private ListValueModel<JpaPlatformDescription> buildJpaPlatformDescriptionChoicesModel() {
+ return new SortedListValueModelAdapter<JpaPlatformDescription>(
+ new SetCollectionValueModel<JpaPlatformDescription>(
+ new CompositeCollectionValueModel<CollectionValueModel<JpaPlatformDescription>, JpaPlatformDescription>(
+ this.buildJpaPlatformDescriptionChoicesModels()
+ )
),
- JPA_PLATFORM_COMPARATOR
+ JPA_PLATFORM_DESCRIPTION_COMPARATOR
);
}
- private CollectionValueModel<String> buildRegistryPlatformsModel() {
- Iterable<String> enabledPlatformIds =
- new TransformationIterable<JpaPlatformDescription, String>(
- new FilteringIterable<JpaPlatformDescription>(
- JptJpaCorePlugin.getJpaPlatformManager().getJpaPlatforms(),
- new JpaPlatformDescriptionFilter()
- ),
- JPA_PLATFORM_DESCRIPTION_ID_TRANSFORMER
+ @SuppressWarnings("unchecked")
+ private CollectionValueModel<JpaPlatformDescription>[] buildJpaPlatformDescriptionChoicesModels() {
+ return new CollectionValueModel[] {
+ new PropertyCollectionValueModelAdapter<JpaPlatformDescription>(this.jpaPlatformDescriptionModel),
+ this.buildEnabledJpaPlatformDescriptionsModel()
+ };
+ }
+
+ /**
+ * Return only the JPA platform descriptions that support the project's
+ * JPA facet version.
+ */
+ private CollectionValueModel<JpaPlatformDescription> buildEnabledJpaPlatformDescriptionsModel() {
+ return new StaticCollectionValueModel<JpaPlatformDescription>(
+ new FilteringIterable<JpaPlatformDescription>(
+ getJpaPlatformManager().getJpaPlatformDescriptions(),
+ new JpaPlatformDescriptionFilter()
+ )
);
- return new StaticCollectionValueModel<String>(enabledPlatformIds);
}
/* CU private */ class JpaPlatformDescriptionFilter
extends FilterAdapter<JpaPlatformDescription>
{
@Override
- public boolean accept(JpaPlatformDescription o) {
- return o.supportsJpaFacetVersion(JpaProjectPropertiesPage.this.getProjectFacetVersion());
+ public boolean accept(JpaPlatformDescription description) {
+ return description.supportsJpaFacetVersion(JpaProjectPropertiesPage.this.getProjectFacetVersion());
}
}
- private static final Transformer<JpaPlatformDescription, String> JPA_PLATFORM_DESCRIPTION_ID_TRANSFORMER = new JpaPlatformDescriptionIdTransformer();
+ private static final Comparator<JpaPlatformDescription> JPA_PLATFORM_DESCRIPTION_COMPARATOR = new JpaPlatformDescriptionComparator();
- /* CU private */ static class JpaPlatformDescriptionIdTransformer
- extends AbstractTransformer<JpaPlatformDescription, String>
+ /* CU private */ static class JpaPlatformDescriptionComparator
+ implements Comparator<JpaPlatformDescription>
{
+ public int compare(JpaPlatformDescription desc1, JpaPlatformDescription desc2) {
+ return STRING_COMPARATOR.compare(desc1.getLabel(), desc2.getLabel());
+ }
@Override
- public String transform_(JpaPlatformDescription o) {
- return o.getId();
+ public String toString() {
+ return this.getClass().getSimpleName();
}
}
- private static final Comparator<String> JPA_PLATFORM_COMPARATOR =
- new Comparator<String>() {
- public int compare(String id1, String id2) {
- String label1 = getJpaPlatformLabel(id1);
- String label2 = getJpaPlatformLabel(id2);
- return STRING_COMPARATOR.compare(label1, label2);
- }
- };
+ private static final StringConverter<JpaPlatformDescription> JPA_PLATFORM_DESCRIPTION_LABEL_CONVERTER = new JpaPlatformDescriptionLabelConverter();
- private static final StringConverter<String> JPA_PLATFORM_LABEL_CONVERTER =
- new StringConverter<String>() {
- public String convertToString(String id) {
- return getJpaPlatformLabel(id);
- }
- };
+ /* CU private */ static class JpaPlatformDescriptionLabelConverter
+ implements StringConverter<JpaPlatformDescription>
+ {
+ public String convertToString(JpaPlatformDescription description) {
+ return description.getLabel();
+ }
+ @Override
+ public String toString() {
+ return this.getClass().getSimpleName();
+ }
+ }
- /* private */ static String getJpaPlatformLabel(String id) {
- return JptJpaCorePlugin.getJpaPlatformManager().getJpaPlatform(id).getLabel();
+ /* CU private */ static JpaPlatformManager getJpaPlatformManager() {
+ return getJpaWorkspace().getJpaPlatformManager();
+ }
+
+ /* CU private */ static JpaWorkspace getJpaWorkspace() {
+ return (JpaWorkspace) ResourcesPlugin.getWorkspace().getAdapter(JpaWorkspace.class);
}
@@ -825,7 +836,7 @@ public class JpaProjectPropertiesPage
@Override
protected boolean projectRebuildRequired() {
- return this.platformIdModel.isBuffering();
+ return this.jpaPlatformDescriptionModel.isBuffering();
}
@Override
@@ -834,7 +845,7 @@ public class JpaProjectPropertiesPage
try {
this.rebuildProject_();
} catch (InterruptedException ex) {
- throw new CoreException(new Status(IStatus.CANCEL, JptJpaUiPlugin.PLUGIN_ID, null, ex));
+ throw new CoreException(JptJpaUiPlugin.instance().buildStatus(IStatus.CANCEL, ex));
}
}
@@ -847,9 +858,9 @@ public class JpaProjectPropertiesPage
}
@Override
- protected BufferedWritablePropertyValueModel<?>[] buildBufferedModels() {
- return new BufferedWritablePropertyValueModel[] {
- this.platformIdModel,
+ protected BufferedModifiablePropertyValueModel<?>[] buildBufferedModels() {
+ return new BufferedModifiablePropertyValueModel[] {
+ this.jpaPlatformDescriptionModel,
this.connectionModel,
this.userOverrideDefaultCatalogFlagModel,
this.userOverrideDefaultCatalogModel,
@@ -866,7 +877,7 @@ public class JpaProjectPropertiesPage
@Override
protected Model[] buildValidationModels() {
return new Model[] {
- this.platformIdModel,
+ this.jpaPlatformDescriptionModel,
this.connectionModel,
this.userOverrideDefaultCatalogFlagModel,
this.defaultCatalogModel,
@@ -942,7 +953,7 @@ public class JpaProjectPropertiesPage
}
Map<String, Object> enablementVariables = new HashMap<String, Object>();
- enablementVariables.put(JpaLibraryProviderInstallOperationConfig.JPA_PLATFORM_ENABLEMENT_EXP, this.platformIdModel.getValue());
+ enablementVariables.put(JpaLibraryProviderInstallOperationConfig.JPA_PLATFORM_ENABLEMENT_EXP, this.jpaPlatformDescriptionModel.getValue());
enablementVariables.put(JpaLibraryProviderInstallOperationConfig.JPA_PLATFORM_DESCRIPTION_ENABLEMENT_EXP, this.jpaProjectModel.getValue().getJpaPlatform().getDescription());
if ( ! libInstallDelegate.getLibraryProvider().isEnabledFor(
@@ -1007,42 +1018,48 @@ public class JpaProjectPropertiesPage
@Override
protected ConnectionProfile transform_(String connectionName) {
- return JptJpaDbPlugin.getConnectionProfileFactory().buildConnectionProfile(connectionName);
+ return this.getConnectionProfileFactory().buildConnectionProfile(connectionName);
+ }
+
+ private ConnectionProfileFactory getConnectionProfileFactory() {
+ return (ConnectionProfileFactory) ResourcesPlugin.getWorkspace().getAdapter(ConnectionProfileFactory.class);
}
}
/**
- * Treat the JPA platform ID as an "aspect" of the JPA project.
- * The platform ID is stored in the project preferences.
- * The platform ID does not change for a JPA project - if the user wants a
- * different platform, we build an entirely new JPA project.
+ * Treat the JPA platform description as an "aspect" of the JPA project.
+ * The JPA platform ID is stored in the project preferences.
+ * The JPA platform does not change for a JPA project - if the user wants a
+ * different JPA platform, we build an entirely new JPA project.
*/
- static class PlatformIdModel
- extends AspectPropertyValueModelAdapter<JpaProject, String>
+ static class JpaPlatformDescriptionModel
+ extends AspectPropertyValueModelAdapter<JpaProject, JpaPlatformDescription>
{
- PlatformIdModel(PropertyValueModel<JpaProject> jpaProjectModel) {
+ JpaPlatformDescriptionModel(PropertyValueModel<JpaProject> jpaProjectModel) {
super(jpaProjectModel);
}
@Override
- protected String buildValue_() {
- return JptJpaCorePlugin.getJpaPlatformId(this.subject.getProject());
+ protected JpaPlatformDescription buildValue_() {
+ String jpaPlatformID = JpaPreferences.getJpaPlatformID(this.subject.getProject());
+ return getJpaPlatformManager().getJpaPlatformDescription(jpaPlatformID);
}
@Override
- public void setValue_(String newPlatformId) {
- JptJpaCorePlugin.setJpaPlatformId(this.subject.getProject(), newPlatformId);
+ public void setValue_(JpaPlatformDescription jpaPlatformDescription) {
+ String jpaPlatformID = jpaPlatformDescription.getId();
+ JpaPreferences.setJpaPlatformID(this.subject.getProject(), jpaPlatformID);
}
@Override
protected void engageSubject_() {
- // the platform ID does not change
+ // the JPA platform does not change
}
@Override
protected void disengageSubject_() {
- // the platform ID does not change
+ // the JPA platform does not change
}
}
@@ -1117,7 +1134,7 @@ public class JpaProjectPropertiesPage
}
private ConnectionProfileFactory getConnectionProfileFactory() {
- return JptJpaDbPlugin.getConnectionProfileFactory();
+ return (ConnectionProfileFactory) ResourcesPlugin.getWorkspace().getAdapter(ConnectionProfileFactory.class);
}
}
@@ -1263,18 +1280,18 @@ public class JpaProjectPropertiesPage
@Override
protected String buildValue_() {
- return this.jpaProjectIsJpa2_0() ? ((JpaProject2_0) this.subject).getMetamodelSourceFolderName() : null;
+ return this.subjectIsInJpa2_0Project() ? ((JpaProject2_0) this.subject).getMetamodelSourceFolderName() : null;
}
@Override
protected void setValue_(String value) {
- if (this.jpaProjectIsJpa2_0()) {
+ if (this.subjectIsInJpa2_0Project()) {
((JpaProject2_0) this.subject).setMetamodelSourceFolderName(value);
}
}
- private boolean jpaProjectIsJpa2_0() {
- return JptJpaCorePlugin.nodeIsJpa2_0Compatible(this.subject);
+ private boolean subjectIsInJpa2_0Project() {
+ return this.subject.getJpaProject().getJpaPlatform().getJpaVersion().isCompatibleWithJpaVersion(JpaProject2_0.FACET_VERSION_STRING);
}
}
@@ -1346,13 +1363,13 @@ public class JpaProjectPropertiesPage
@Override
protected Iterable<String> getIterable() {
- return this.jpaProjectIsJpa2_0() ?
+ return this.subjectIsInJpa2_0Project() ?
((JpaProject2_0) this.subject).getJavaSourceFolderNames() :
EmptyIterable.<String>instance();
}
- private boolean jpaProjectIsJpa2_0() {
- return JptJpaCorePlugin.nodeIsJpa2_0Compatible(this.subject);
+ private boolean subjectIsInJpa2_0Project() {
+ return this.subject.getJpaProject().getJpaPlatform().getJpaVersion().isCompatibleWithJpaVersion(JpaProject2_0.FACET_VERSION_STRING);
}
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/selection/TextEditorAdapterFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/selection/TextEditorAdapterFactory.java
index 789308a2c5..c2c8ad0628 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/selection/TextEditorAdapterFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/selection/TextEditorAdapterFactory.java
@@ -17,7 +17,7 @@ import org.eclipse.ui.texteditor.ITextEditor;
* Factory to build JPA selection adapters for a {@link ITextEditor}:<ul>
* <li>{@link org.eclipse.jpt.jpa.ui.selection.JpaEditorManager}
* </ul>
- * See <code>org.eclipse.jpt.jpa.ui/plugin.xml</code>.
+ * See <code>org.eclipse.jpt.jpa.ui/plugin.xml:org.eclipse.core.runtime.adapters</code>.
*/
public class TextEditorAdapterFactory
implements IAdapterFactory
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/structure/OrmStructureItemLabelProviderFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/structure/OrmStructureItemLabelProviderFactory.java
index 4b22ce324a..78eb89da91 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/structure/OrmStructureItemLabelProviderFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/structure/OrmStructureItemLabelProviderFactory.java
@@ -13,9 +13,9 @@ import org.eclipse.jpt.common.ui.internal.jface.StaticItemExtendedLabelProvider;
import org.eclipse.jpt.common.ui.jface.ItemExtendedLabelProvider;
import org.eclipse.jpt.common.ui.jface.ItemExtendedLabelProviderFactory;
import org.eclipse.jpt.jpa.core.context.orm.EntityMappings;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
import org.eclipse.jpt.jpa.ui.internal.JptUiIcons;
import org.eclipse.jpt.jpa.ui.internal.JptUiMessages;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
/**
* This factory builds item label providers for an <code>orm.xml</code> file
@@ -49,7 +49,7 @@ public class OrmStructureItemLabelProviderFactory
protected ItemExtendedLabelProvider buildEntityMappingsProvider(EntityMappings entityMappings, @SuppressWarnings("unused") ItemExtendedLabelProvider.Manager manager) {
return new StaticItemExtendedLabelProvider(
- JptJpaUiPlugin.getImage(JptUiIcons.ENTITY_MAPPINGS),
+ JptJpaUiPlugin.instance().getImage(JptUiIcons.ENTITY_MAPPINGS),
JptUiMessages.OrmItemLabelProviderFactory_entityMappingsLabel,
this.buildEntityMappingsDescription(entityMappings)
);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/structure/PersistenceStructureItemLabelProviderFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/structure/PersistenceStructureItemLabelProviderFactory.java
index 3200f1e098..ee4e1efe91 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/structure/PersistenceStructureItemLabelProviderFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/structure/PersistenceStructureItemLabelProviderFactory.java
@@ -18,13 +18,13 @@ import org.eclipse.jpt.jpa.core.context.persistence.JarFileRef;
import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef;
import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
import org.eclipse.jpt.jpa.ui.internal.JptUiIcons;
import org.eclipse.jpt.jpa.ui.internal.JptUiMessages;
import org.eclipse.jpt.jpa.ui.internal.platform.generic.ClassRefItemLabelProvider;
import org.eclipse.jpt.jpa.ui.internal.platform.generic.JarFileRefItemLabelProvider;
import org.eclipse.jpt.jpa.ui.internal.platform.generic.MappingFileRefItemLabelProvider;
import org.eclipse.jpt.jpa.ui.internal.platform.generic.PersistenceUnitItemLabelProvider;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
/**
* This factory builds item label providers for a <code>persistence.xml</code> file
@@ -69,7 +69,7 @@ public class PersistenceStructureItemLabelProviderFactory
protected ItemExtendedLabelProvider buildPersistenceProvider(Persistence item, @SuppressWarnings("unused") ItemExtendedLabelProvider.Manager manager) {
return new StaticItemExtendedLabelProvider(
- JptJpaUiPlugin.getImage(JptUiIcons.PERSISTENCE),
+ JptJpaUiPlugin.instance().getImage(JptUiIcons.PERSISTENCE),
JptUiMessages.PersistenceItemLabelProviderFactory_persistenceLabel,
this.buildPersistenceDescription(item)
);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/views/JpaDetailsView.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/views/JpaDetailsView.java
index 5db8bca38a..224597a1ef 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/views/JpaDetailsView.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/views/JpaDetailsView.java
@@ -18,9 +18,9 @@ import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener;
import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
import org.eclipse.jpt.common.utility.model.value.ModifiablePropertyValueModel;
import org.eclipse.jpt.jpa.core.JpaStructureNode;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
import org.eclipse.jpt.jpa.ui.details.JpaDetailsPageManager;
import org.eclipse.jpt.jpa.ui.internal.JptUiMessages;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
import org.eclipse.jpt.jpa.ui.selection.JpaViewManager;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
@@ -159,7 +159,7 @@ public class JpaDetailsView
try {
this.currentPageManager.setSubject(null);
} catch (RuntimeException ex) {
- JptJpaUiPlugin.log(ex);
+ JptJpaUiPlugin.instance().logError(ex);
}
this.currentPageManager = null;
pageChange = true;
@@ -172,7 +172,7 @@ public class JpaDetailsView
this.currentPageManager.setSubject(node);
pageChange = true;
} catch (RuntimeException ex) {
- JptJpaUiPlugin.log(ex);
+ JptJpaUiPlugin.instance().logError(ex);
this.currentPageManager = null; // leave default page
}
}
@@ -182,7 +182,7 @@ public class JpaDetailsView
try {
this.currentPageManager.setSubject(null);
} catch (RuntimeException ex) {
- JptJpaUiPlugin.log(ex);
+ JptJpaUiPlugin.instance().logError(ex);
}
this.currentPageManager = pageManager;
pageChange = true;
@@ -191,7 +191,7 @@ public class JpaDetailsView
try {
this.currentPageManager.setSubject(node);
} catch (RuntimeException ex) {
- JptJpaUiPlugin.log(ex);
+ JptJpaUiPlugin.instance().logError(ex);
this.currentPageManager = null; // show default page
pageChange = true;
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/views/JpaStructurePage.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/views/JpaStructurePage.java
index f8319f28a0..c657e5c330 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/views/JpaStructurePage.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/views/JpaStructurePage.java
@@ -23,7 +23,6 @@ import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TreeSelection;
import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jpt.common.core.JptResourceType;
import org.eclipse.jpt.common.ui.internal.jface.AbstractSelectionProvider;
import org.eclipse.jpt.common.ui.internal.jface.ItemTreeStateProviderManager;
import org.eclipse.jpt.common.ui.internal.jface.SelectionChangedAdapter;
@@ -263,10 +262,7 @@ public class JpaStructurePage
}
private String buildMissingStructureProviderMessage(JpaFile jpaFile) {
- JptResourceType resourceType = jpaFile.getResourceModel().getResourceType();
- String contentType = resourceType.getContentType().getName();
- String version = resourceType.getVersion();
- return NLS.bind(JptUiMessages.JpaStructureView_structureProviderNotAvailable, contentType, version);
+ return NLS.bind(JptUiMessages.JpaStructureView_structureProviderNotAvailable, jpaFile.getResourceModel().getResourceType());
}
private void setTreeViewerJpaFile(JpaFile jpaFile, ItemTreeStateProviderFactoryProvider factoryProvider) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/JpaFacetActionPage.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/JpaFacetActionPage.java
index e2576706d6..74c4711572 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/JpaFacetActionPage.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/JpaFacetActionPage.java
@@ -1,22 +1,21 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
+ * Copyright (c) 2009, 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
package org.eclipse.jpt.jpa.ui.internal.wizards;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jpt.jpa.core.internal.facet.JpaFacetDataModelProperties;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
import org.eclipse.jpt.jpa.ui.internal.JpaHelpContextIds;
import org.eclipse.jpt.jpa.ui.internal.JptUiIcons;
import org.eclipse.jpt.jpa.ui.internal.JptUiMessages;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
import org.eclipse.jst.common.project.facet.core.libprov.LibraryInstallDelegate;
import org.eclipse.jst.common.project.facet.ui.libprov.LibraryProviderFrameworkUi;
import org.eclipse.swt.SWT;
@@ -44,7 +43,7 @@ public abstract class JpaFacetActionPage
super(pageName);
setTitle(JptUiMessages.JpaFacetWizardPage_title);
setDescription(JptUiMessages.JpaFacetWizardPage_description);
- setImageDescriptor(JptJpaUiPlugin.getImageDescriptor(JptUiIcons.JPA_WIZ_BANNER));
+ setImageDescriptor(JptJpaUiPlugin.instance().buildImageDescriptor(JptUiIcons.JPA_WIZ_BANNER));
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/JpaFacetInstallPage.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/JpaFacetInstallPage.java
index e6f4b843ac..a0f808c624 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/JpaFacetInstallPage.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/JpaFacetInstallPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -9,11 +9,12 @@
******************************************************************************/
package org.eclipse.jpt.jpa.ui.internal.wizards;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.jpt.common.ui.internal.util.SWTUtil;
import org.eclipse.jpt.common.utility.internal.ArrayTools;
import org.eclipse.jpt.jpa.core.internal.facet.JpaFacetInstallDataModelProperties;
import org.eclipse.jpt.jpa.db.ConnectionProfile;
-import org.eclipse.jpt.jpa.db.JptJpaDbPlugin;
+import org.eclipse.jpt.jpa.db.ConnectionProfileFactory;
import org.eclipse.jpt.jpa.db.ui.internal.DTPUiTools;
import org.eclipse.jpt.jpa.ui.internal.JpaHelpContextIds;
import org.eclipse.jpt.jpa.ui.internal.JptUiMessages;
@@ -209,9 +210,13 @@ public class JpaFacetInstallPage
private ConnectionProfile getConnectionProfile() {
// we just use the connection profile to log in, so go to the the db plug-in
- return JptJpaDbPlugin.getConnectionProfileFactory().buildConnectionProfile(model.getStringProperty(CONNECTION));
+ return this.getConnectionProfileFactory().buildConnectionProfile(model.getStringProperty(CONNECTION));
}
-
+
+ private ConnectionProfileFactory getConnectionProfileFactory() {
+ return (ConnectionProfileFactory) ResourcesPlugin.getWorkspace().getAdapter(ConnectionProfileFactory.class);
+ }
+
private void updateConnectLink(ConnectionProfile cp) {
connectLink.setEnabled((cp != null) && cp.isDisconnected());
if (cp != null && cp.isConnected()) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/JpaMakePersistentWizard.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/JpaMakePersistentWizard.java
index 52028ef967..a50e7eeef5 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/JpaMakePersistentWizard.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/JpaMakePersistentWizard.java
@@ -7,7 +7,6 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-
package org.eclipse.jpt.jpa.ui.internal.wizards;
import java.lang.reflect.InvocationTargetException;
@@ -21,13 +20,13 @@ import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
import org.eclipse.jpt.jpa.ui.internal.JptUiIcons;
import org.eclipse.jpt.jpa.ui.internal.JptUiMessages;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
public class JpaMakePersistentWizard extends Wizard {
- public static final String HELP_CONTEXT_ID = JptJpaUiPlugin.PLUGIN_ID + ".GenerateEntitiesFromSchemaWizard"; //$NON-NLS-1$
+ public static final String HELP_CONTEXT_ID = JptJpaUiPlugin.instance().getPluginID() + ".GenerateEntitiesFromSchemaWizard"; //$NON-NLS-1$
final JpaProject jpaProject;
@@ -43,7 +42,7 @@ public class JpaMakePersistentWizard extends Wizard {
this.selectedTypes = selectedTypes;
this.resourceManager = new LocalResourceManager(JFaceResources.getResources());
this.setWindowTitle(JptUiMessages.JpaMakePersistentWizardPage_title);
- this.setDefaultPageImageDescriptor(JptJpaUiPlugin.getImageDescriptor(JptUiIcons.ENTITY_WIZ_BANNER));
+ this.setDefaultPageImageDescriptor(JptJpaUiPlugin.instance().buildImageDescriptor(JptUiIcons.ENTITY_WIZ_BANNER));
}
@Override
@@ -59,7 +58,7 @@ public class JpaMakePersistentWizard extends Wizard {
try {
this.makePersistentWizardPage.performFinish();
} catch (InvocationTargetException e) {
- JptJpaUiPlugin.log(e);
+ JptJpaUiPlugin.instance().logError(e);
}
return true;
}
@@ -67,7 +66,7 @@ public class JpaMakePersistentWizard extends Wizard {
protected PersistenceUnit getPersistenceUnit(JpaProject jpaProject) {
PersistenceXml persistenceXml = jpaProject.getRootContextNode().getPersistenceXml();
if (persistenceXml != null) {
- Persistence persistence = persistenceXml.getPersistence();
+ Persistence persistence = persistenceXml.getRoot();
if (persistence != null && persistence.getPersistenceUnitsSize() > 0) {
return persistence.getPersistenceUnits().iterator().next();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/JpaMakePersistentWizardPage.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/JpaMakePersistentWizardPage.java
index 211713bf87..d833d6b9a3 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/JpaMakePersistentWizardPage.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/JpaMakePersistentWizardPage.java
@@ -43,11 +43,11 @@ import org.eclipse.jface.viewers.ViewerComparator;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.jface.window.Window;
import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
import org.eclipse.jpt.common.core.JptResourceType;
import org.eclipse.jpt.common.ui.internal.utility.SynchronousUiCommandExecutor;
import org.eclipse.jpt.common.ui.internal.utility.swt.SWTTools;
import org.eclipse.jpt.common.utility.command.Command;
+import org.eclipse.jpt.common.utility.internal.ArrayTools;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
@@ -60,7 +60,6 @@ import org.eclipse.jpt.common.utility.model.value.ModifiablePropertyValueModel;
import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.JpaProjectManager;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.JpaRootContextNode;
import org.eclipse.jpt.jpa.core.context.PersistentType;
@@ -68,14 +67,18 @@ import org.eclipse.jpt.jpa.core.context.orm.EntityMappings;
import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
+import org.eclipse.jpt.jpa.core.internal.context.java.JavaSourceFileDefinition;
import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractEntityMappings;
import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceUnit;
+import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmXmlDefinition;
+import org.eclipse.jpt.jpa.core.resource.ResourceMappingFile;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
import org.eclipse.jpt.jpa.ui.JpaPlatformUi;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
import org.eclipse.jpt.jpa.ui.details.MappingUiDefinition;
import org.eclipse.jpt.jpa.ui.internal.JptUiMessages;
import org.eclipse.jpt.jpa.ui.internal.jface.XmlMappingFileViewerFilter;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
import org.eclipse.jpt.jpa.ui.internal.wizards.entity.EntityWizardMsg;
import org.eclipse.jpt.jpa.ui.internal.wizards.orm.EmbeddedMappingFileWizard;
import org.eclipse.swt.SWT;
@@ -123,7 +126,7 @@ public class JpaMakePersistentWizardPage extends WizardPage {
this.jpaProject = jpaProject;
this.selectedTypes = this.buildTypes(selectedTypes);
- this.jptResourceType = JptCommonCorePlugin.JAVA_SOURCE_RESOURCE_TYPE;
+ this.jptResourceType = JavaSourceFileDefinition.instance().getResourceType();
this.helpContextId = helpContextId;
this.annotateInJavaModel = new SimplePropertyValueModel<Boolean>(Boolean.TRUE);
this.mappingFileModel = new SimplePropertyValueModel<String>();
@@ -175,7 +178,7 @@ public class JpaMakePersistentWizardPage extends WizardPage {
javaAnnotationButton.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
JpaMakePersistentWizardPage.this.annotateInJavaModel.setValue(Boolean.TRUE);
- JpaMakePersistentWizardPage.this.jptResourceType = JptCommonCorePlugin.JAVA_SOURCE_RESOURCE_TYPE;
+ JpaMakePersistentWizardPage.this.jptResourceType = JavaSourceFileDefinition.instance().getResourceType();
JpaMakePersistentWizardPage.this.validate();
}
@@ -195,7 +198,7 @@ public class JpaMakePersistentWizardPage extends WizardPage {
public void widgetSelected(SelectionEvent e) {
JpaMakePersistentWizardPage.this.annotateInJavaModel.setValue(Boolean.FALSE);
if (JpaMakePersistentWizardPage.this.isFirstCheck) {
- JpaMakePersistentWizardPage.this.mappingFileModel.setValue(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ JpaMakePersistentWizardPage.this.mappingFileModel.setValue(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
JpaMakePersistentWizardPage.this.isFirstCheck = false;
}
JpaMakePersistentWizardPage.this.validate();
@@ -254,7 +257,7 @@ public class JpaMakePersistentWizardPage extends WizardPage {
public void propertyChanged(PropertyChangeEvent event) {
JpaXmlResource ormXmlResource = getOrmXmlResource();
if (ormXmlResource == null) {
- jptResourceType = JptJpaCorePlugin.ORM_XML_1_0_RESOURCE_TYPE; //just default to 1.0 orm resource type
+ jptResourceType = GenericOrmXmlDefinition.instance().getResourceType(); //just default to 1.0 orm resource type
}
else {
jptResourceType = ormXmlResource.getResourceType();
@@ -317,7 +320,7 @@ public class JpaMakePersistentWizardPage extends WizardPage {
* @return new instance of viewer filter for the SelectMappingXMLDialog
*/
protected ViewerFilter buildMappingFileDialogViewerFilter() {
- return new XmlMappingFileViewerFilter(this.jpaProject, JptJpaCorePlugin.MAPPING_FILE_CONTENT_TYPE);
+ return new XmlMappingFileViewerFilter(this.jpaProject, ResourceMappingFile.Root.CONTENT_TYPE);
}
private void openNewMappingFileWizard() {
@@ -393,7 +396,7 @@ public class JpaMakePersistentWizardPage extends WizardPage {
protected IStructuredContentProvider buildMappingComboCellEditorContentProvider() {
return new IStructuredContentProvider() {
public Object[] getElements(Object inputElement) {
- return CollectionTools.collection(((Type) inputElement).typeMappingUiDefinitions()).toArray();
+ return ArrayTools.array(((Type) inputElement).typeMappingUiDefinitions());
}
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
@@ -423,12 +426,7 @@ public class JpaMakePersistentWizardPage extends WizardPage {
}
protected MappingUiDefinition<? extends PersistentType, ?> getMappingUiDefinition(String mappingKey) {
- for (MappingUiDefinition<? extends PersistentType, ?> provider : typeMappingUiDefinitions(this.jptResourceType)) {
- if (provider.getKey() == mappingKey) {
- return provider;
- }
- }
- throw new IllegalArgumentException();
+ return this.getJpaPlatformUi().getTypeMappingUiDefinition(this.jptResourceType, mappingKey);
}
protected Iterable<String> typeMappingKeys(Iterable<? extends MappingUiDefinition<? extends PersistentType, ?>> mappingUiDefinitions) {
@@ -440,10 +438,6 @@ public class JpaMakePersistentWizardPage extends WizardPage {
};
}
- protected Iterable<? extends MappingUiDefinition<? extends PersistentType, ?>> typeMappingUiDefinitions(JptResourceType jpaResourceType) {
- return CollectionTools.iterable(getJpaPlatformUi().typeMappingUiDefinitions(jpaResourceType));
- }
-
protected void validate() {
String errorMessage = null;
if (this.selectedTypes.length == 0) {
@@ -494,10 +488,10 @@ public class JpaMakePersistentWizardPage extends WizardPage {
try {
this.buildProgressMonitorDialog().run(true, true, runnable); // true => fork; true => cancellable
} catch (InvocationTargetException ex) {
- JptJpaUiPlugin.log(ex);
+ JptJpaUiPlugin.instance().logError(ex);
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
- JptJpaUiPlugin.log(ex);
+ JptJpaUiPlugin.instance().logError(ex);
}
}
@@ -514,7 +508,7 @@ public class JpaMakePersistentWizardPage extends WizardPage {
IDE.openEditor(page, file, true);
}
catch (PartInitException e) {
- JptJpaUiPlugin.log(e);
+ JptJpaUiPlugin.instance().logError(e);
}
}
});
@@ -570,7 +564,7 @@ public class JpaMakePersistentWizardPage extends WizardPage {
}
protected Iterable<? extends MappingUiDefinition<? extends PersistentType, ?>> typeMappingUiDefinitions() {
- return CollectionTools.iterable(getJpaPlatformUi().typeMappingUiDefinitions(JpaMakePersistentWizardPage.this.jptResourceType));
+ return getJpaPlatformUi().getTypeMappingUiDefinitions(JpaMakePersistentWizardPage.this.jptResourceType);
}
}
@@ -849,7 +843,7 @@ public class JpaMakePersistentWizardPage extends WizardPage {
protected Persistence getPersistence() {
PersistenceXml pxml = this.getPersistenceXml();
- return (pxml == null) ? null : pxml.getPersistence();
+ return (pxml == null) ? null : pxml.getRoot();
}
protected PersistenceXml getPersistenceXml() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/NewEntityDropDownAction.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/NewEntityDropDownAction.java
index dc5484761d..7761167424 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/NewEntityDropDownAction.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/NewEntityDropDownAction.java
@@ -33,7 +33,7 @@ import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.window.Window;
import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
import org.eclipse.ui.INewWizard;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowPulldownDelegate2;
@@ -128,7 +128,7 @@ public class NewEntityDropDownAction extends Action implements IMenuCreator, IWo
notifyResult(res == Window.OK);
} catch (CoreException e) {
- JptJpaUiPlugin.log(e);
+ JptJpaUiPlugin.instance().logError(e);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/SelectMappingFileDialog.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/SelectMappingFileDialog.java
index 5e27540411..18506df986 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/SelectMappingFileDialog.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/SelectMappingFileDialog.java
@@ -14,16 +14,14 @@ import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TreeSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jpt.common.core.resource.ProjectResourceLocator;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
import org.eclipse.jpt.jpa.ui.internal.JptUiMessages;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
import org.eclipse.jpt.jpa.ui.internal.wizards.orm.EmbeddedMappingFileWizard;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
@@ -111,10 +109,10 @@ public class SelectMappingFileDialog
TreeSelection selection = (TreeSelection)getTreeViewer().getSelection();
IResource selectedResource = (IResource) selection.getFirstElement();
if (selectedResource instanceof IFile) {
- updateStatus(new Status(IStatus.OK, JptJpaUiPlugin.PLUGIN_ID, "")); //$NON-NLS-1$
+ updateStatus(JptJpaUiPlugin.instance().buildOKStatus());
}
else {
- updateStatus(new Status(IStatus.ERROR, JptJpaUiPlugin.PLUGIN_ID, "")); //$NON-NLS-1$
+ updateStatus(JptJpaUiPlugin.instance().buildErrorStatus());
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/conversion/java/GenericJavaMetadataConversionWizardPage.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/conversion/java/GenericJavaMetadataConversionWizardPage.java
index cb5c6c253f..dec22136d9 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/conversion/java/GenericJavaMetadataConversionWizardPage.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/conversion/java/GenericJavaMetadataConversionWizardPage.java
@@ -13,7 +13,7 @@ import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.ui.internal.wizards.SelectMappingFileDialog;
import org.eclipse.jpt.jpa.ui.internal.wizards.orm.EmbeddedMappingFileWizard;
@@ -26,12 +26,12 @@ public abstract class GenericJavaMetadataConversionWizardPage
@Override
protected IPath getDefaultMappingFileRuntimPath() {
- return JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH;
+ return XmlEntityMappings.DEFAULT_RUNTIME_PATH;
}
@Override
protected IContentType getMappingFileContentType() {
- return JptJpaCorePlugin.ORM_XML_CONTENT_TYPE;
+ return XmlEntityMappings.CONTENT_TYPE;
}
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/conversion/java/JavaMetadataConversionWizard.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/conversion/java/JavaMetadataConversionWizard.java
index fa2d215d37..fe9c24f2cd 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/conversion/java/JavaMetadataConversionWizard.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/conversion/java/JavaMetadataConversionWizard.java
@@ -9,9 +9,9 @@
******************************************************************************/
package org.eclipse.jpt.jpa.ui.internal.wizards.conversion.java;
import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
import org.eclipse.jpt.jpa.ui.internal.JptUiIcons;
import org.eclipse.jpt.jpa.ui.internal.JptUiMessages;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
public class JavaMetadataConversionWizard
extends Wizard
@@ -26,7 +26,7 @@ public class JavaMetadataConversionWizard
}
this.page = page;
this.setWindowTitle(JptUiMessages.JavaMetadataConversionWizard_title);
- this.setDefaultPageImageDescriptor(JptJpaUiPlugin.getImageDescriptor(JptUiIcons.JPA_FILE_WIZ_BANNER));
+ this.setDefaultPageImageDescriptor(JptJpaUiPlugin.instance().buildImageDescriptor(JptUiIcons.JPA_FILE_WIZ_BANNER));
}
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/conversion/java/JavaMetadataConversionWizardPage.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/conversion/java/JavaMetadataConversionWizardPage.java
index 00e608443f..f7de81c380 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/conversion/java/JavaMetadataConversionWizardPage.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/conversion/java/JavaMetadataConversionWizardPage.java
@@ -47,17 +47,17 @@ import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.JpaProjectManager;
import org.eclipse.jpt.jpa.core.JpaStructureNode;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.context.MappingFile;
import org.eclipse.jpt.jpa.core.context.orm.EntityMappings;
import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef;
import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
+import org.eclipse.jpt.jpa.core.resource.ResourceMappingFile;
import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
import org.eclipse.jpt.jpa.ui.internal.JptUiMessages;
import org.eclipse.jpt.jpa.ui.internal.jface.XmlMappingFileViewerFilter;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
import org.eclipse.jpt.jpa.ui.internal.wizards.SelectMappingFileDialog;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
@@ -95,7 +95,7 @@ public abstract class JavaMetadataConversionWizardPage
private final SimplePropertyValueModel<String> mappingFileNameModel = new SimplePropertyValueModel<String>();
private static final String PAGE_NAME = "JavaMetadataConversion"; //$NON-NLS-1$
- public static final String HELP_CONTEXT_ID = JptJpaUiPlugin.PLUGIN_ID_ + PAGE_NAME;
+ public static final String HELP_CONTEXT_ID = JptJpaUiPlugin.instance().getPluginID() + '.' + PAGE_NAME;
protected JavaMetadataConversionWizardPage(JpaProject jpaProject, String title, String description) {
@@ -119,7 +119,7 @@ public abstract class JavaMetadataConversionWizardPage
if (persistenceXml == null) {
return null;
}
- Persistence persistence = persistenceXml.getPersistence();
+ Persistence persistence = persistenceXml.getRoot();
if (persistence == null) {
return null;
}
@@ -150,9 +150,11 @@ public abstract class JavaMetadataConversionWizardPage
for (MappingFileRef ref : this.persistenceUnit.getMappingFileRefs()) {
MappingFile mappingFile = ref.getMappingFile();
if (mappingFile != null) {
- IFile file = mappingFile.getXmlResource().getFile();
- if (this.jpaProject.getJpaFile(file).getContentType().isKindOf(this.getMappingFileContentType())) {
- return file.getFullPath();
+ IResource file = mappingFile.getResource();
+ if (file instanceof IFile) {
+ if (this.jpaProject.getJpaFile((IFile) file).getContentType().isKindOf(this.getMappingFileContentType())) {
+ return file.getFullPath();
+ }
}
}
}
@@ -160,7 +162,7 @@ public abstract class JavaMetadataConversionWizardPage
}
protected IContentType getMappingFileContentType() {
- return JptJpaCorePlugin.MAPPING_FILE_CONTENT_TYPE;
+ return ResourceMappingFile.Root.CONTENT_TYPE;
}
protected IPath convertToRuntimPath(IPath path) {
@@ -407,7 +409,7 @@ public abstract class JavaMetadataConversionWizardPage
try {
this.buildProgressMonitorDialog().run(true, true, this.buildConversionRunnable());
} catch (InvocationTargetException ex) {
- JptJpaUiPlugin.log(ex);
+ JptJpaUiPlugin.instance().logError(ex);
} catch (InterruptedException ex) {
Thread.currentThread().interrupt(); // runnable cancelled
}
@@ -605,7 +607,7 @@ public abstract class JavaMetadataConversionWizardPage
try {
IDE.openEditor(page, this.file);
} catch (PartInitException ex) {
- JptJpaUiPlugin.log(ex);
+ JptJpaUiPlugin.instance().logError(ex);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/EntityClassWizardPage.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/EntityClassWizardPage.java
index 249a70c579..6b0e319422 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/EntityClassWizardPage.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/EntityClassWizardPage.java
@@ -27,11 +27,12 @@ import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.jface.window.Window;
import org.eclipse.jpt.common.core.internal.utility.JDTTools;
+import org.eclipse.jpt.common.core.internal.utility.ProjectTools;
import org.eclipse.jpt.common.utility.internal.ArrayTools;
import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.jpa.core.JpaFacet;
import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.resource.ResourceMappingFile;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
import org.eclipse.jpt.jpa.ui.internal.JpaHelpContextIds;
import org.eclipse.jpt.jpa.ui.internal.jface.XmlMappingFileViewerFilter;
@@ -130,7 +131,7 @@ public class EntityClassWizardPage
boolean isChecked = xmlSupportButton.getSelection();
enableMappingXMLChooseGroup(isChecked);
if (isFirstCheck) {
- ormXmlName.setText(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ ormXmlName.setText(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
isFirstCheck = false;
}
}
@@ -373,7 +374,7 @@ public class EntityClassWizardPage
* @return new instance of viewer filter for the SelectMappingXMLDialog
*/
protected ViewerFilter getDialogViewerFilter(JpaProject jpaProject) {
- return new XmlMappingFileViewerFilter(jpaProject, JptJpaCorePlugin.MAPPING_FILE_CONTENT_TYPE);
+ return new XmlMappingFileViewerFilter(jpaProject, ResourceMappingFile.Root.CONTENT_TYPE);
}
private void enableMappingXMLChooseGroup(boolean enabled) {
@@ -396,7 +397,7 @@ public class EntityClassWizardPage
*/
@Override
protected boolean isProjectValid(IProject project) {
- return (project.isAccessible() && JpaFacet.isInstalled(project));
+ return (project.isAccessible() && ProjectTools.hasFacet(project, JpaProject.FACET));
}
protected final IWorkbenchHelpSystem getHelpSystem() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/EntityRowTableWizardSection.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/EntityRowTableWizardSection.java
index af03ced040..8867be3ec0 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/EntityRowTableWizardSection.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/EntityRowTableWizardSection.java
@@ -47,7 +47,8 @@ import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.window.Window;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
+import org.eclipse.jpt.common.utility.internal.Tools;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
import org.eclipse.jpt.jpa.ui.internal.wizards.entity.data.model.EntityRow;
import org.eclipse.jpt.jpa.ui.internal.wizards.entity.data.model.IEntityDataModelProperties;
import org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties;
@@ -144,7 +145,7 @@ public class EntityRowTableWizardSection extends Composite {
try {
ks = KeyStroke.getInstance("Ctrl+Space");
} catch (ParseException e1) {
- JptJpaUiPlugin.log(e1);
+ JptJpaUiPlugin.instance().logError(e1);
}
}
@@ -428,10 +429,9 @@ public class EntityRowTableWizardSection extends Composite {
return false;
}
public Object[] getElements(Object element) {
- if (element instanceof List) {
- return ((List) element).toArray();
- }
- return new Object[0];
+ return (element instanceof List) ?
+ ((List<?>) element).toArray() :
+ Tools.EMPTY_OBJECT_ARRAY;
}
public void inputChanged(Viewer aViewer, Object oldInput, Object newInput) {
//Default nothing
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/EntityWizard.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/EntityWizard.java
index f077845e53..524dff4b19 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/EntityWizard.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/EntityWizard.java
@@ -22,8 +22,8 @@ import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
import org.eclipse.jpt.jpa.core.context.JpaContextNode;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
import org.eclipse.jpt.jpa.ui.internal.JptUiIcons;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
import org.eclipse.jpt.jpa.ui.internal.wizards.entity.data.model.EntityDataModelProvider;
import org.eclipse.jst.j2ee.internal.plugin.J2EEEditorUtility;
import org.eclipse.ui.INewWizard;
@@ -47,7 +47,7 @@ public class EntityWizard
public EntityWizard(IDataModel model) {
super(model);
setWindowTitle(EntityWizardMsg.ENTITY_WIZARD_TITLE);
- setDefaultPageImageDescriptor(JptJpaUiPlugin.getImageDescriptor(JptUiIcons.ENTITY_WIZ_BANNER));
+ setDefaultPageImageDescriptor(JptJpaUiPlugin.instance().buildImageDescriptor(JptUiIcons.ENTITY_WIZ_BANNER));
}
public EntityWizard(){
@@ -96,7 +96,7 @@ public class EntityWizard
IFile file = (IFile) javaProject.findType(className).getResource();
openEditor(file);
} catch (Exception cantOpen) {
- JptJpaUiPlugin.log(cantOpen);
+ JptJpaUiPlugin.instance().logError(cantOpen);
}
}
@@ -114,7 +114,7 @@ public class EntityWizard
IDE.openEditor(page, file, true);
}
catch (PartInitException e) {
- JptJpaUiPlugin.log(e);
+ JptJpaUiPlugin.instance().logError(e);
}
}
});
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/data/model/CreateEntityTemplateModel.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/data/model/CreateEntityTemplateModel.java
index ee7a6ed4b3..28c1c5ac63 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/data/model/CreateEntityTemplateModel.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/data/model/CreateEntityTemplateModel.java
@@ -23,7 +23,7 @@ import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.Signature;
import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
+import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
import org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties;
import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
import org.eclipse.wst.common.componentcore.internal.operation.IArtifactEditOperationDataModelProperties;
@@ -244,7 +244,7 @@ public class CreateEntityTemplateModel {
if (getMappingXMLName().equals(IEntityDataModelProperties.EMPTY_STRING)) {
return true;
}
- return getMappingXMLName().equals(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
+ return getMappingXMLName().equals(XmlEntityMappings.DEFAULT_RUNTIME_PATH_NAME);
}
public String getMappingXMLName() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/data/model/EntityDataModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/data/model/EntityDataModelProvider.java
index 4ca45e99af..b9193aa13b 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/data/model/EntityDataModelProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/data/model/EntityDataModelProvider.java
@@ -29,11 +29,11 @@ import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.Signature;
import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
+import org.eclipse.jpt.common.core.internal.utility.ProjectTools;
import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.jpa.core.JpaFacet;
import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
import org.eclipse.jpt.jpa.ui.internal.wizards.entity.EntityWizardMsg;
import org.eclipse.jpt.jpa.ui.internal.wizards.entity.data.operation.NewEntityClassOperation;
import org.eclipse.jst.j2ee.internal.common.J2EECommonMessages;
@@ -44,7 +44,6 @@ import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider;
import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin;
-import com.ibm.icu.text.MessageFormat;
public class EntityDataModelProvider extends NewJavaClassDataModelProvider implements IEntityDataModelProperties{
@@ -149,7 +148,7 @@ public class EntityDataModelProvider extends NewJavaClassDataModelProvider imple
}
catch (JavaModelException jme) {
// fall through
- JptJpaUiPlugin.log(jme);
+ JptJpaUiPlugin.instance().logError(jme);
}
return null;
}
@@ -275,14 +274,10 @@ public class EntityDataModelProvider extends NewJavaClassDataModelProvider imple
if (project != null) {
JpaXmlResource ormXmlResource = StringTools.stringIsEmpty(xmlName) ? null : getOrmXmlResource(xmlName);
if (ormXmlResource == null) {
- return new Status(
- IStatus.ERROR, JptJpaUiPlugin.PLUGIN_ID,
- EntityWizardMsg.INVALID_XML_NAME);
+ return JptJpaUiPlugin.instance().buildErrorStatus(EntityWizardMsg.INVALID_XML_NAME);
}
else if (getTargetJpaProject().getJpaFile(ormXmlResource.getFile()).getRootStructureNodesSize() == 0) {
- return new Status(
- IStatus.ERROR, JptJpaUiPlugin.PLUGIN_ID,
- EntityWizardMsg.MAPPING_FILE_NOT_LISTED_ERROR);
+ return JptJpaUiPlugin.instance().buildErrorStatus(EntityWizardMsg.MAPPING_FILE_NOT_LISTED_ERROR);
}
}
}
@@ -327,18 +322,14 @@ public class EntityDataModelProvider extends NewJavaClassDataModelProvider imple
IStatus validateFieldTypeStatus = Status.OK_STATUS;
for (EntityRow entityRow: inputElements) {
if (entityRow.isKey() && !entityRow.couldBeKey()) {
- String message = MessageFormat.format(
- EntityWizardMsg.EntityDataModelProvider_invalidPKType, new Object[]{entityRow.getFqnTypeName()});
- validateFieldTypeStatus = new Status(IStatus.ERROR,
- JptJpaUiPlugin.PLUGIN_ID, message);
+ validateFieldTypeStatus = JptJpaUiPlugin.instance().buildErrorStatus(EntityWizardMsg.EntityDataModelProvider_invalidPKType, entityRow.getFqnTypeName());
break;
}
String sig = null;
try {
sig = Signature.createTypeSignature(entityRow.getFqnTypeName(), true);
- } catch (IllegalArgumentException e) {
- String message = MessageFormat.format(EntityWizardMsg.EntityDataModelProvider_invalidArgument, new Object[]{e.getLocalizedMessage()});
- validateFieldTypeStatus = new Status(IStatus.ERROR, JptJpaUiPlugin.PLUGIN_ID, message);
+ } catch (IllegalArgumentException ex) {
+ validateFieldTypeStatus = JptJpaUiPlugin.instance().buildErrorStatus(EntityWizardMsg.EntityDataModelProvider_invalidArgument, ex.getLocalizedMessage());
break;
}
if (sig == null){
@@ -367,10 +358,7 @@ public class EntityDataModelProvider extends NewJavaClassDataModelProvider imple
for (EntityRow entityRow: inputElements) {
String sig = Signature.createTypeSignature(entityRow.getFqnTypeName() ,true);
if (sig == null) {
- String message = MessageFormat.format(
- EntityWizardMsg.EntityDataModelProvider_typeNotInProjectClasspath, new Object[]{entityRow.getFqnTypeName()});
- validateFieldTypeStatus = new Status(IStatus.ERROR,
- JptJpaUiPlugin.PLUGIN_ID, message);
+ validateFieldTypeStatus = JptJpaUiPlugin.instance().buildErrorStatus(EntityWizardMsg.EntityDataModelProvider_typeNotInProjectClasspath, entityRow.getFqnTypeName());
break;
}
int sigType = Signature.getTypeSignatureKind(sig);
@@ -393,10 +381,7 @@ public class EntityDataModelProvider extends NewJavaClassDataModelProvider imple
break;
}
if (type == null) {
- String message = MessageFormat.format(
- EntityWizardMsg.EntityDataModelProvider_typeNotInProjectClasspath, new Object[]{entityRow.getFqnTypeName()});
- validateFieldTypeStatus = new Status(IStatus.ERROR,
- JptJpaUiPlugin.PLUGIN_ID, message);
+ validateFieldTypeStatus = JptJpaUiPlugin.instance().buildErrorStatus(EntityWizardMsg.EntityDataModelProvider_typeNotInProjectClasspath, entityRow.getFqnTypeName());
break;
}
}
@@ -411,10 +396,7 @@ public class EntityDataModelProvider extends NewJavaClassDataModelProvider imple
break;
}
if (type == null) {
- String message = MessageFormat.format(
- EntityWizardMsg.EntityDataModelProvider_typeNotInProjectClasspath, new Object[]{entityRow.getFqnTypeName()});
- validateFieldTypeStatus = new Status(IStatus.ERROR,
- JptJpaUiPlugin.PLUGIN_ID, message);
+ validateFieldTypeStatus = JptJpaUiPlugin.instance().buildErrorStatus(EntityWizardMsg.EntityDataModelProvider_typeNotInProjectClasspath, entityRow.getFqnTypeName());
break;
}
}
@@ -455,7 +437,7 @@ public class EntityDataModelProvider extends NewJavaClassDataModelProvider imple
protected JpaProject getTargetJpaProject() {
IProject project = getTargetProject();
- return ((project != null) && JpaFacet.isInstalled(project)) ?
+ return ((project != null) && ProjectTools.hasFacet(project, JpaProject.FACET)) ?
this.getJpaProject(project) :
null;
}
@@ -483,7 +465,7 @@ public class EntityDataModelProvider extends NewJavaClassDataModelProvider imple
}
catch (JavaModelException jme) {
// fall through
- JptJpaUiPlugin.log(jme);
+ JptJpaUiPlugin.instance().logError(jme);
}
return null;
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/data/operation/NewEntityClassOperation.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/data/operation/NewEntityClassOperation.java
index 3b6688d619..fc8d99ac1f 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/data/operation/NewEntityClassOperation.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/data/operation/NewEntityClassOperation.java
@@ -11,7 +11,6 @@
***********************************************************************/
package org.eclipse.jpt.jpa.ui.internal.wizards.entity.data.operation;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.URL;
@@ -47,9 +46,9 @@ import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
import org.eclipse.jpt.common.ui.internal.utility.SynchronousUiCommandExecutor;
import org.eclipse.jpt.common.utility.command.Command;
+import org.eclipse.jpt.jpa.core.JpaPreferences;
import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.JpaProjectManager;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.AccessType;
import org.eclipse.jpt.jpa.core.context.Entity;
@@ -58,13 +57,14 @@ import org.eclipse.jpt.jpa.core.context.orm.EntityMappings;
import org.eclipse.jpt.jpa.core.context.orm.OrmIdTypeMapping;
import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMapping;
+import org.eclipse.jpt.jpa.core.internal.context.java.JavaSourceFileDefinition;
import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlJavaClassRef;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistence;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit;
import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
import org.eclipse.jpt.jpa.ui.internal.wizards.entity.AnnotatedEntityTemplate;
import org.eclipse.jpt.jpa.ui.internal.wizards.entity.EntityTemplate;
import org.eclipse.jpt.jpa.ui.internal.wizards.entity.EntityWizardMsg;
@@ -191,7 +191,7 @@ public class NewEntityClassOperation extends AbstractDataModelOperation {
try {
pack = packRoot.createPackageFragment(packName, true, null);
} catch (JavaModelException e) {
- JptJpaUiPlugin.log(e);
+ JptJpaUiPlugin.instance().logError(e);
}
}
// Return the package
@@ -262,7 +262,7 @@ public class NewEntityClassOperation extends AbstractDataModelOperation {
}
if (tempModel.isArtifactsAnnotated()) {
- if ( ! JptJpaCorePlugin.getDiscoverAnnotatedClasses(project)) {
+ if ( ! JpaPreferences.getDiscoverAnnotatedClasses(project)) {
registerClassInPersistenceXml(tempModel, project).schedule();
}
} else {
@@ -334,7 +334,7 @@ public class NewEntityClassOperation extends AbstractDataModelOperation {
cleanUpOldEmitterProject();
WTPJETEmitter emitter = new WTPJETEmitter(templateURL.toString(), this.getClass().getClassLoader());
emitter.setIntelligentLinkingEnabled(true);
- emitter.addVariable(WTP_CUSTOMIZATION_PLUGIN, JptJpaUiPlugin.PLUGIN_ID);
+ emitter.addVariable(WTP_CUSTOMIZATION_PLUGIN, JptJpaUiPlugin.instance().getPluginID());
return emitter.generate(monitor, new Object[] { templateModel });
} else {
Method method = templateImpl.getClass().getMethod(GENERATE_METHOD, new Class[] { Object.class });
@@ -383,7 +383,7 @@ public class NewEntityClassOperation extends AbstractDataModelOperation {
try {
((IFolder) container).create(true, true, null);
} catch (CoreException e) {
- JptJpaUiPlugin.log(e);
+ JptJpaUiPlugin.instance().logError(e);
}
}
// Return the source folder
@@ -456,7 +456,7 @@ public class NewEntityClassOperation extends AbstractDataModelOperation {
try {
xmlResource.saveIfNecessary();
} catch (Exception e) {
- JptJpaUiPlugin.log(e);
+ JptJpaUiPlugin.instance().logError(e);
}
}
@@ -487,7 +487,7 @@ public class NewEntityClassOperation extends AbstractDataModelOperation {
if ( ! this.model.isFieldAccess()) {
accessTypeString = PROPERTY;
}
- return AccessType.fromOrmResourceModel(accessTypeString, getJpaProject().getJpaPlatform(), JptCommonCorePlugin.JAVA_SOURCE_RESOURCE_TYPE);// TODO
+ return AccessType.fromOrmResourceModel(accessTypeString, getJpaProject().getJpaPlatform(), JavaSourceFileDefinition.instance().getResourceType());// TODO
}
protected JpaProject getJpaProject() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/AssociationTablesPage.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/AssociationTablesPage.java
index ae2656d44a..74e2573548 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/AssociationTablesPage.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/AssociationTablesPage.java
@@ -100,7 +100,7 @@ public class AssociationTablesPage extends NewAssociationWizardPage {
browser1.addSelectionListener(new SelectionListener(){
public void widgetDefaultSelected(SelectionEvent e) {}
public void widgetSelected(SelectionEvent e) {
- SelectTableDialog dlg = new SelectTableDialog(Display.getDefault().getActiveShell(), resourceManager, customizer.getTableNames());
+ SelectTableDialog dlg = new SelectTableDialog(SWTUtil.getShell(), resourceManager, customizer.getTableNames());
if( dlg.open() ==Dialog.OK ){
table1TextField.setText( dlg.getSelectedTable() );
getWizardDataModel().put( NewAssociationWizard.ASSOCIATION_REFERRER_TABLE, table1TextField.getText());
@@ -125,7 +125,7 @@ public class AssociationTablesPage extends NewAssociationWizardPage {
browser2.addSelectionListener(new SelectionListener(){
public void widgetDefaultSelected(SelectionEvent e) {}
public void widgetSelected(SelectionEvent e) {
- SelectTableDialog dlg = new SelectTableDialog( Display.getDefault().getActiveShell(), resourceManager, customizer.getTableNames());
+ SelectTableDialog dlg = new SelectTableDialog( SWTUtil.getShell(), resourceManager, customizer.getTableNames());
if( dlg.open() == Dialog.OK){
table2TextField.setText( dlg.getSelectedTable() );
getWizardDataModel().put( NewAssociationWizard.ASSOCIATION_REFERENCED_TABLE, table2TextField.getText());
@@ -152,7 +152,7 @@ public class AssociationTablesPage extends NewAssociationWizardPage {
public void widgetDefaultSelected(SelectionEvent e) {}
public void widgetSelected(SelectionEvent e) {
- SelectTableDialog dlg = new SelectTableDialog( Display.getDefault().getActiveShell(), resourceManager, customizer.getSchema() );
+ SelectTableDialog dlg = new SelectTableDialog( SWTUtil.getShell(), resourceManager, customizer.getSchema() );
if( dlg.open() == Dialog.OK){
joinTableTextField.setText( dlg.getSelectedTable() );
getWizardDataModel().put( NewAssociationWizard.ASSOCIATION_JOIN_TABLE, joinTableTextField.getText() );
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/AssociationsListComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/AssociationsListComposite.java
index 65e1978e48..1b1c043940 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/AssociationsListComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/AssociationsListComposite.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.
@@ -43,7 +43,7 @@ public class AssociationsListComposite extends FigureCanvas {
this.resourceManager = resourceManager;
setBounds(10, 10 , 500, 200);
- Color backgroundColor = new Color(Display.getDefault(), 255,255,255);
+ Color backgroundColor = new Color(getDisplay(), 255,255,255);
setBackground(backgroundColor);
backgroundColor.dispose();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/CascadeDialog.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/CascadeDialog.java
index 5cc417fcde..d899ba2e3b 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/CascadeDialog.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/CascadeDialog.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -12,7 +12,6 @@ package org.eclipse.jpt.jpa.ui.internal.wizards.gen;
import java.util.Collections;
import java.util.List;
-
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.TrayDialog;
@@ -27,7 +26,6 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
@@ -61,7 +59,7 @@ public class CascadeDialog extends TrayDialog {
}
public static CascadeDialog create(AssociationRole role) {
- CascadeDialog dlg = new CascadeDialog(Display.getDefault().getActiveShell() );
+ CascadeDialog dlg = new CascadeDialog(SWTUtil.getShell());
dlg.setAssociationRole(role);
return dlg;
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/ColumnGenPanel.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/ColumnGenPanel.java
index 1dd842dc32..99f700f61f 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/ColumnGenPanel.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/ColumnGenPanel.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -15,7 +15,7 @@ import org.eclipse.jdt.core.JavaConventions;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jpt.jpa.gen.internal.ORMGenColumn;
import org.eclipse.jpt.jpa.gen.internal.ORMGenCustomizer;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
@@ -124,7 +124,7 @@ public class ColumnGenPanel
}
} catch (Exception e) {
- JptJpaUiPlugin.log(e);
+ JptJpaUiPlugin.instance().logError(e);
} finally {
mIsUpdatingControls = false;
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/DatabaseGroup.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/DatabaseGroup.java
index df49880c86..b4d4b6ec2d 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/DatabaseGroup.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/DatabaseGroup.java
@@ -17,6 +17,7 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import java.util.SortedSet;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.resource.ResourceManager;
@@ -29,12 +30,12 @@ import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.db.ConnectionAdapter;
import org.eclipse.jpt.jpa.db.ConnectionListener;
import org.eclipse.jpt.jpa.db.ConnectionProfile;
-import org.eclipse.jpt.jpa.db.JptJpaDbPlugin;
+import org.eclipse.jpt.jpa.db.ConnectionProfileFactory;
import org.eclipse.jpt.jpa.db.Schema;
import org.eclipse.jpt.jpa.db.SchemaContainer;
import org.eclipse.jpt.jpa.db.ui.internal.DTPUiTools;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
import org.eclipse.jpt.jpa.ui.internal.ImageRepository;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
@@ -208,7 +209,7 @@ public class DatabaseGroup
}
private SortedSet<String> buildSortedConnectionProfileNames() {
- return CollectionTools.sortedSet(JptJpaDbPlugin.getConnectionProfileFactory().getConnectionProfileNames());
+ return CollectionTools.sortedSet(this.getConnectionProfileFactory().getConnectionProfileNames());
}
/**
@@ -257,7 +258,11 @@ public class DatabaseGroup
}
private ConnectionProfile buildConnectionProfile(String name) {
- return JptJpaDbPlugin.getConnectionProfileFactory().buildConnectionProfile(name);
+ return this.getConnectionProfileFactory().buildConnectionProfile(name);
+ }
+
+ private ConnectionProfileFactory getConnectionProfileFactory() {
+ return (ConnectionProfileFactory) ResourcesPlugin.getWorkspace().getAdapter(ConnectionProfileFactory.class);
}
@@ -334,7 +339,7 @@ public class DatabaseGroup
DatabaseGroup.this.selectedConnectionProfile.connect();
}
catch (Exception ex) {
- JptJpaUiPlugin.log(ex);
+ JptJpaUiPlugin.instance().logError(ex);
}
finally {
finished.setTrue();
@@ -353,7 +358,7 @@ public class DatabaseGroup
});
}
catch (Exception e) {
- JptJpaUiPlugin.log(e);
+ JptJpaUiPlugin.instance().logError(e);
}
this.wizardContainer.updateButtons();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/DefaultTableGenerationWizardPage.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/DefaultTableGenerationWizardPage.java
index 073ac6c3c6..410df7ccc0 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/DefaultTableGenerationWizardPage.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/DefaultTableGenerationWizardPage.java
@@ -37,8 +37,8 @@ import org.eclipse.jpt.common.core.internal.utility.JDTTools;
import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.gen.internal.ORMGenCustomizer;
import org.eclipse.jpt.jpa.gen.internal.ORMGenTable;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
import org.eclipse.jpt.jpa.ui.internal.JpaHelpContextIds;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
@@ -244,7 +244,7 @@ public class DefaultTableGenerationWizardPage extends NewTypeWizardPage {
}
return true;
} catch (JavaModelException e) {
- JptJpaUiPlugin.log(e); // just log, no UI in validation
+ JptJpaUiPlugin.instance().logError(e); // just log, no UI in validation
}
return false;
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/GenerateEntitiesFromSchemaWizard.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/GenerateEntitiesFromSchemaWizard.java
index a614146131..177aece056 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/GenerateEntitiesFromSchemaWizard.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/GenerateEntitiesFromSchemaWizard.java
@@ -12,7 +12,6 @@ package org.eclipse.jpt.jpa.ui.internal.wizards.gen;
import java.io.File;
import java.io.IOException;
-
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceRuleFactory;
@@ -40,8 +39,8 @@ import org.eclipse.jpt.common.ui.internal.dialogs.OptionalMessageDialog;
import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.jpa.core.EntityGeneratorDatabaseAnnotationNameBuilder;
import org.eclipse.jpt.jpa.core.JpaPlatform;
+import org.eclipse.jpt.jpa.core.JpaPreferences;
import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.prefs.JpaEntityGenPreferencesManager;
import org.eclipse.jpt.jpa.db.Column;
import org.eclipse.jpt.jpa.db.ConnectionProfile;
import org.eclipse.jpt.jpa.db.ForeignKey;
@@ -52,9 +51,9 @@ import org.eclipse.jpt.jpa.gen.internal.DatabaseAnnotationNameBuilder;
import org.eclipse.jpt.jpa.gen.internal.ORMGenCustomizer;
import org.eclipse.jpt.jpa.gen.internal.ORMGenTable;
import org.eclipse.jpt.jpa.gen.internal.PackageGenerator;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
import org.eclipse.jpt.jpa.ui.internal.JptUiIcons;
import org.eclipse.jpt.jpa.ui.internal.JptUiMessages;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
@@ -65,7 +64,7 @@ import org.eclipse.ui.IWorkbench;
public class GenerateEntitiesFromSchemaWizard extends Wizard
implements INewWizard {
- public static final String HELP_CONTEXT_ID = JptJpaUiPlugin.PLUGIN_ID + ".GenerateEntitiesFromSchemaWizard"; //$NON-NLS-1$
+ public static final String HELP_CONTEXT_ID = JptJpaUiPlugin.instance().getPluginID() + ".GenerateEntitiesFromSchemaWizard"; //$NON-NLS-1$
protected JpaProject jpaProject;
@@ -96,7 +95,7 @@ public class GenerateEntitiesFromSchemaWizard extends Wizard
this.selection = selection;
this.resourceManager = new LocalResourceManager(JFaceResources.getResources());
this.setWindowTitle( JptUiEntityGenMessages.GenerateEntitiesWizard_generateEntities);
- this.setDefaultPageImageDescriptor(JptJpaUiPlugin.getImageDescriptor(JptUiIcons.ENTITY_WIZ_BANNER));
+ this.setDefaultPageImageDescriptor(JptJpaUiPlugin.instance().buildImageDescriptor(JptUiIcons.ENTITY_WIZ_BANNER));
}
@Override
@@ -182,8 +181,7 @@ public class GenerateEntitiesFromSchemaWizard extends Wizard
}
}
else if (newDefaultTable.getPackage().equals(StringTools.EMPTY_STRING)) {
- JpaEntityGenPreferencesManager preferencesManager = this.buildEntityGenPreferencesManager();
- newDefaultTable.setPackage(preferencesManager.getDefaultPackagePreference());
+ newDefaultTable.setPackage(JpaPreferences.getEntityGenDefaultPackageName(this.jpaProject.getProject()));
}
return this.customizer;
@@ -224,7 +222,7 @@ public class GenerateEntitiesFromSchemaWizard extends Wizard
this.customizer.setDatabaseAnnotationNameBuilder(this.buildDatabaseAnnotationNameBuilder());
this.customizer.save();
} catch (IOException e) {
- JptJpaUiPlugin.log(e);
+ JptJpaUiPlugin.instance().logError(e);
}
OverwriteConfirmer overwriteConfirmer = null;
if (showOverwriteWarning()) {
@@ -240,10 +238,6 @@ public class GenerateEntitiesFromSchemaWizard extends Wizard
WorkspaceJob genEntitiesJob = new GenerateEntitiesJob(this.jpaProject, getCustomizer(), overwriteConfirmer, false);
genEntitiesJob.schedule();
}
-
- private JpaEntityGenPreferencesManager buildEntityGenPreferencesManager() {
- return new JpaEntityGenPreferencesManager(this.jpaProject.getProject());
- }
// ********** generate entities job **********
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/SWTUtil.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/SWTUtil.java
index c295097241..3687043fcd 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/SWTUtil.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/SWTUtil.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -16,6 +16,7 @@ import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
/**
@@ -129,5 +130,8 @@ public class SWTUtil {
text.setLayoutData(gd);
return text;
}
-
+
+ public static Shell getShell() {
+ return org.eclipse.jpt.common.ui.internal.util.SWTUtil.getShell();
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/TableAssociationsWizardPage.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/TableAssociationsWizardPage.java
index 8c2df9cb3e..18dc270975 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/TableAssociationsWizardPage.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/TableAssociationsWizardPage.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.
@@ -7,18 +7,14 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-
package org.eclipse.jpt.jpa.ui.internal.wizards.gen;
import static org.eclipse.jpt.jpa.ui.internal.wizards.gen.SWTUtil.fillColumns;
import static org.eclipse.jpt.jpa.ui.internal.wizards.gen.SWTUtil.newLabel;
import static org.eclipse.jpt.jpa.ui.internal.wizards.gen.SWTUtil.newLabelWithIndent;
-
import java.util.List;
-
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
import org.eclipse.jdt.core.JavaConventions;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.internal.ui.dialogs.StatusUtil;
@@ -50,7 +46,6 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.PlatformUI;
@@ -151,7 +146,7 @@ public class TableAssociationsWizardPage extends WizardPage {
});
deleteAssociationLink = new Button(c, SWT.NONE);
- Color foreground = new Color(Display.getDefault(), 0,0,255);
+ Color foreground = new Color(deleteAssociationLink.getDisplay(), 0,0,255);
deleteAssociationLink.setForeground(foreground);
foreground.dispose();
deleteAssociationLink.setImage( ImageRepository.getDeleteButtonImage(this.resourceManager));
@@ -313,7 +308,7 @@ public class TableAssociationsWizardPage extends WizardPage {
setPageComplete(!status.matches(IStatus.ERROR));
StatusUtil.applyToStatusLine(this, status);
- if( status.getCode() == Status.OK ){
+ if( status.getCode() == IStatus.OK ){
setMessage(JptUiEntityGenMessages.GenerateEntitiesWizard_assocPage_desc);
}
}
@@ -500,7 +495,7 @@ public class TableAssociationsWizardPage extends WizardPage {
private void createAssociationsListPanel(Composite parent) {
Composite composite = new Composite( parent, SWT.NULL );
composite.setLayout( new FillLayout());
- Color backgroundColor = new Color(Display.getDefault(),255, 0,0);
+ Color backgroundColor = new Color(composite.getDisplay(),255, 0,0);
composite.setBackground(backgroundColor);
backgroundColor.dispose();
GridData layoutData = new GridData();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/TableGenPanel.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/TableGenPanel.java
index 06ab291530..7a1428d7f3 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/TableGenPanel.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/TableGenPanel.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2012 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -15,7 +15,7 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.jdt.core.JavaConventions;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.jpt.jpa.gen.internal.ORMGenTable;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
@@ -227,7 +227,7 @@ public class TableGenPanel
} catch (Exception e) {
- JptJpaUiPlugin.log(e);
+ JptJpaUiPlugin.instance().logError(e);
}
isUpdatingControls = false;
@@ -381,7 +381,7 @@ public class TableGenPanel
sequenceNameNoteLabel.setEnabled(false);
} else {
sequenceNameField.setEnabled(true);
- Color NOTE_LABEL_COLOR = new Color( Display.getDefault(), 102,102,102);
+ Color NOTE_LABEL_COLOR = new Color( sequenceNameField.getDisplay(), 102,102,102);
sequenceNameNoteLabel.setForeground( NOTE_LABEL_COLOR );
NOTE_LABEL_COLOR.dispose();
sequenceNameNoteLabel.setEnabled(true);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/TablesSelectorWizardPage.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/TablesSelectorWizardPage.java
index 4e3c1c0da1..277cde2fab 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/TablesSelectorWizardPage.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/TablesSelectorWizardPage.java
@@ -50,10 +50,10 @@ import org.eclipse.jpt.jpa.db.ConnectionProfile;
import org.eclipse.jpt.jpa.db.Schema;
import org.eclipse.jpt.jpa.db.Table;
import org.eclipse.jpt.jpa.gen.internal.ORMGenCustomizer;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
import org.eclipse.jpt.jpa.ui.internal.ImageRepository;
import org.eclipse.jpt.jpa.ui.internal.JpaHelpContextIds;
import org.eclipse.jpt.jpa.ui.internal.JptUiMessages;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.KeyAdapter;
@@ -339,7 +339,7 @@ public class TablesSelectorWizardPage extends WizardPage {
gridData.grabExcessHorizontalSpace = true;
gridData.grabExcessVerticalSpace = true ;
- Color backgroundColor = new Color(Display.getDefault(), 255, 0,0);
+ Color backgroundColor = new Color(parent.getDisplay(), 255, 0,0);
parent.setLayoutData(gridData);
parent.setBackground(backgroundColor);
backgroundColor.dispose();
@@ -659,7 +659,7 @@ public class TablesSelectorWizardPage extends WizardPage {
});
}
catch (Exception e) {
- JptJpaUiPlugin.log(e);
+ JptJpaUiPlugin.instance().logError(e);
}
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/orm/MappingFileWizard.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/orm/MappingFileWizard.java
index be989b2570..d84d85e1ef 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/orm/MappingFileWizard.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/orm/MappingFileWizard.java
@@ -23,7 +23,6 @@ import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -33,17 +32,17 @@ import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
+import org.eclipse.jpt.common.core.internal.utility.ProjectTools;
import org.eclipse.jpt.common.core.resource.ProjectResourceLocator;
-import org.eclipse.jpt.jpa.core.JpaFacet;
import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.context.JpaContextNode;
import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
import org.eclipse.jpt.jpa.core.internal.operations.OrmFileCreationDataModelProvider;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
import org.eclipse.jpt.jpa.ui.internal.JptUiIcons;
import org.eclipse.jpt.jpa.ui.internal.JptUiMessages;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.INewWizard;
@@ -82,7 +81,7 @@ public class MappingFileWizard extends Wizard
super();
this.dataModel = dataModel;
setWindowTitle(JptUiMessages.MappingFileWizard_title);
- setDefaultPageImageDescriptor(JptJpaUiPlugin.getImageDescriptor(JptUiIcons.JPA_FILE_WIZ_BANNER));
+ setDefaultPageImageDescriptor(JptJpaUiPlugin.instance().buildImageDescriptor(JptUiIcons.JPA_FILE_WIZ_BANNER));
}
@@ -121,7 +120,7 @@ public class MappingFileWizard extends Wizard
if (jpaProject != null) {
PersistenceXml persistenceXml = jpaProject.getRootContextNode().getPersistenceXml();
if (persistenceXml != null){
- Persistence persistence = persistenceXml.getPersistence();
+ Persistence persistence = persistenceXml.getRoot();
if ((persistence != null) && (persistence.getPersistenceUnitsSize() > 0)) {
return persistence.getPersistenceUnit(0);
}
@@ -180,7 +179,7 @@ public class MappingFileWizard extends Wizard
}
private IContainer getDefaultContainer(IProject project) {
- if (JpaFacet.isInstalled(project)) {
+ if (ProjectTools.hasFacet(project, JpaProject.FACET)) {
ProjectResourceLocator locator = (ProjectResourceLocator) project.getAdapter(ProjectResourceLocator.class);
return locator.getDefaultResourceLocation();
}
@@ -237,7 +236,7 @@ public class MappingFileWizard extends Wizard
try {
postPerformFinish();
} catch (Exception e) {
- JptJpaUiPlugin.log(e);
+ JptJpaUiPlugin.instance().logError(e);
}
return true;
}
@@ -264,7 +263,7 @@ public class MappingFileWizard extends Wizard
}
}
catch (Exception e) {
- JptJpaUiPlugin.log(e);
+ JptJpaUiPlugin.instance().logError(e);
ErrorDialog.openError(
getShell(),
WTPCommonUIResourceHandler.getString(WTPCommonUIResourceHandler.WTPWizard_UI_0, new Object[]{getWindowTitle()}),
@@ -304,15 +303,14 @@ public class MappingFileWizard extends Wizard
if (runnable.caught == null) {
return runnable.status;
}
- else {
- JptJpaUiPlugin.log(runnable.caught);
- ErrorDialog.openError(
- getShell(),
- WTPCommonUIResourceHandler.getString(WTPCommonUIResourceHandler.WTPWizard_UI_0, new Object[]{getWindowTitle()}),
- WTPCommonUIResourceHandler.getString(WTPCommonUIResourceHandler.WTPWizard_UI_1, new Object[]{getWindowTitle()}),
- runnable.caught, 0, false);
- return new Status(IStatus.ERROR, "id", 0, runnable.caught.getMessage(), runnable.caught); //$NON-NLS-1$
- }
+
+ JptJpaUiPlugin.instance().logError(runnable.caught);
+ ErrorDialog.openError(
+ getShell(),
+ WTPCommonUIResourceHandler.getString(WTPCommonUIResourceHandler.WTPWizard_UI_0, new Object[]{getWindowTitle()}),
+ WTPCommonUIResourceHandler.getString(WTPCommonUIResourceHandler.WTPWizard_UI_1, new Object[]{getWindowTitle()}),
+ runnable.caught, 0, false);
+ return JptJpaUiPlugin.instance().buildErrorStatus(runnable.caught);
}
protected void postPerformFinish()
@@ -339,7 +337,7 @@ public class MappingFileWizard extends Wizard
IDE.openEditor(page, file, true);
}
catch (PartInitException e) {
- JptJpaUiPlugin.log(e);
+ JptJpaUiPlugin.instance().logError(e);
}
}
});
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/proj/JpaProjectWizard.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/proj/JpaProjectWizard.java
index c467795ea4..5a251e2237 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/proj/JpaProjectWizard.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/proj/JpaProjectWizard.java
@@ -1,19 +1,19 @@
/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
+ * Copyright (c) 2010, 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
package org.eclipse.jpt.jpa.ui.internal.wizards.proj;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jpt.jpa.ui.JptJpaUiPlugin;
import org.eclipse.jpt.jpa.ui.internal.JptUiIcons;
import org.eclipse.jpt.jpa.ui.internal.JptUiMessages;
+import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
import org.eclipse.jpt.jpa.ui.internal.wizards.proj.model.JpaProjectCreationDataModelProvider;
import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
@@ -37,7 +37,7 @@ public class JpaProjectWizard
@Override
protected ImageDescriptor getDefaultPageImageDescriptor() {
- return JptJpaUiPlugin.getImageDescriptor(JptUiIcons.JPA_WIZ_BANNER);
+ return JptJpaUiPlugin.instance().buildImageDescriptor(JptUiIcons.JPA_WIZ_BANNER);
}
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/proj/JpaProjectWizardFirstPage.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/proj/JpaProjectWizardFirstPage.java
index 33b11a0b74..e58a77c463 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/proj/JpaProjectWizardFirstPage.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/proj/JpaProjectWizardFirstPage.java
@@ -11,7 +11,7 @@ package org.eclipse.jpt.jpa.ui.internal.wizards.proj;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-import org.eclipse.jpt.jpa.core.JpaFacet;
+import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.internal.facet.FacetTools;
import org.eclipse.jpt.jpa.ui.internal.JpaHelpContextIds;
import org.eclipse.jpt.jpa.ui.internal.JptUiMessages;
@@ -62,7 +62,7 @@ public class JpaProjectWizardFirstPage
@Override
protected String getModuleTypeID() {
- return JpaFacet.ID;
+ return JpaProject.FACET_ID;
}
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/proj/model/JpaProjectCreationDataModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/proj/model/JpaProjectCreationDataModelProvider.java
index 156ef59942..4c0befabdc 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/proj/model/JpaProjectCreationDataModelProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/proj/model/JpaProjectCreationDataModelProvider.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
+ * Copyright (c) 2010, 2012 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0, which accompanies this distribution
+ * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
package org.eclipse.jpt.jpa.ui.internal.wizards.proj.model;
import java.util.ArrayList;
@@ -20,7 +20,7 @@ import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
-import org.eclipse.jpt.jpa.core.JpaFacet;
+import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.internal.facet.FacetTools;
import org.eclipse.jst.common.project.facet.core.JavaFacet;
import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
@@ -85,7 +85,7 @@ public class JpaProjectCreationDataModelProvider
Collection<IProjectFacet> requiredFacets = new ArrayList<IProjectFacet>();
requiredFacets.add(JavaFacet.FACET);
- requiredFacets.add(JpaFacet.FACET);
+ requiredFacets.add(JpaProject.FACET);
setProperty(REQUIRED_FACETS_COLLECTION, requiredFacets);
getDataModel().addListener(

Back to the top