Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.ui')
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/.classpath13
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/.cvsignore6
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/.project28
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/.settings/org.eclipse.core.resources.prefs3
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/META-INF/MANIFEST.MF58
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/about.html34
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/build.properties21
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/component.xml1
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/icons/full/dtool16/new_jpaproject_wiz.gifbin372 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/icons/full/etool16/jpa_facet.gifbin896 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/icons/full/etool16/new_jpaproject_wiz.gifbin991 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/icons/full/eview16/jpa_details.gifbin953 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/icons/full/eview16/jpa_perspective.gifbin896 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/icons/full/eview16/jpa_structure.gifbin900 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/basic.gifbin897 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/embeddable.gifbin1003 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/embedded-id.gifbin953 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/embedded.gifbin905 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/entity-mappings.gifbin974 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/entity.gifbin1010 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/id.gifbin938 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/many-to-many.gifbin328 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/many-to-one.gifbin307 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/mapped-superclass.gifbin1005 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/null-attribute-mapping.gifbin911 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/null-type-mapping.gifbin586 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/one-to-many.gifbin306 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/one-to-one.gifbin283 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/persistence-unit.gifbin931 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/persistence.gifbin961 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/transient.gifbin892 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/version.gifbin321 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/icons/full/wizban/jpa_facet_wizban.gifbin3485 -> 0 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/plugin.properties50
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/plugin.xml314
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui.properties79
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui_mappings.properties185
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui_xml.properties36
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/schema/jpaPlatform.exsd119
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/AsynchronousUiCommandExecutor.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/BaseJpaPlatformUi.java194
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/BaseJpaUiFactory.java85
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/GenericJpaUiFactory.java16
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/IJpaHelpContextIds.java109
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/IJpaPlatformUi.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/IJpaUiFactory.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/JpaCompletionProposalComputer.java123
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/JptUiIcons.java16
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/JptUiMessages.java151
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/JptUiPlugin.java63
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/PlatformRegistry.java164
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/SWTChangeEventDispatcherPlatformAdapter.java82
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/SynchronousUiCommandExecutor.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/AddPersistentAttributeToXmlAction.java40
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/AddPersistentAttributeToXmlAndMapAction.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/AddPersistentClassAction.java49
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/GenerateDDLAction.java26
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/GenerateEntitiesAction.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/PersistentAttributeActionFilter.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/ProjectAction.java94
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/RemovePersistentAttributeFromXmlAction.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/RemovePersistentClassAction.java44
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/SynchronizeClassesAction.java39
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/XmlPersistentAttributeActionFilter.java58
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/BaseJpaComposite.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/BaseJpaController.java110
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/BaseJpaDetailsPage.java63
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/IJpaComposite.java22
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/IJpaDetailsPage.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/IJpaDetailsProvider.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/PageBookManager.java167
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/PersistentAttributeDetailsPage.java300
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/PersistentTypeDetailsPage.java271
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/dialogs/AddPersistentAttributeToXmlAndMapDialog.java184
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/dialogs/AddPersistentClassDialog.java274
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/generic/EntitiesGenerator.java293
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/generic/GenericPlatformUi.java44
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/IAttributeMappingUiProvider.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/ITypeMappingUiProvider.java44
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaDetailsProvider.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaPersistentAttributeDetailsPage.java101
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaPersistentTypeDetailsPage.java66
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/BasicMappingUiProvider.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/DefaultBasicMappingUiProvider.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/DefaultEmbeddedMappingUiProvider.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/EmbeddableUiProvider.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/EmbeddedIdMappingUiProvider.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/EmbeddedMappingUiProvider.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/EntityUiProvider.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/IdMappingUiProvider.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/ManyToManyMappingUiProvider.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/ManyToOneMappingUiProvider.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/MappedSuperclassUiProvider.java51
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/NullAttributeMappingUiProvider.java76
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/NullTypeMappingUiProvider.java76
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/OneToManyMappingUiProvider.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/OneToOneMappingUiProvider.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/TransientMappingUiProvider.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/VersionMappingUiProvider.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/structure/JavaCompilationUnitItemProvider.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/structure/JavaPersistentAttributeItemProvider.java101
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/structure/JavaPersistentTypeItemProvider.java98
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/structure/JavaStructureProvider.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/structure/JpaCoreJavaItemProviderAdapterFactory.java176
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/NullLabelProvider.java43
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/NullTreeContentProvider.java44
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/JptUiMappingsImages.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/JptUiMappingsMessages.java205
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/AbstractJoinColumnDialog.java183
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/BasicComposite.java357
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/CascadeComposite.java378
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/CatalogCombo.java304
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/ColumnComposite.java566
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/CommonWidgets.java304
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EmbeddableComposite.java114
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EmbeddedAttributeOverridesComposite.java338
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EmbeddedComposite.java67
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EmbeddedIdComposite.java43
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EntityComposite.java213
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EntityNameCombo.java165
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EnumComboViewer.java206
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/GeneratedValueComposite.java287
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/GeneratorComposite.java167
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/IdComposite.java459
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/InheritanceComposite.java620
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/InverseJoinColumnDialog.java81
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnComposite.java428
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnDialog.java208
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnInAssociationOverrideDialog.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnInJoinTableDialog.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnInRelationshipMappingDialog.java56
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnsComposite.java348
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinTableComposite.java472
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/LobCheckBox.java129
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/ManyToManyComposite.java184
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/ManyToOneComposite.java145
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/MappedByCombo.java162
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/MappedSuperclassComposite.java114
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/OneToManyComposite.java187
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/OneToOneComposite.java226
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/OrderingComposite.java309
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/OverridesComposite.java501
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/PrimaryKeyJoinColumnDialog.java37
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/PrimaryKeyJoinColumnInSecondaryTableDialog.java37
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/PrimaryKeyJoinColumnsComposite.java405
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/PrimaryKeyJoinColumnsInSecondaryTableComposite.java413
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/SchemaCombo.java327
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/SecondaryTableDialog.java247
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/SecondaryTablesComposite.java388
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/SequenceGeneratorComposite.java185
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/StringWithDefaultChooser.java274
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TableCombo.java338
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TableComposite.java129
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TableGeneratorComposite.java535
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TargetEntityChooser.java226
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TransientComposite.java43
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/VersionComposite.java165
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/perspective/JpaPerspectiveFactory.java77
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/prefs/JpaPreferencePage.java205
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/properties/DataModelPropertyPage.java309
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/properties/JpaProjectPropertiesPage.java425
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/ISelectionManager.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/ISelectionParticipant.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/JpaDetailsSelectionParticipant.java42
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/JpaStructureSelectionParticipant.java67
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/Selection.java71
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/SelectionEvent.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/SelectionManager.java279
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/SelectionManagerFactory.java99
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/SelectionParticipantFactory.java49
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/TextEditorSelectionParticipant.java177
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/IJpaStructureProvider.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/util/SWTUtil.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/util/TableLayoutComposite.java191
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/views/AbstractJpaView.java79
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/views/JpaDetailsView.java162
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/views/JpaStructureView.java218
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/CComboViewer.java154
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/ScrolledPageContent.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/DatabaseReconnectWizardPage.java354
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/GenerateEntitiesWizard.java163
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/GenerateEntitiesWizardPage.java508
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/JpaFacetWizardPage.java494
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/NewJpaProjectFirstPage.java24
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/NewJpaProjectWizard.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/JptUiXmlMessages.java51
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/AccessTypeComboViewer.java184
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/CascadePersistCheckBox.java128
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/CommonWidgets.java80
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/MetaDataCompleteComboViewer.java154
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/PersistenceUnitMetadataSection.java285
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlDetailsProvider.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlEntityMappingsDetailsPage.java274
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlJavaAttributeChooser.java133
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlJavaClassChooser.java250
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlMappingMetadataCompleteCheckBox.java128
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlPackageChooser.java256
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlPersistentAttributeDetailsPage.java223
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlPersistentTypeDetailsPage.java184
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/structure/EntityMappingsItemProvider.java73
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/structure/JpaCoreXmlItemProviderAdapterFactory.java197
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/structure/XmlPersistentAttributeItemProvider.java116
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/structure/XmlPersistentTypeItemProvider.java96
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/structure/XmlRootContentNodeItemProvider.java55
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/structure/XmlStructureProvider.java36
206 files changed, 0 insertions, 26173 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.ui/.classpath b/jpa/plugins/org.eclipse.jpt.ui/.classpath
deleted file mode 100644
index 5ee7c76127..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/.classpath
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="src" path="property_files"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
- <accessrules>
- <accessrule kind="accessible" pattern="org/eclipse/wst/**"/>
- <accessrule kind="accessible" pattern="org/eclipse/jst/**"/>
- </accessrules>
- </classpathentry>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/jpa/plugins/org.eclipse.jpt.ui/.cvsignore b/jpa/plugins/org.eclipse.jpt.ui/.cvsignore
deleted file mode 100644
index a196dd7686..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/.cvsignore
+++ /dev/null
@@ -1,6 +0,0 @@
-bin
-@dot
-temp.folder
-build.xml
-javaCompiler...args
-javaCompiler...args.* \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/.project b/jpa/plugins/org.eclipse.jpt.ui/.project
deleted file mode 100644
index 50ef9e3305..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.jpt.ui</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/jpa/plugins/org.eclipse.jpt.ui/.settings/org.eclipse.core.resources.prefs b/jpa/plugins/org.eclipse.jpt.ui/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index 8f3899b660..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,3 +0,0 @@
-#Sun May 27 15:11:25 EDT 2007
-eclipse.preferences.version=1
-encoding/<project>=ISO-8859-1
diff --git a/jpa/plugins/org.eclipse.jpt.ui/.settings/org.eclipse.jdt.core.prefs b/jpa/plugins/org.eclipse.jpt.ui/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index d909c105d5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,7 +0,0 @@
-#Sun May 27 14:55:01 EDT 2007
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.5
diff --git a/jpa/plugins/org.eclipse.jpt.ui/META-INF/MANIFEST.MF b/jpa/plugins/org.eclipse.jpt.ui/META-INF/MANIFEST.MF
deleted file mode 100644
index d7adba7f45..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,58 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-Vendor: %providerName
-Bundle-SymbolicName: org.eclipse.jpt.ui;singleton:=true
-Bundle-Version: 1.0.100.qualifier
-Bundle-Activator: org.eclipse.jpt.ui.internal.JptUiPlugin
-Bundle-ClassPath: .
-Bundle-Localization: plugin
-Require-Bundle: org.eclipse.core.resources,
- org.eclipse.core.runtime,
- org.eclipse.draw2d,
- org.eclipse.emf.edit.ui,
- org.eclipse.jdt.core,
- org.eclipse.jdt.ui,
- org.eclipse.jem,
- org.eclipse.jface.text,
- org.eclipse.jpt.core,
- org.eclipse.jpt.db,
- org.eclipse.jpt.db.ui,
- org.eclipse.jpt.gen,
- org.eclipse.jpt.utility,
- org.eclipse.jst.j2ee.ui,
- org.eclipse.ui.ide,
- org.eclipse.ui.views.properties.tabbed,
- org.eclipse.ui.workbench.texteditor,
- org.eclipse.wst.common.frameworks,
- org.eclipse.wst.common.frameworks.ui,
- org.eclipse.wst.common.modulecore,
- org.eclipse.wst.common.project.facet.core,
- org.eclipse.wst.common.project.facet.ui,
- org.eclipse.wst.sse.ui,
- org.eclipse.wst.web.ui
-Eclipse-LazyStart: true
-Export-Package: org.eclipse.jpt.ui.internal;x-friends:="org.eclipse.jpt.core.tests.extension.resource,org.eclipse.jpt.ui.tests",
- org.eclipse.jpt.ui.internal.actions;x-internal:=true,
- org.eclipse.jpt.ui.internal.details;x-friends:="org.eclipse.jpt.core.tests.extension.resource",
- org.eclipse.jpt.ui.internal.dialogs;x-internal:=true,
- org.eclipse.jpt.ui.internal.generic;x-friends:="org.eclipse.jpt.ui.tests",
- org.eclipse.jpt.ui.internal.java.details;x-friends:="org.eclipse.jpt.core.tests.extension.resource",
- org.eclipse.jpt.ui.internal.java.mappings.properties;x-internal:=true,
- org.eclipse.jpt.ui.internal.java.structure;x-internal:=true,
- org.eclipse.jpt.ui.internal.jface;x-internal:=true,
- org.eclipse.jpt.ui.internal.mappings;x-internal:=true,
- org.eclipse.jpt.ui.internal.mappings.details;x-internal:=true,
- org.eclipse.jpt.ui.internal.perspective;x-internal:=true,
- org.eclipse.jpt.ui.internal.prefs;x-internal:=true,
- org.eclipse.jpt.ui.internal.properties;x-internal:=true,
- org.eclipse.jpt.ui.internal.selection;x-internal:=true,
- org.eclipse.jpt.ui.internal.structure;x-friends:="org.eclipse.jpt.core.tests.extension.resource",
- org.eclipse.jpt.ui.internal.util;x-internal:=true,
- org.eclipse.jpt.ui.internal.views;x-internal:=true,
- org.eclipse.jpt.ui.internal.widgets;x-internal:=true,
- org.eclipse.jpt.ui.internal.wizards;x-internal:=true,
- org.eclipse.jpt.ui.internal.xml;x-internal:=true,
- org.eclipse.jpt.ui.internal.xml.details;x-internal:=true,
- org.eclipse.jpt.ui.internal.xml.structure;x-internal:=true
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/jpa/plugins/org.eclipse.jpt.ui/about.html b/jpa/plugins/org.eclipse.jpt.ui/about.html
deleted file mode 100644
index 9e73bdabb6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/about.html
+++ /dev/null
@@ -1,34 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<HTML>
-
-<head>
-<title>About</title>
-<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
-</head>
-
-<BODY lang="EN-US">
-
-<H3>About This Content</H3>
-
-<P>June 06, 2007</P>
-
-<H3>License</H3>
-
-<P>The Eclipse Foundation makes available all content in this plug-in
-("Content"). Unless otherwise indicated below, the Content is provided to you
-under the terms and conditions of the Eclipse Public License Version 1.0
-("EPL"). A copy of the EPL is available at
-<A href="http://www.eclipse.org/org/documents/epl-v10.php">http://www.eclipse.org/org/documents/epl-v10.php</A>.
-For purposes of the EPL, "Program" will mean the Content.</P>
-
-<P>If you did not receive this Content directly from the Eclipse Foundation, the
-Content is being redistributed by another party ("Redistributor") and different
-terms and conditions may apply to your use of any object code in the Content.
-Check the Redistributor's license that was provided with the Content. If no such
-license exists, contact the Redistributor. Unless otherwise indicated below, the
-terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at
-<A href="http://www.eclipse.org/">http://www.eclipse.org/</A>.</P>
-
-</BODY>
-</HTML>
diff --git a/jpa/plugins/org.eclipse.jpt.ui/build.properties b/jpa/plugins/org.eclipse.jpt.ui/build.properties
deleted file mode 100644
index b1a1c37afa..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/build.properties
+++ /dev/null
@@ -1,21 +0,0 @@
-################################################################################
-# Copyright (c) 2006, 2007 Oracle. All rights reserved.
-# This program and the accompanying materials are made available under the
-# terms of the Eclipse Public License v1.0, which accompanies this distribution
-# and is available at http://www.eclipse.org/legal/epl-v10.html.
-#
-# Contributors:
-# Oracle - initial API and implementation
-################################################################################
-javacSource = 1.5
-javacTarget = 1.5
-source.. = src/,\
- property_files/
-output.. = bin/
-bin.includes = .,\
- META-INF/,\
- about.html,\
- icons/,\
- plugin.xml,\
- plugin.properties
-jars.compile.order = .
diff --git a/jpa/plugins/org.eclipse.jpt.ui/component.xml b/jpa/plugins/org.eclipse.jpt.ui/component.xml
deleted file mode 100644
index 36827b6240..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/component.xml
+++ /dev/null
@@ -1 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?><component xmlns="http://eclipse.org/wtp/releng/tools/component-model" name="org.eclipse.jpt.ui"><description url=""></description><component-depends unrestricted="true"></component-depends><plugin id="org.eclipse.jpt.ui" fragment="false"/></component> \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/icons/full/dtool16/new_jpaproject_wiz.gif b/jpa/plugins/org.eclipse.jpt.ui/icons/full/dtool16/new_jpaproject_wiz.gif
deleted file mode 100644
index 633768f35d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/icons/full/dtool16/new_jpaproject_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.ui/icons/full/etool16/jpa_facet.gif b/jpa/plugins/org.eclipse.jpt.ui/icons/full/etool16/jpa_facet.gif
deleted file mode 100644
index c0ab917511..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/icons/full/etool16/jpa_facet.gif
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.ui/icons/full/etool16/new_jpaproject_wiz.gif b/jpa/plugins/org.eclipse.jpt.ui/icons/full/etool16/new_jpaproject_wiz.gif
deleted file mode 100644
index 12da8074ae..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/icons/full/etool16/new_jpaproject_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.ui/icons/full/eview16/jpa_details.gif b/jpa/plugins/org.eclipse.jpt.ui/icons/full/eview16/jpa_details.gif
deleted file mode 100644
index 3280138b67..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/icons/full/eview16/jpa_details.gif
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.ui/icons/full/eview16/jpa_perspective.gif b/jpa/plugins/org.eclipse.jpt.ui/icons/full/eview16/jpa_perspective.gif
deleted file mode 100644
index c0ab917511..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/icons/full/eview16/jpa_perspective.gif
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.ui/icons/full/eview16/jpa_structure.gif b/jpa/plugins/org.eclipse.jpt.ui/icons/full/eview16/jpa_structure.gif
deleted file mode 100644
index 682c90a589..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/icons/full/eview16/jpa_structure.gif
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/basic.gif b/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/basic.gif
deleted file mode 100644
index a547d743e7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/basic.gif
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/embeddable.gif b/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/embeddable.gif
deleted file mode 100644
index 8856f78874..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/embeddable.gif
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/embedded-id.gif b/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/embedded-id.gif
deleted file mode 100644
index c1c8e210e7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/embedded-id.gif
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/embedded.gif b/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/embedded.gif
deleted file mode 100644
index c2ae66497a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/embedded.gif
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/entity-mappings.gif b/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/entity-mappings.gif
deleted file mode 100644
index c349c962e2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/entity-mappings.gif
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/entity.gif b/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/entity.gif
deleted file mode 100644
index d606f482e2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/entity.gif
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/id.gif b/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/id.gif
deleted file mode 100644
index a205ec38ab..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/id.gif
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/many-to-many.gif b/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/many-to-many.gif
deleted file mode 100644
index 48885b21fe..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/many-to-many.gif
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/many-to-one.gif b/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/many-to-one.gif
deleted file mode 100644
index 2e1e2b9387..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/many-to-one.gif
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/mapped-superclass.gif b/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/mapped-superclass.gif
deleted file mode 100644
index 8cc37645c0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/mapped-superclass.gif
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/null-attribute-mapping.gif b/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/null-attribute-mapping.gif
deleted file mode 100644
index 70a9c23541..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/null-attribute-mapping.gif
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/null-type-mapping.gif b/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/null-type-mapping.gif
deleted file mode 100644
index 6279478c51..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/null-type-mapping.gif
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/one-to-many.gif b/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/one-to-many.gif
deleted file mode 100644
index 1e90027861..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/one-to-many.gif
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/one-to-one.gif b/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/one-to-one.gif
deleted file mode 100644
index 578ec36aa3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/one-to-one.gif
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/persistence-unit.gif b/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/persistence-unit.gif
deleted file mode 100644
index 9cc45f6945..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/persistence-unit.gif
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/persistence.gif b/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/persistence.gif
deleted file mode 100644
index d1f616d64f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/persistence.gif
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/transient.gif b/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/transient.gif
deleted file mode 100644
index cc5d83db20..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/transient.gif
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/version.gif b/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/version.gif
deleted file mode 100644
index 202a8104f4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/version.gif
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.ui/icons/full/wizban/jpa_facet_wizban.gif b/jpa/plugins/org.eclipse.jpt.ui/icons/full/wizban/jpa_facet_wizban.gif
deleted file mode 100644
index 8ce181f606..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/icons/full/wizban/jpa_facet_wizban.gif
+++ /dev/null
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.ui/plugin.properties b/jpa/plugins/org.eclipse.jpt.ui/plugin.properties
deleted file mode 100644
index be47f4053a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/plugin.properties
+++ /dev/null
@@ -1,50 +0,0 @@
-###############################################################################
-# Copyright (c) 2006, 2007 Oracle. All rights reserved.
-# This program and the accompanying materials are made available under the
-# terms of the Eclipse Public License v1.0, which accompanies this distribution
-# and is available at http://www.eclipse.org/legal/epl-v10.html.
-#
-# Contributors:
-# Oracle - initial API and implementation
-###############################################################################
-
-# ====================================================================
-# To code developer:
-# Do NOT change the properties between this line and the
-# "%%% END OF TRANSLATED PROPERTIES %%%" line.
-# Make a new property name, append to the end of the file and change
-# the code to use the new property.
-# ====================================================================
-
-# ====================================================================
-# %%% END OF TRANSLATED PROPERTIES %%%
-# ====================================================================
-pluginName= Java Persistence API Tools - UI
-providerName=Eclipse.org
-
-JPA_PLATFORM="JPA Platform UI"
-
-
-jpaWizardCategoryName = JPA
-newJpaProjectWizardName = JPA Project
-newJpaProjectWizardDesc = Create a JPA project
-
-jpaMenuName = JPA Tools
-generateEntities = Generate Entities...
-generateDDL = Generate DDL...
-synchronizeClasses = Synchronize Classes
-addPersistentClass = Add persistent class ...
-removePersistentClass = Remove persistent class
-addPersistentAttributeToXml = Add persistent attribute to XML
-addPersistentAttributeToXmlAndMap = Add persistent attribute to XML ...
-removePersistentAttributeFromXml = Remove persistent attribute from XML
-
-jpaPreferencePage = JPA
-
-jpaProjectPropertiesPage = JPA
-
-jpaPerspective = JPA Development
-jpaDetails = JPA Details
-jpaStructure = JPA Structure
-
-JpaProposalCategory = JPA Proposals
diff --git a/jpa/plugins/org.eclipse.jpt.ui/plugin.xml b/jpa/plugins/org.eclipse.jpt.ui/plugin.xml
deleted file mode 100644
index 12561ff32a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/plugin.xml
+++ /dev/null
@@ -1,314 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.2"?>
-<plugin>
-
- <extension-point
- id="jpaPlatform"
- name="%JPA_PLATFORM"
- schema="schema/jpaPlatform.exsd"/>
-
-
- <extension
- point="org.eclipse.core.runtime.adapters">
-
- <factory
- adaptableType="org.eclipse.ui.IWorkbenchPart"
- class="org.eclipse.jpt.ui.internal.selection.SelectionParticipantFactory">
- <adapter type="org.eclipse.jpt.ui.internal.selection.ISelectionParticipant"/>
- </factory>
-
- <factory
- adaptableType="org.eclipse.jpt.core.internal.IPersistentAttribute"
- class="org.eclipse.jpt.ui.internal.actions.PersistentAttributeActionFilter$Factory">
- <adapter
- type="org.eclipse.ui.IActionFilter"/>
- </factory>
-
- <factory
- adaptableType="org.eclipse.jpt.core.internal.content.orm.XmlPersistentAttribute"
- class="org.eclipse.jpt.ui.internal.actions.XmlPersistentAttributeActionFilter$Factory">
- <adapter
- type="org.eclipse.ui.IActionFilter"/>
- </factory>
-
- </extension>
-
-
- <extension
- point="org.eclipse.jpt.ui.jpaPlatform">
-
- <jpaPlatform
- id="generic"
- class="org.eclipse.jpt.ui.internal.generic.GenericPlatformUi"/>
-
- </extension>
-
-
- <extension
- point="org.eclipse.ui.newWizards">
-
- <category
- id="org.eclipse.jpt"
- name="%jpaWizardCategoryName"/>
-
- <wizard
- id="org.eclipse.jpt.jpaProject"
- name="%newJpaProjectWizardName"
- icon="icons/full/etool16/new_jpaproject_wiz.gif"
- category="org.eclipse.jpt"
- class="org.eclipse.jpt.ui.internal.wizards.NewJpaProjectWizard"
- project="true"
- finalPerspective="org.eclipse.jpt.ui.jpaPerspective">
- <description>%newJpaProjectWizardDesc</description>
- </wizard>
-
- </extension>
-
- <extension
- point="org.eclipse.ui.popupMenus">
-
- <objectContribution
- id="org.eclipse.jpt.ui.project.JPATools"
- objectClass="org.eclipse.core.resources.IProject"
- adaptable="true">
- <menu
- id="org.eclipse.jpt.ui.project.JPATools"
- label="%jpaMenuName"/>
-
- <enablement>
- <test property="org.eclipse.wst.common.project.facet.core.projectFacet" value="jpt.jpa"/>
- </enablement>
-
- <action
- class="org.eclipse.jpt.ui.internal.actions.GenerateEntitiesAction"
- id="org.eclipse.jpt.ui.generateEntities"
- label="%generateEntities"
- menubarPath="org.eclipse.jpt.ui.project.JPATools/content"/>
-
- </objectContribution>
-
- <objectContribution
- id="org.eclipse.jpt.ui.project.JPATools"
- objectClass="org.eclipse.core.resources.IProject"
- adaptable="true">
- <menu
- id="org.eclipse.jpt.ui.project.JPATools"
- label="%jpaMenuName"/>
-
- <enablement>
- <test property="org.eclipse.wst.common.project.facet.core.projectFacet" value="jpt.jpa"/>
- </enablement>
-
- <action
- class="org.eclipse.jpt.ui.internal.actions.GenerateDDLAction"
- id="org.eclipse.jpt.ui.generateDDL"
- label="%generateDDL"
- menubarPath="org.eclipse.jpt.ui.project.JPATools/content"/>
-
- </objectContribution>
-
- <objectContribution
- id="org.eclipse.jpt.ui.persistenceXmlActions"
- objectClass="org.eclipse.core.resources.IFile"
- nameFilter="persistence.xml">
- <menu
- id="persistenceXmlJPATools"
- label="%jpaMenuName"/>
- <action
- id="synchClassesAction"
- label="%synchronizeClasses"
- menubarPath="persistenceXmlJPATools/content"
- class="org.eclipse.jpt.ui.internal.actions.SynchronizeClassesAction"
- enablesFor="1"/>
- </objectContribution>
-
- <objectContribution
- id="org.eclipse.jpt.ui.entityMappingsActions"
- objectClass="org.eclipse.jpt.core.internal.content.orm.EntityMappings">
- <action
- id="org.eclipse.jpt.ui.addPersistentClass"
- class="org.eclipse.jpt.ui.internal.actions.AddPersistentClassAction"
- label="%addPersistentClass"
- menubarPath="additions"/>
- </objectContribution>
-
- <objectContribution
- id="org.eclipse.jpt.ui.xmlPersistentTypeActions"
- objectClass="org.eclipse.jpt.core.internal.content.orm.XmlPersistentType">
- <action
- id="org.eclipse.jpt.ui.removePersistentClass"
- class="org.eclipse.jpt.ui.internal.actions.RemovePersistentClassAction"
- label="%removePersistentClass"
- menubarPath="additions"/>
- </objectContribution>
- <objectContribution
- id="org.eclipse.jpt.ui.xmlPersistentAttributeActions1"
- objectClass="org.eclipse.jpt.core.internal.content.orm.XmlPersistentAttribute">
-
- <action
- id="org.eclipse.jpt.ui.addPersistentAttributeToXml"
- class="org.eclipse.jpt.ui.internal.actions.AddPersistentAttributeToXmlAction"
- label="%addPersistentAttributeToXml"
- menubarPath="additions"/>
- <visibility>
- <and>
- <objectState
- name="isVirtual"
- value="true"/>
- <objectState
- name="isMapped"
- value="true"/>
- </and>
- </visibility>
-
- </objectContribution>
-
- <objectContribution
- id="org.eclipse.jpt.ui.xmlPersistentAttributeActions2"
- objectClass="org.eclipse.jpt.core.internal.content.orm.XmlPersistentAttribute">
-
- <action
- id="org.eclipse.jpt.ui.addPersistentAttributeToXmlAndMap"
- class="org.eclipse.jpt.ui.internal.actions.AddPersistentAttributeToXmlAndMapAction"
- label="%addPersistentAttributeToXmlAndMap"
- enablesFor="1"
- menubarPath="additions"/>
- <visibility>
- <and>
- <objectState
- name="isVirtual"
- value="true"/>
- <objectState
- name="isMapped"
- value="false"/>
- </and>
- </visibility>
-
- </objectContribution>
-
- <objectContribution
- id="org.eclipse.jpt.ui.xmlPersistentAttributeActions3"
- objectClass="org.eclipse.jpt.core.internal.content.orm.XmlPersistentAttribute">
-
- <action
- id="org.eclipse.jpt.ui.removePersistentAttributeFromXml"
- class="org.eclipse.jpt.ui.internal.actions.RemovePersistentAttributeFromXmlAction"
- label="%removePersistentAttributeFromXml"
- menubarPath="additions"/>
- <visibility>
- <objectState
- name="isVirtual"
- value="false"/>
- </visibility>
-
- </objectContribution>
-
-
-
- </extension>
-
- <extension
- point="org.eclipse.ui.preferencePages">
-
- <page
- id="org.eclipse.jpt.ui.jpaPreferencePage"
- name="%jpaPreferencePage"
- class="org.eclipse.jpt.ui.internal.prefs.JpaPreferencePage"/>
-
- </extension>
-
- <extension
- point="org.eclipse.ui.propertyPages">
-
- <page
- id="org.eclipse.jpt.ui.jpaProjectPropertiesPage"
- name="%jpaProjectPropertiesPage"
- class="org.eclipse.jpt.ui.internal.properties.JpaProjectPropertiesPage">
- <enabledWhen>
- <adapt
- type="org.eclipse.core.resources.IProject">
- <test
- property="org.eclipse.wst.common.project.facet.core.projectFacet"
- value="jpt.jpa"/>
- </adapt>
- </enabledWhen>
- </page>
- </extension>
-
- <extension
- point="org.eclipse.ui.views">
-
- <category
- id="org.eclipse.jpt.ui"
- name="%jpaPerspective"/>
-
- <view
- category="org.eclipse.jpt.ui"
- class="org.eclipse.jpt.ui.internal.views.JpaStructureView"
- icon="icons/full/eview16/jpa_structure.gif"
- id="org.eclipse.jpt.ui.jpaStructureView"
- name="%jpaStructure"/>
-
- <view
- category="org.eclipse.jpt.ui"
- class="org.eclipse.jpt.ui.internal.views.JpaDetailsView"
- icon="icons/full/eview16/jpa_details.gif"
- id="org.eclipse.jpt.ui.jpaDetailsView"
- name="%jpaDetails"/>
-
- </extension>
-
-<!-- =================================================================================== -->
-<!-- Extension: Persistence Perspective -->
-<!-- =================================================================================== -->
-
- <extension
- point="org.eclipse.ui.perspectives">
- <perspective
- class="org.eclipse.jpt.ui.internal.perspective.JpaPerspectiveFactory"
- icon="icons/full/eview16/jpa_perspective.gif"
- id="org.eclipse.jpt.ui.jpaPerspective"
- name="%jpaPerspective"/>
- </extension>
-
- <extension
- point="org.eclipse.wst.common.project.facet.ui.images">
-
- <image facet="jpt.jpa" path="icons/full/etool16/jpa_facet.gif"/>
-
- </extension>
-
-
- <extension
- point="org.eclipse.wst.common.project.facet.ui.wizardPages">
-
- <wizard-pages action="jpt.jpa.install">
- <page class="org.eclipse.jpt.ui.internal.wizards.JpaFacetWizardPage"/>
- </wizard-pages>
-
- </extension>
-
-<!-- =================================================================================== -->
-<!-- Extension: Java Completion Proposal Computer -->
-<!-- =================================================================================== -->
-
- <extension
- point="org.eclipse.jdt.ui.javaCompletionProposalComputer"
- id="JpaCompletionProposalComputer">
- <javaCompletionProposalComputer
- class="org.eclipse.jpt.ui.internal.JpaCompletionProposalComputer"
- categoryId="org.eclipse.jpt.ui.jpaProposalCategory">
- <partition type="__dftl_partition_content_type"/>
- <partition type="__java_string"/>
- </javaCompletionProposalComputer>
- </extension>
-
- <extension
- point="org.eclipse.jdt.ui.javaCompletionProposalComputer"
- id="jpaProposalCategory"
- name="%JpaProposalCategory">
- <proposalCategory
- icon="$nl$/icons/full/eview16/jpa_perspective.gif"/>
- </extension>
-
-</plugin>
diff --git a/jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui.properties b/jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui.properties
deleted file mode 100644
index 1ff880ba95..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui.properties
+++ /dev/null
@@ -1,79 +0,0 @@
-###############################################################################
-# Copyright (c) 2006, 2007 Oracle. - initial API and implementation
-###############################################################################
-
-AddPersistentAttributeDialog_title=Add Persistent Attribute
-AddPersistentAttributeDialog_attributeLabel=Attribute:
-AddPersistentAttributeDialog_mappingLabel=Map as:
-AddPersistentAttributeDialog_noMappingKeyError=You must specify a mapping type
-
-AddPersistentClassDialog_title=Add Persistent Class
-AddPersistentClassDialog_classLabel=Class:
-AddPersistentClassDialog_classDialog_title=Persistent Class Selection
-AddPersistentClassDialog_classDialog_message=Choose a class:
-AddPersistentClassDialog_mappingLabel=Map as:
-AddPersistentClassDialog_noClassError=You must specify a class
-AddPersistentClassDialog_duplicateClassWarning=File already contains that persistent class
-AddPersistentClassDialog_classNotFoundWarning=Cannot resolve class
-AddPersistentClassDialog_noMappingKeyError=You must specify a mapping type
-
-DatabaseReconnectWizardPage_database=Database Settings
-DatabaseReconnectWizardPage_databaseConnection=Database Connection
-DatabaseReconnectWizardPage_reconnectToDatabase=Reconnect to the database.
-DatabaseReconnectWizardPage_connection=Connection:
-DatabaseReconnectWizardPage_schema=Schema:
-DatabaseReconnectWizardPage_schemaInfo=(Note: Must have active connection to select schema)
-DatabaseReconnectWizardPage_addConnectionLink=<a>Add connections...</a>
-DatabaseReconnectWizardPage_reconnectLink=<a>Reconnect...</a>
-
-General_browse=Browse...
-General_deselectAll=Deselect All
-General_selectAll=Select All
-
-GenerateEntitiesWizard_generateEntities=Generate Entities
-GenerateEntitiesWizardPage_chooseEntityTable=Choose tables to generate entities from.
-GenerateEntitiesWizardPage_generateEntities=Generate Entities from Tables
-GenerateEntitiesWizardPage_synchronizeClasses=Synchronize Classes in persistence.xml
-GenerateEntitiesWizardPage_tables=Tables:
-GenerateEntitiesWizardPage_tableColumn=Table
-GenerateEntitiesWizardPage_entityNameColumn=Entity Name
-
-GenericPlatformUiDialog_notSupportedMessageTitle=DDL Generation
-GenericPlatformUiDialog_notSupportedMessageText=DDL Generation is not supported by the Generic Platform.
-
-JpaPreferencePage_defaultJpaLib=Default JPA implementation library:
-JpaPreferencePage_userLibsLink=<a>Configure user libraries ...</a>
-JpaPreferencePage_invalidJpaLib=Invalid Library: Must contain javax.persistence classes.
-
-JpaStructureView_viewNotAvailable=Structure is not available for the current selection.
-JpaStructureView_linkWithEditorText=Link with Editor
-JpaStructureView_linkWithEditorDesc=Link with Active Editor
-JpaStructureView_linkWithEditorTooltip=Link with Editor
-
-JpaDetailsView_viewNotAvailable=Details are not available for the current selection.
-
-NewJpaProjectWizard_title=New JPA Project
-NewJpaProjectWizard_firstPage_title=JPA Project
-NewJpaProjectWizard_firstPage_description=Configure JPA project settings.
-
-JpaFacetWizardPage_title=JPA Facet
-JpaFacetWizardPage_description=Configure JPA settings.
-JpaFacetWizardPage_platformLabel=Platform
-JpaFacetWizardPage_connectionLabel=Connection
-JpaFacetWizardPage_connectionLink=<a>Add connection ...</a>
-JpaFacetWizardPage_jpaImplementationLabel=JPA implementation
-JpaFacetWizardPage_userServerLibLabel=Use implementation provided by server runtime
-JpaFacetWizardPage_specifyLibLabel=Use implementation library:
-JpaFacetWizardPage_jpaPrefsLink=<a>Configure default JPA implementation library ...</a>
-JpaFacetWizardPage_userLibsLink=<a>Configure user libraries ...</a>
-JpaFacetWizardPage_persistentClassManagementLabel=Persistent class management
-JpaFacetWizardPage_discoverClassesButton=Discover annotated classes automatically
-JpaFacetWizardPage_listClassesButton=Annotated classes must be listed in persistence.xml
-JpaFacetWizardPage_createOrmXmlButton=Create orm.xml
-
-PersistentAttributePage_mapAs=Map As:
-
-PersistentTypePage_mapAs=Map As:
-
-OverwriteConfirmerDialog_title=Overwrite Existing Class
-OverwriteConfirmerDialog_text=Overwrite source code for the class ''{0}''?
diff --git a/jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui_mappings.properties b/jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui_mappings.properties
deleted file mode 100644
index d8d63ae59e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui_mappings.properties
+++ /dev/null
@@ -1,185 +0,0 @@
-###############################################################################
-# Copyright (c) 2006, 2007 Oracle. All rights reserved.
-# This program and the accompanying materials are made available under the terms of
-# the Eclipse Public License v1.0, which accompanies this distribution and is available at
-# http://www.eclipse.org/legal/epl-v10.html.
-#
-# Contributors:
-# Oracle - initial API and implementation
-###############################################################################
-
-PersistentTypePage_EntityLabel=Entity
-PersistentTypePage_EmbeddableLabel=Embeddable
-PersistentTypePage_MappedSuperclassLabel=Mapped Superclass
-
-PersistentAttributePage_BasicLabel=Basic
-PersistentAttributePage_IdLabel=Id
-PersistentAttributePage_OneToManyLabel=One to Many
-PersistentAttributePage_ManyToOneLabel=Many to One
-PersistentAttributePage_ManyToManyLabel=Many to Many
-PersistentAttributePage_TransientLabel=Transient
-PersistentAttributePage_VersionLabel=Version
-PersistentAttributePage_EmbeddedLabel=Embedded
-PersistentAttributePage_EmbeddedIdLabel=Embedded Id
-PersistentAttributePage_OneToOneLabel=One to One
-
-EntityComposite_tableDefault=Default ({0})
-EntityComposite_tableNoDefaultSpecified=Default ()
-EntityComposite_inheritance=Inheritance
-
-EntityGeneralSection_nameDefaultWithOneParam=Default ({0})
-EntityGeneralSection_nameDefaultEmpty=Default ()
-EntityGeneralSection_name=Name:
-
-BasicGeneralSection_name=Name:
-BasicGeneralSection_nameDefault=Default ({0})
-BasicGeneralSection_fetchLabel=Fetch:
-BasicGeneralSection_optionalLabel=Optional:
-BasicGeneralSection_lobLabel=Lob
-BasicGeneralSection_temporalLabel=Temporal:
-BasicGeneralSection_enumeratedLabel=Enumerated:
-
-TableChooser_label=Name:
-CatalogChooser_label=Catalog:
-SchemaChooser_label=Schema:
-TableComposite_tableSection=Table:
-TableComposite_defaultEmpty=Default ()
-TableComposite_defaultWithOneParam=Default ({0})
-
-ColumnChooser_label=Name:
-ColumnTableChooser_label=Table:
-
-TargetEntityChooser_label=Target Entity:
-TargetEntityChooser_defaultEmpty=Default ()
-TargetEntityChooser_defaultWithOneParam=Default ({0})
-TargetEntityChooser_browse=Browse...
-
-NonOwningMapping_mappedByLabel=Mapped By:
-
-JoinTableComposite_add=Add...
-JoinTableComposite_defaultEmpty=Default()
-JoinTableComposite_defaultWithOneParam=Default ({0})
-JoinTableComposite_edit=Edit...
-JoinTableComposite_inverseJoinColumn=Inverse Join Columns
-
-JoinTableComposite_mappingBetweenTwoParamsDefault=Default ({0} -> {1})
-JoinTableComposite_mappingBetweenTwoParamsFirstDefault=Default ({0}) -> {1}
-JoinTableComposite_mappingBetweenTwoParamsSecDefault={0} -> Default ({1})
-JoinTableComposite_mappingBetweenTwoParamsBothDefault=Default ({0}) -> Default ({1})
-JoinTableComposite_mappingBetweenTwoParams={0} -> {1}
-JoinTableComposite_joinColumn=Join Columns
-JoinTableComposite_name=Name:
-JoinTableComposite_remove=Remove
-JoinTableComposite_overrideDefaultJoinColumns=Override Default
-JoinTableComposite_overrideDefaultInverseJoinColumns=Override Default
-
-InverseJoinColumnDialog_editInverseJoinColumn=Edit Inverse Join Column
-InverseJoinColumnDialog_defaultWithOneParam=Default ({0})
-
-JoinColumnDialog_addJoinColumn=Add Join Column
-JoinColumnDialog_editJoinColumn=Edit Join Column
-JoinColumnDialog_name=Name:
-JoinColumnDialog_referencedColumnName=Referenced Column Name:
-JoinColumnDialog_defaultWithOneParam=Default ({0})
-JoinColumnDialog_insertable=Insertable:
-JoinColumnDialog_updatable=Updatable:
-JoinColumnDialog_table=Table:
-
-MultiRelationshipMappingComposite_general=General
-MultiRelationshipMappingComposite_joinTable=Join Table
-MultiRelationshipMappingComposite_targetEntity=Target Entity:
-MultiRelationshipMappingComposite_cascadeType=Cascade Type:
-MultiRelationshipMappingComposite_fetchType=Fetch Type:
-MultiRelationshipMappingComposite_mappedBy=Mapped By:
-
-ColumnComposite_columnSection=Column:
-ColumnComposite_defaultWithOneParam=Default ({0})
-ColumnComposite_defaultEmpty=Default ()
-ColumnComposite_insertable=Insertable:
-ColumnComposite_updatable=Updatable:
-
-JoinColumnComposite_joinColumn=Join Columns
-JoinColumnComposite_defaultEmpty=Default()
-JoinColumnComposite_name=Name:
-JoinColumnComposite_defaultWithOneParam=Default ({0})
-JoinColumnComposite_add=Add...
-JoinColumnComposite_edit=Edit...
-JoinColumnComposite_mappingBetweenTwoParams={0} -> {1}
-JoinColumnComposite_mappingBetweenTwoParamsDefault=Default ({0} -> {1})
-JoinColumnComposite_mappingBetweenTwoParamsBothDefault=Default ({0}) -> Default ({1})
-JoinColumnComposite_mappingBetweenTwoParamsFirstDefault=Default ({0}) -> {1}
-JoinColumnComposite_mappingBetweenTwoParamsSecDefault={0} -> Default ({1})
-JoinColumnComposite_remove=Remove
-JoinColumnComposite_overrideDefaultJoinColumns=Override Default
-
-PrimaryKeyJoinColumnsComposite_overrideDefaultPrimaryKeyJoinColumns=Override Default
-PrimaryKeyJoinColumnsComposite_add=Add...
-PrimaryKeyJoinColumnsComposite_edit=Edit...
-PrimaryKeyJoinColumnsComposite_remove=Remove
-PrimaryKeyJoinColumnsComposite_defaultEmpty=Default()
-PrimaryKeyJoinColumnsComposite_defaultWithOneParam=Default ({0})
-PrimaryKeyJoinColumnsComposite_primaryKeyJoinColumn=Primary Key Join Columns
-PrimaryKeyJoinColumnsComposite_mappingBetweenTwoParams={0} -> {1}
-PrimaryKeyJoinColumnsComposite_mappingBetweenTwoParamsDefault=Default ({0} -> {1})
-PrimaryKeyJoinColumnsComposite_mappingBetweenTwoParamsBothDefault=Default ({0}) -> Default ({1})
-PrimaryKeyJoinColumnsComposite_mappingBetweenTwoParamsFirstDefault=Default ({0}) -> {1}
-PrimaryKeyJoinColumnsComposite_mappingBetweenTwoParamsSecDefault={0} -> Default ({1})
-
-AttributeOverridesComposite_attributeOverrides=Attribute Overrides
-AttributeOverridesComposite_overridDefault=Override Default
-OverridesComposite_joinColumn=Join Columns
-InheritanceComposite_default=Default ({0})
-InheritanceComposite_strategy=Strategy:
-InheritanceComposite_discriminatorValue=Discriminator Value:
-InheritanceComposite_discriminatorValueDefaultWithOneParam=Default ({0})
-
-DiscriminatorColumnComposite_column=Discriminator Column:
-DiscriminatorColumnComposite_discriminatorType=Discriminator Type:
-DiscriminatorColumnComposite_defaultEmpty=Default(<provider-specific>)
-
-IdMappingComposite_pk_generation=PK Generation
-IdMappingComposite_primaryKeyGeneration=Primary Key Generation
-IdMappingComposite_tableGenerator=Table Generator
-IdMappingComposite_sequenceGenerator=Sequence Generator
-
-GeneratedValueComposite_generatedValue=Generated Value
-GeneratedValueComposite_generatorName=Generator Name:
-GeneratedValueComposite_strategy=Strategy:
-
-SequenceGeneratorComposite_sequenceGenerator=Sequence Generator
-SequenceGeneratorComposite_name=Name:
-SequenceGeneratorComposite_sequence=Sequence:
-SequenceGeneratorComposite_default=Default
-
-TableGeneratorComposite_name=Name:
-TableGeneratorComposite_table=Table:
-TableGeneratorComposite_tableGenerator=Table Generator
-TableGeneratorComposite_pkColumn=Primary Key Column:
-TableGeneratorComposite_valueColumn=Value Column:
-TableGeneratorComposite_pkColumnValue=Primary Key Column Value:
-TableGeneratorComposite_default=Default
-
-OrderByComposite_orderByGroup=Order By
-OrderByComposite_orderByLabel=Order By:
-OrderByComposite_noOrdering=No Ordering
-OrderByComposite_primaryKeyOrdering=Primary Key Ordering
-OrderByComposite_customOrdering=Custom Ordering
-
-SecondaryTablesComposite_secondaryTables=Secondary Tables
-SecondaryTablesComposite_add=Add...
-SecondaryTablesComposite_edit=Edit...
-SecondaryTablesComposite_remove=Remove
-
-SecondaryTableDialog_editSecondaryTable=Edit Secondary Table
-SecondaryTableDialog_name=Name:
-SecondaryTableDialog_catalog=Catalog:
-SecondaryTableDialog_schema=Schema:
-SecondaryTableDialog_defaultSchema=Default ({0})
-SecondaryTableDialog_defaultCatalog=Default ({0})
-
-AccessTypeCombo_default=Default
-EnumComboViewer_default=Default ({0})
-MetaDataCompleteCombo_Default=Default ({0})
-JoinColumnDialog_defaultTrue=Default ({0})
-InheritanceComposite_defaultDiscriminatorType=Default ({0})
-GeneratedValueComposite_default=Default ({0})
diff --git a/jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui_xml.properties b/jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui_xml.properties
deleted file mode 100644
index f581ea4e89..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui_xml.properties
+++ /dev/null
@@ -1,36 +0,0 @@
-###############################################################################
-# Copyright (c) 2006, 2007 Oracle. All rights reserved.
-# This program and the accompanying materials are made available under the terms of
-# the Eclipse Public License v1.0, which accompanies this distribution and is available at
-# http://www.eclipse.org/legal/epl-v10.html.
-#
-# Contributors:
-# Oracle - initial API and implementation
-###############################################################################
-
-PersistentTypePage_javaClassLabel=Java Class:
-PersistentTypePage_MetadataCompleteLabel=Metadata Complete:
-PersistentTypePage_AccessLabel=Access:
-
-PersistenceUnitMetadataSection_SchemaDefault=Default
-PersistenceUnitMetadataSection_CatalogDefault=Default
-
-PersistentAttributePage_javaAttributeLabel=Java Attribute:
-
-XMLEntityMappingsPage_XmlMappingMetadataCompleteCheckBox=XML Mapping Metadata Complete
-XMLEntityMappingsPage_CascadePersistCheckBox=Cascade Persist
-XMLEntityMappingsPage_PersistenceUnitSection=Persistence Unit
-XMLEntityMappingsPage_SchemaDefault=Default ({0})
-XMLEntityMappingsPage_SchemaNoDefaultSpecified=Default
-XMLEntityMappingsPage_CatalogDefault=Default ({0})
-XMLEntityMappingsPage_CatalogNoDefaultSpecified=Default
-
-XmlSchemaChooser_SchemaChooser=Schema:
-XmlCatalogChooser_CatalogChooser=Catalog:
-
-XmlJavaClassChooser_XmlJavaClassDialog_title=Class Selection
-XmlJavaClassChooser_XmlJavaClassDialog_message=Choose a type:
-
-XmlPackageChooser_PackageDialog_title=Package Selection
-XmlPackageChooser_PackageDialog_message=Choose a folder:
-
diff --git a/jpa/plugins/org.eclipse.jpt.ui/schema/jpaPlatform.exsd b/jpa/plugins/org.eclipse.jpt.ui/schema/jpaPlatform.exsd
deleted file mode 100644
index 92d1085e5e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/schema/jpaPlatform.exsd
+++ /dev/null
@@ -1,119 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.jpt.ui">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.jpt.ui" id="jpaVendor" name="JPA UI Vendor"/>
- </appInfo>
- <documentation>
- [Enter description of this extension point.]
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="jpaPlatform" minOccurs="1" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- <appInfo>
- <meta.attribute translatable="true"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="jpaPlatform">
- <annotation>
- <documentation>
- Extend this extension point and you must also extend the org.eclipse.jpt.core.jpaPlatform
- extension point. The ids must match. One jpaPlatform will be chosen per JpaProject. The
- possible jpaPlatforms will be displayed to the user as a project property.
- </documentation>
- </annotation>
- <complexType>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
- The id must match the corresponding org.eclipse.jpt.core.jpaVendor extension id.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- <appInfo>
- <meta.attribute kind="java" basedOn="org.eclipse.jpt.ui.internal.IJpaPlatformUI"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
- [Enter the first release in which this extension point appears.]
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- [Enter extension point usage example here.]
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
- [Enter API information here.]
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
- [Enter information about supplied implementation of this extension point.]
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
-</schema>
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/AsynchronousUiCommandExecutor.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/AsynchronousUiCommandExecutor.java
deleted file mode 100644
index 633cd52adf..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/AsynchronousUiCommandExecutor.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal;
-
-import org.eclipse.jpt.utility.internal.Command;
-import org.eclipse.jpt.utility.internal.CommandExecutor;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * This implementation of CommandExecutor can be used by a non-UI
- * thread to asynchronously modify a JPA project with any objects associated
- * with documents that are currently displayed in the UI.
- */
-public final class AsynchronousUiCommandExecutor
- implements CommandExecutor
-{
- public static final CommandExecutor INSTANCE = new AsynchronousUiCommandExecutor();
-
- public static CommandExecutor instance() {
- return INSTANCE;
- }
-
- // ensure single instance
- private AsynchronousUiCommandExecutor() {
- super();
- }
-
- public void execute(Command command) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(this.buildRunnable(command));
- }
-
- private Runnable buildRunnable(final Command command) {
- return new Runnable() {
- public void run() {
- command.execute();
- }
- };
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/BaseJpaPlatformUi.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/BaseJpaPlatformUi.java
deleted file mode 100644
index 9298773ef0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/BaseJpaPlatformUi.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jpt.core.internal.IJpaProject;
-import org.eclipse.jpt.ui.internal.details.IJpaDetailsProvider;
-import org.eclipse.jpt.ui.internal.generic.EntitiesGenerator;
-import org.eclipse.jpt.ui.internal.java.details.IAttributeMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.details.ITypeMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.details.JavaDetailsProvider;
-import org.eclipse.jpt.ui.internal.java.mappings.properties.BasicMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.mappings.properties.DefaultBasicMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.mappings.properties.DefaultEmbeddedMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.mappings.properties.EmbeddableUiProvider;
-import org.eclipse.jpt.ui.internal.java.mappings.properties.EmbeddedIdMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.mappings.properties.EmbeddedMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.mappings.properties.EntityUiProvider;
-import org.eclipse.jpt.ui.internal.java.mappings.properties.IdMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.mappings.properties.ManyToManyMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.mappings.properties.ManyToOneMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.mappings.properties.MappedSuperclassUiProvider;
-import org.eclipse.jpt.ui.internal.java.mappings.properties.NullTypeMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.mappings.properties.OneToManyMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.mappings.properties.OneToOneMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.mappings.properties.TransientMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.mappings.properties.VersionMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.structure.JavaStructureProvider;
-import org.eclipse.jpt.ui.internal.structure.IJpaStructureProvider;
-import org.eclipse.jpt.ui.internal.xml.details.XmlDetailsProvider;
-import org.eclipse.jpt.ui.internal.xml.structure.XmlStructureProvider;
-import org.eclipse.jpt.utility.internal.iterators.CloneIterator;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-public abstract class BaseJpaPlatformUi implements IJpaPlatformUi
-{
- private Collection<IJpaDetailsProvider> detailsProviders;
- private Collection<IJpaStructureProvider> structureProviders;
-
- private List<ITypeMappingUiProvider> javaTypeMappingUiProviders;
- private List<IAttributeMappingUiProvider> javaAttributeMappingUiProviders;
- private List<IAttributeMappingUiProvider> defaultJavaAttributeMappingUiProviders;
-
- private IJpaUiFactory jpaUiFactory;
-
- protected BaseJpaPlatformUi() {
- super();
- this.jpaUiFactory = createJpaUiFactory();
- }
-
- // ********** behavior **********
-
- protected abstract IJpaUiFactory createJpaUiFactory();
-
- public IJpaUiFactory getJpaUiFactory() {
- return this.jpaUiFactory;
- }
-
- public Iterator<IJpaDetailsProvider> detailsProviders() {
- if (this.detailsProviders == null) {
- this.detailsProviders = new ArrayList<IJpaDetailsProvider>();
- this.addDetailsProvidersTo(this.detailsProviders);
- }
- return new CloneIterator<IJpaDetailsProvider>(this.detailsProviders);
- }
-
- /**
- * Override this to specify more or different details providers.
- * The default includes the JPA spec-defined java and orm.xml
- */
- protected void addDetailsProvidersTo(Collection<IJpaDetailsProvider> providers) {
- providers.add(new JavaDetailsProvider());
- providers.add(new XmlDetailsProvider());
- }
-
- public IJpaDetailsProvider detailsProvider(String fileContentType) {
- for (Iterator<IJpaDetailsProvider> i = this.detailsProviders(); i.hasNext(); ) {
- IJpaDetailsProvider provider = i.next();
- if (provider.fileContentType().equals(fileContentType)) {
- return provider;
- }
- }
- return null;
- }
-
- public Iterator<IJpaStructureProvider> structureProviders() {
- if (this.structureProviders == null) {
- this.structureProviders = new ArrayList<IJpaStructureProvider>();
- this.addStructureProvidersTo(this.structureProviders);
- }
- return new CloneIterator<IJpaStructureProvider>(this.structureProviders);
- }
-
- /**
- * Override this to specify more or different structure providers.
- * The default includes the JPA spec-defined java and orm.xml
- */
- protected void addStructureProvidersTo(Collection<IJpaStructureProvider> providers) {
- providers.add(new JavaStructureProvider());
- providers.add(new XmlStructureProvider());
- }
-
- public IJpaStructureProvider structureProvider(String fileContentType) {
- for (Iterator<IJpaStructureProvider> i = this.structureProviders(); i.hasNext(); ) {
- IJpaStructureProvider provider = i.next();
- if (provider.fileContentType().equals(fileContentType)) {
- return provider;
- }
- }
- return null;
- }
-
- public ListIterator<ITypeMappingUiProvider> javaTypeMappingUiProviders() {
- if (this.javaTypeMappingUiProviders == null) {
- this.javaTypeMappingUiProviders = new ArrayList<ITypeMappingUiProvider>();
- this.addJavaTypeMappingUiProvidersTo(this.javaTypeMappingUiProviders);
- }
- return new CloneListIterator<ITypeMappingUiProvider>(this.javaTypeMappingUiProviders);
- }
-
- /**
- * Override this to specify more or different type mapping ui providers
- * The default includes the JPA spec-defined entity, mapped superclass, embeddable,
- * and null (when the others don't apply)
- */
- protected void addJavaTypeMappingUiProvidersTo(List<ITypeMappingUiProvider> providers) {
- providers.add(NullTypeMappingUiProvider.instance());
- providers.add(EntityUiProvider.instance());
- providers.add(MappedSuperclassUiProvider.instance());
- providers.add(EmbeddableUiProvider.instance());
- }
-
- public ListIterator<IAttributeMappingUiProvider> javaAttributeMappingUiProviders() {
- if (this.javaAttributeMappingUiProviders == null) {
- this.javaAttributeMappingUiProviders = new ArrayList<IAttributeMappingUiProvider>();
- this.addJavaAttributeMappingUiProvidersTo(this.javaAttributeMappingUiProviders);
- }
- return new CloneListIterator<IAttributeMappingUiProvider>(this.javaAttributeMappingUiProviders);
-
- }
-
- /**
- * Override this to specify more or different java attribute mapping ui providers.
- * The default includes the JPA spec-defined basic, embedded, embeddedId, id,
- * manyToMany, manyToOne, oneToMany, oneToOne, transient, and version
- */
- protected void addJavaAttributeMappingUiProvidersTo(List<IAttributeMappingUiProvider> providers) {
- providers.add(BasicMappingUiProvider.instance());
- providers.add(EmbeddedMappingUiProvider.instance());
- providers.add(EmbeddedIdMappingUiProvider.instance());
- providers.add(IdMappingUiProvider.instance());
- providers.add(ManyToManyMappingUiProvider.instance());
- providers.add(ManyToOneMappingUiProvider.instance());
- providers.add(OneToManyMappingUiProvider.instance());
- providers.add(OneToOneMappingUiProvider.instance());
- providers.add(TransientMappingUiProvider.instance());
- providers.add(VersionMappingUiProvider.instance());
- }
-
- public ListIterator<IAttributeMappingUiProvider> defaultJavaAttributeMappingUiProviders() {
- if (this.defaultJavaAttributeMappingUiProviders == null) {
- this.defaultJavaAttributeMappingUiProviders = new ArrayList<IAttributeMappingUiProvider>();
- this.addDefaultJavaAttributeMappingUiProvidersTo(this.defaultJavaAttributeMappingUiProviders);
- }
- return new CloneListIterator<IAttributeMappingUiProvider>(this.defaultJavaAttributeMappingUiProviders);
-
- }
-
- /**
- * Override this to specify more or different default java attribute mapping ui providers.
- * The default includes the JPA spec-defined basic, embedded
- */
- protected void addDefaultJavaAttributeMappingUiProvidersTo(List<IAttributeMappingUiProvider> providers) {
- providers.add(DefaultBasicMappingUiProvider.instance());
- providers.add(DefaultEmbeddedMappingUiProvider.instance());
- }
-
-
- public void generateEntities(IJpaProject project, IStructuredSelection selection) {
- EntitiesGenerator.generate(project, selection);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/BaseJpaUiFactory.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/BaseJpaUiFactory.java
deleted file mode 100644
index b94a63b279..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/BaseJpaUiFactory.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.jpt.ui.internal.details.IJpaComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.BasicComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.EmbeddableComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.EmbeddedComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.EmbeddedIdComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.EntityComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.IdComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.ManyToManyComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.ManyToOneComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.MappedSuperclassComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.OneToManyComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.OneToOneComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.TransientComposite;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-
-public abstract class BaseJpaUiFactory implements IJpaUiFactory
-{
-
- public IJpaComposite createBasicMappingComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return new BasicComposite(parent, commandStack, widgetFactory);
- }
-
- public IJpaComposite createEmbeddableComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return new EmbeddableComposite(parent, commandStack, widgetFactory);
- }
-
- public IJpaComposite createEmbeddedIdMappingComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return new EmbeddedIdComposite(parent, commandStack, widgetFactory);
- }
-
- public IJpaComposite createEmbeddedMappingComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return new EmbeddedComposite(parent, commandStack, widgetFactory);
- }
-
- public IJpaComposite createEntityComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return new EntityComposite(parent, commandStack, widgetFactory);
- }
-
- public IJpaComposite createIdMappingComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return new IdComposite(parent, commandStack, widgetFactory);
- }
-
- public IJpaComposite createManyToManyMappingComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return new ManyToManyComposite(parent, commandStack, widgetFactory);
- }
-
- public IJpaComposite createManyToOneMappingComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return new ManyToOneComposite(parent, commandStack, widgetFactory);
- }
-
- public IJpaComposite createMappedSuperclassComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return new MappedSuperclassComposite(parent, commandStack, widgetFactory);
- }
-
- public IJpaComposite createOneToManyMappingComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return new OneToManyComposite(parent, commandStack, widgetFactory);
- }
-
- public IJpaComposite createOneToOneMappingComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return new OneToOneComposite(parent, commandStack, widgetFactory);
- }
-
- public IJpaComposite createTransientMappingComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return new TransientComposite(parent, commandStack, widgetFactory);
- }
-
- public IJpaComposite createVersionMappingComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return new BasicComposite(parent, commandStack, widgetFactory);
-
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/GenericJpaUiFactory.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/GenericJpaUiFactory.java
deleted file mode 100644
index 9d3edce4f6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/GenericJpaUiFactory.java
+++ /dev/null
@@ -1,16 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal;
-
-
-public class GenericJpaUiFactory extends BaseJpaUiFactory
-{
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/IJpaHelpContextIds.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/IJpaHelpContextIds.java
deleted file mode 100644
index c7fe124c76..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/IJpaHelpContextIds.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal;
-
-
-/**
- * Help context ids for the Dali JPA UI.
- * <p>
- * This interface contains constants only; it is not intended to be
- * implemented.
- * </p>
- *
- */
-public interface IJpaHelpContextIds {
-
-
- //ContextID prefix
- public static final String PREFIX = JptUiPlugin.PLUGIN_ID + "."; //$NON-NLS-1$
-
- //Persistent Type composites
- public static final String ENTITY_ACCESS_TYPE = PREFIX + "entity_accessType"; //$NON-NLS-1$
- public static final String ENTITY_ATTRIBUTE_OVERRIDES = PREFIX + "entity_attributeOverrides"; //$NON-NLS-1$
- public static final String ENTITY_ATTRIBUTE_OVERRIDES_COLUMN = PREFIX + "entity_attributeOverridesColumn"; //$NON-NLS-1$
- public static final String ENTITY_CATALOG = PREFIX + "entity_catalog"; //$NON-NLS-1$
- public static final String ENTITY_INHERITANCE_STRATEGY = PREFIX + "entity_inheritanceStrategy"; //$NON-NLS-1$
- public static final String ENTITY_INHERITANCE_DISCRIMINATOR_TYPE = PREFIX + "entity_inheritanceDiscriminatorType"; //$NON-NLS-1$
- public static final String ENTITY_INHERITANCE_DISCRIMINATOR_COLUMN = PREFIX + "entity_inheritanceDiscriminatorColumn"; //$NON-NLS-1$
- public static final String ENTITY_INHERITANCE_DISCRIMINATOR_VALUE = PREFIX + "entity_inheritanceDiscriminatorValue"; //$NON-NLS-1$
- public static final String ENTITY_NAME = PREFIX + "entity_name"; //$NON-NLS-1$
- public static final String ENTITY_ORM_PACKAGE = PREFIX + "orm_package"; //$NON-NLS-1$
- public static final String ENTITY_ORM_SCHEMA = PREFIX + "orm_schema"; //$NON-NLS-1$
- public static final String ENTITY_ORM_CATALOG = PREFIX + "orm_catalog"; //$NON-NLS-1$
- public static final String ENTITY_ORM_ACCESS = PREFIX + "orm_access"; //$NON-NLS-1$
- public static final String ENTITY_ORM_CASCADE = PREFIX + "orm_cascade"; //$NON-NLS-1$
- public static final String ENTITY_ORM_XML = PREFIX + "orm_xml"; //$NON-NLS-1$
- public static final String ENTITY_SCHEMA = PREFIX + "entity_schema"; //$NON-NLS-1$
- public static final String ENTITY_TABLE = PREFIX + "entity_table"; //$NON-NLS-1$
-
-
- //Persistent Attribute composites
- public static final String MAPPING_CASCADE_TYPE = PREFIX + "mapping_cascadeType"; //$NON-NLS-1$
- public static final String MAPPING_COLUMN = PREFIX + "mapping_column"; //$NON-NLS-1$
- public static final String MAPPING_COLUMN_INSERTABLE = PREFIX + "mapping_columnInsertable"; //$NON-NLS-1$
- public static final String MAPPING_COLUMN_TABLE = PREFIX + "mapping_columnTable"; //$NON-NLS-1$
- public static final String MAPPING_COLUMN_UPDATABLE= PREFIX + "mapping_columnUpdatable"; //$NON-NLS-1$
- public static final String MAPPING_EMBEDDED_ATTRIBUTE_OVERRIDES = PREFIX + "mapping_embeddedAttributeOverrides";//$NON-NLS-1$
- public static final String MAPPING_EMBEDDED_ATTRIBUTE_OVERRIDES_COLUMN = PREFIX + "mapping_embeddedAttributeOverridesColumn";//$NON-NLS-1$
- public static final String MAPPING_ENUMERATED = PREFIX + "mapping_enumerated"; //$NON-NLS-1$
- public static final String MAPPING_FETCH_TYPE = PREFIX + "mapping_fetchType"; //$NON-NLS-1$
- public static final String MAPPING_GENERATED_VALUE_STRATEGY = PREFIX + "mapping_generatedValueStrategy"; //$NON-NLS-1$
- public static final String MAPPING_GENERATED_VALUE_GENERATOR_NAME = PREFIX + "mapping_generatedValueGeneratorName"; //$NON-NLS-1$
- public static final String MAPPING_JOIN_COLUMN_NAME = PREFIX + "mapping_joinColumnName"; //$NON-NLS-1$
- public static final String MAPPING_JOIN_REFERENCED_COLUMN = PREFIX + "mapping_joinReferencedColumn"; //$NON-NLS-1$
- public static final String MAPPING_JOIN_TABLE_NAME = PREFIX + "mapping_joinTableName"; //$NON-NLS-1$
- public static final String MAPPING_JOIN_TABLE_COLUMNS = PREFIX + "mapping_joinTableJoinColumns"; //$NON-NLS-1$
- public static final String MAPPING_JOIN_TABLE_INVERSE_JOIN_COLUMNS = PREFIX + "mapping_joinTableInverseJoinColumns"; //$NON-NLS-1$
- public static final String MAPPING_LOB = PREFIX + "mapping_lob"; //$NON-NLS-1$
- public static final String MAPPING_MAP_AS = PREFIX + "mapping_mapAs"; //$NON-NLS-1$
- public static final String MAPPING_MAPPED_BY = PREFIX + "mapping_mappedBy"; //$NON-NLS-1$
- public static final String MAPPING_OPTIONAL = PREFIX + "mapping_optional"; //$NON-NLS-1$
- public static final String MAPPING_ORDER_BY = PREFIX + "mapping_orderBy"; //$NON-NLS-1$
- public static final String MAPPING_ORDER_BY_NO_ORDERING = PREFIX + "mapping_orderByNoOrdering"; //$NON-NLS-1$
- public static final String MAPPING_ORDER_BY_PRIMARY_KEY_ORDERING = PREFIX + "mapping_orderByPrimaryKeyOrdering"; //$NON-NLS-1$
- public static final String MAPPING_ORDER_BY_CUSTOM_ORDERING = PREFIX + "mapping_orderByCustomOrdering"; //$NON-NLS-1$
- public static final String MAPPING_PRIMARY_KEY_GENERATION = PREFIX + "mapping_primaryKeyGeneration"; //$NON-NLS-1$
- public static final String MAPPING_SEQUENCE_GENERATOR = PREFIX + "mapping_sequenceGenerator"; //$NON-NLS-1$
- public static final String MAPPING_SEQUENCE_GENERATOR_NAME = PREFIX + "mapping_sequenceGeneratorName"; //$NON-NLS-1$
- public static final String MAPPING_SEQUENCE_GENERATOR_SEQUENCE = PREFIX + "mapping_sequenceGeneratorSequence"; //$NON-NLS-1$
- public static final String MAPPING_TABLE_GENERATOR = PREFIX + "mapping_tableGenerator"; //$NON-NLS-1$
- public static final String MAPPING_TABLE_GENERATOR_NAME = PREFIX + "mapping_tableGeneratorName"; //$NON-NLS-1$
- public static final String MAPPING_TABLE_GENERATOR_PRIMARY_KEY_COLUMN = PREFIX + "mapping_tableGeneratorPrimaryKeyColumn"; //$NON-NLS-1$
- public static final String MAPPING_TABLE_GENERATOR_PRIMARY_KEY_COLUMN_VALUE = PREFIX + "mapping_tableGeneratorPrimaryKeyColumnValue"; //$NON-NLS-1$
- public static final String MAPPING_TABLE_GENERATOR_TABLE= PREFIX + "mapping_tableGeneratorTable"; //$NON-NLS-1$
- public static final String MAPPING_TABLE_GENERATOR_VALUE_COLUMN = PREFIX + "mapping_tableGeneratorValueColumn"; //$NON-NLS-1$
- public static final String MAPPING_TARGET_ENTITY = PREFIX + "mapping_targetEntity"; //$NON-NLS-1$
- public static final String MAPPING_TEMPORAL = PREFIX + "mapping_temporal"; //$NON-NLS-1$
-
- //Project properties
- public static final String PROPERTIES_JAVA_PERSISTENCE = PREFIX + "properties_javaPersistence"; //$NON-NLS-1$
- public static final String PROPERTIES_JAVA_PERSISTENCE_CONNECTION = PREFIX + "properties_javaPersistenceConnection"; //$NON-NLS-1$
- public static final String PROPERTIES_JAVA_PERSISTENCE_SCHEMA = PREFIX + "properties_javaPersistenceSchema"; //$NON-NLS-1$
-
- //Dialogs, Wizards
- public static final String DIALOG_CREATE_ORM = PREFIX + "dialog_createORM"; //$NON-NLS-1$
- public static final String DIALOG_EDIT_INVERSE_JOIN_COLUNN = PREFIX + "dialog_editInverseJoinColumn"; //$NON-NLS-1$
- public static final String DIALOG_GENERATE_ENTITIES = PREFIX + "dialog_generateEntities"; //$NON-NLS-1$
- public static final String DIALOG_GENERATE_ENTITIES_SOURCE = PREFIX + "dialog_generateEntities_source"; //$NON-NLS-1$
- public static final String DIALOG_GENERATE_ENTITIES_PACKAGE = PREFIX + "dialog_generateEntities_package"; //$NON-NLS-1$
- public static final String DIALOG_GENERATE_ENTITIES_TABLES = PREFIX + "dialog_generateEntities_tables"; //$NON-NLS-1$
- public static final String DIALOG_JPA_FACET = PREFIX + "dialog_JPAFacet"; //$NON-NLS-1$
- public static final String DIALOG_JPA_PLATFORM = PREFIX + "dialog_JPAPlatform"; //$NON-NLS-1$
- public static final String NEW_JPA_PROJECT = PREFIX + "dialog_newJPAProject"; //$NON-NLS-1$
- public static final String NEW_JPA_PROJECT_CONTENT_PAGE_CLASSPATH = PREFIX + "dialog_addJavaPersistence_classpath"; //$NON-NLS-1$
- public static final String NEW_JPA_PROJECT_CONTENT_PAGE_DATABASE = PREFIX + "dialog_addJavaPersistence_database"; //$NON-NLS-1$
- public static final String NEW_JPA_PROJECT_CONTENT_PAGE_PACKAGING = PREFIX + "dialog_addJavaPersistence_packaging"; //$NON-NLS-1$
- public static final String NEW_JPA_PROJECT_CREATION_PAGE = PREFIX + "dialog_addJavaPersistence"; //$NON-NLS-1$
-
- //Other
- public static final String PERSISTENCE_OUTLINE = PREFIX + "persistenceOutline"; //$NON-NLS-1$
-
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/IJpaPlatformUi.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/IJpaPlatformUi.java
deleted file mode 100644
index 342ac51de2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/IJpaPlatformUi.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal;
-
-import java.util.Iterator;
-import java.util.ListIterator;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jpt.core.internal.IJpaProject;
-import org.eclipse.jpt.ui.internal.details.IJpaDetailsProvider;
-import org.eclipse.jpt.ui.internal.java.details.IAttributeMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.details.ITypeMappingUiProvider;
-import org.eclipse.jpt.ui.internal.structure.IJpaStructureProvider;
-
-
-public interface IJpaPlatformUi
-{
- Iterator<IJpaStructureProvider> structureProviders();
-
- IJpaStructureProvider structureProvider(String fileContentType);
-
- Iterator<IJpaDetailsProvider> detailsProviders();
-
- IJpaDetailsProvider detailsProvider(String fileContentType);
-
- /**
- * Return the type mapping UI providers for java. This will populate
- * the type mapping combo box in order and displaying ITypeMappingUiProvider.label().
- * It will also be used to create the appropriate composite given a type mapping.
- */
- ListIterator<ITypeMappingUiProvider> javaTypeMappingUiProviders();
-
- /**
- * Return the attribute mapping UI providers for java. This will populate
- * the attribute mapping combo box in order and display IAttributeMappingUiProvider.label().
- * It will also be used to create the appropriate composite given an attribute mapping.
- */
- ListIterator<IAttributeMappingUiProvider> javaAttributeMappingUiProviders();
-
- /**
- * Return the default attribute mapping UI providers for java. These will be used
- * to provide a default mapping option if one applies in java.
- */
- ListIterator<IAttributeMappingUiProvider> defaultJavaAttributeMappingUiProviders();
-
- IJpaUiFactory getJpaUiFactory();
-
- void generateDDL(IJpaProject project, IStructuredSelection selection);
-
- void generateEntities(IJpaProject project, IStructuredSelection selection);
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/IJpaUiFactory.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/IJpaUiFactory.java
deleted file mode 100644
index 2939cdfec2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/IJpaUiFactory.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.jpt.ui.internal.details.IJpaComposite;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-/**
- * Use IJpaFactory to create any IJavaTypeMapping or IJavaAttributeMappings. This is necessary
- * so that platforms can extend the java model with their own annotations.
- * IJavaTypeMappingProvider and IJavaAttributeMappingProvider use this factory.
- * See IJpaPlatform.javaTypeMappingProviders() and IJpaPlatform.javaAttributeMappingProviders()
- * for creating new mappings types.
- * @see BaseJpaUiFactory
- */
-public interface IJpaUiFactory
-{
- IJpaComposite createEntityComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory);
-
- IJpaComposite createEmbeddableComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory);
-
- IJpaComposite createMappedSuperclassComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory);
-
- IJpaComposite createBasicMappingComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory);
-
- IJpaComposite createEmbeddedMappingComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory);
-
- IJpaComposite createEmbeddedIdMappingComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory);
-
- IJpaComposite createIdMappingComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory);
-
- IJpaComposite createManyToManyMappingComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory);
-
- IJpaComposite createManyToOneMappingComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory);
-
- IJpaComposite createOneToManyMappingComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory);
-
- IJpaComposite createOneToOneMappingComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory);
-
- IJpaComposite createTransientMappingComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory);
-
- IJpaComposite createVersionMappingComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory);
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/JpaCompletionProposalComputer.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/JpaCompletionProposalComputer.java
deleted file mode 100644
index b59161c202..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/JpaCompletionProposalComputer.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.core.CompletionContext;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.ui.text.java.ContentAssistInvocationContext;
-import org.eclipse.jdt.ui.text.java.IJavaCompletionProposalComputer;
-import org.eclipse.jdt.ui.text.java.JavaContentAssistInvocationContext;
-import org.eclipse.jface.text.contentassist.CompletionProposal;
-import org.eclipse.jface.text.contentassist.ICompletionProposal;
-import org.eclipse.jpt.core.internal.IJpaFile;
-import org.eclipse.jpt.core.internal.JptCorePlugin;
-import org.eclipse.jpt.core.internal.content.java.JpaCompilationUnit;
-import org.eclipse.jpt.utility.internal.Filter;
-import org.eclipse.jpt.utility.internal.StringTools;
-
-public class JpaCompletionProposalComputer implements IJavaCompletionProposalComputer {
-
- public JpaCompletionProposalComputer() {
- super();
- }
-
- public void sessionStarted() {
- // do nothing
- }
-
- @SuppressWarnings("unchecked")
- public List computeCompletionProposals(ContentAssistInvocationContext context, IProgressMonitor monitor) {
- return (context instanceof JavaContentAssistInvocationContext) ?
- this.computeCompletionProposals((JavaContentAssistInvocationContext) context)
- :
- Collections.emptyList();
- }
-
- private List<ICompletionProposal> computeCompletionProposals(JavaContentAssistInvocationContext context) {
- try {
- return this.computeCompletionProposals_(context);
- } catch (JavaModelException ex) {
- throw new RuntimeException(ex);
- }
- }
-
- private List<ICompletionProposal> computeCompletionProposals_(JavaContentAssistInvocationContext context) throws JavaModelException {
- ICompilationUnit cu = context.getCompilationUnit();
- if (cu == null) {
- return Collections.emptyList();
- }
-
- IJpaFile jpaFile = JptCorePlugin.jpaFile((IFile) cu.getCorrespondingResource());
- if (jpaFile == null) {
- return Collections.emptyList();
- }
-
- JpaCompilationUnit jpaCU = (JpaCompilationUnit) jpaFile.getContent();
- CompletionContext cc = context.getCoreContext();
-
- // the context's "token" is really a sort of "prefix" - it does NOT
- // correspond to the "start" and "end" we get below...
- char[] prefix = cc.getToken();
- Filter<String> filter = ((prefix == null) ? Filter.Null.<String>instance() : new IgnoreCasePrefixFilter(prefix));
- // the token "start" is the offset of the token's first character
- int tokenStart = cc.getTokenStart();
- // the token "end" is the offset of the token's last character (yuk)
- int tokenEnd = cc.getTokenEnd();
-
-// System.out.println("prefix: " + new String(prefix));
-// System.out.println("token start: " + tokenStart);
-// System.out.println("token end: " + tokenEnd);
-// String source = cu.getSource();
-// String token = source.substring(tokenStart, tokenEnd + 1);
-// System.out.println("token: =>" + token + "<=");
-// String snippet = source.substring(Math.max(0, tokenStart - 20), Math.min(source.length(), tokenEnd + 21));
-// System.out.println("surrounding snippet: =>" + snippet + "<=");
-
- List<ICompletionProposal> proposals = new ArrayList<ICompletionProposal>();
- for (Iterator<String> stream = jpaCU.candidateValuesFor(context.getInvocationOffset(), filter); stream.hasNext(); ) {
- String s = stream.next();
- proposals.add(new CompletionProposal(s, tokenStart, tokenEnd - tokenStart + 1, s.length()));
- }
- return proposals;
- }
-
- @SuppressWarnings("unchecked")
- public List computeContextInformation(ContentAssistInvocationContext context, IProgressMonitor monitor) {
- return Collections.EMPTY_LIST;
- }
-
- public String getErrorMessage() {
- return null;
- }
-
- public void sessionEnded() {
- // do nothing
- }
-
- private static class IgnoreCasePrefixFilter implements Filter<String> {
- private final char[] prefix;
- IgnoreCasePrefixFilter(char[] prefix) {
- super();
- this.prefix = prefix;
- }
- public boolean accept(String s) {
- return StringTools.stringStartsWithIgnoreCase(s.toCharArray(), prefix);
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/JptUiIcons.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/JptUiIcons.java
deleted file mode 100644
index abdd525cf2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/JptUiIcons.java
+++ /dev/null
@@ -1,16 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 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.ui.internal;
-
-public class JptUiIcons
-{
- public static final String JPA_WIZ_BANNER = "full/wizban/jpa_facet_wizban"; //$NON-NLS-1$
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/JptUiMessages.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/JptUiMessages.java
deleted file mode 100644
index cdc142e820..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/JptUiMessages.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal;
-
-import org.eclipse.osgi.util.NLS;
-
-public class JptUiMessages extends NLS
-{
- private static final String BUNDLE_NAME = "jpt_ui"; //$NON-NLS-1$
-
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, JptUiMessages.class);
- }
-
- public static String AddPersistentAttributeDialog_title;
-
- public static String AddPersistentAttributeDialog_attributeLabel;
-
- public static String AddPersistentAttributeDialog_mappingLabel;
-
- public static String AddPersistentAttributeDialog_noMappingKeyError;
-
- public static String AddPersistentClassDialog_title;
-
- public static String AddPersistentClassDialog_classLabel;
-
- public static String AddPersistentClassDialog_classDialog_title;
-
- public static String AddPersistentClassDialog_classDialog_message;
-
- public static String AddPersistentClassDialog_mappingLabel;
-
- public static String AddPersistentClassDialog_noClassError;
-
- public static String AddPersistentClassDialog_duplicateClassWarning;
-
- public static String AddPersistentClassDialog_classNotFoundWarning;
-
- public static String AddPersistentClassDialog_noMappingKeyError;
-
- public static String DatabaseReconnectWizardPage_database;
-
- public static String DatabaseReconnectWizardPage_databaseConnection;
-
- public static String DatabaseReconnectWizardPage_reconnectToDatabase;
-
- public static String DatabaseReconnectWizardPage_connection;
-
- public static String DatabaseReconnectWizardPage_schema;
-
- public static String DatabaseReconnectWizardPage_schemaInfo;
-
- public static String DatabaseReconnectWizardPage_addConnectionLink;
-
- public static String DatabaseReconnectWizardPage_reconnectLink;
-
- public static String General_browse;
-
- public static String General_deselectAll;
-
- public static String General_selectAll;
-
- public static String GenerateEntitiesWizard_generateEntities;
-
- public static String GenerateEntitiesWizardPage_chooseEntityTable;
-
- public static String GenerateEntitiesWizardPage_generateEntities;
-
- public static String GenerateEntitiesWizardPage_synchronizeClasses;
-
- public static String GenerateEntitiesWizardPage_tables;
-
- public static String GenerateEntitiesWizardPage_tableColumn;
-
- public static String GenerateEntitiesWizardPage_entityNameColumn;
-
- public static String GenericPlatformUiDialog_notSupportedMessageTitle;
-
- public static String GenericPlatformUiDialog_notSupportedMessageText;
-
- public static String JpaPreferencePage_defaultJpaLib;
-
- public static String JpaPreferencePage_userLibsLink;
-
- public static String JpaPreferencePage_invalidJpaLib;
-
- public static String JpaStructureView_viewNotAvailable;
-
- public static String JpaStructureView_linkWithEditorText;
-
- public static String JpaStructureView_linkWithEditorDesc;
-
- public static String JpaStructureView_linkWithEditorTooltip;
-
- public static String JpaDetailsView_viewNotAvailable;
-
- public static String NewJpaProjectWizard_title;
-
- public static String NewJpaProjectWizard_firstPage_title;
-
- public static String NewJpaProjectWizard_firstPage_description;
-
- public static String JpaFacetWizardPage_title;
-
- public static String JpaFacetWizardPage_description;
-
- public static String JpaFacetWizardPage_platformLabel;
-
- public static String JpaFacetWizardPage_connectionLabel;
-
- public static String JpaFacetWizardPage_connectionLink;
-
- public static String JpaFacetWizardPage_jpaImplementationLabel;
-
- public static String JpaFacetWizardPage_userServerLibLabel;
-
- public static String JpaFacetWizardPage_specifyLibLabel;
-
- public static String JpaFacetWizardPage_jpaPrefsLink;
-
- public static String JpaFacetWizardPage_userLibsLink;
-
- public static String JpaFacetWizardPage_persistentClassManagementLabel;
-
- public static String JpaFacetWizardPage_discoverClassesButton;
-
- public static String JpaFacetWizardPage_listClassesButton;
-
- public static String JpaFacetWizardPage_createOrmXmlButton;
-
- public static String PersistentAttributePage_mapAs;
-
- public static String PersistentTypePage_mapAs;
-
- public static String OverwriteConfirmerDialog_title;
-
- public static String OverwriteConfirmerDialog_text;
-
-
- private JptUiMessages() {
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/JptUiPlugin.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/JptUiPlugin.java
deleted file mode 100644
index 77e697c5d8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/JptUiPlugin.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-public class JptUiPlugin extends AbstractUIPlugin
-{
- private static JptUiPlugin INSTANCE;
-
- /**
- * The plug-in identifier of JPA UI support
- * (value <code>"org.eclipse.jpt.ui"</code>).
- */
- public final static String PLUGIN_ID = "org.eclipse.jpt.ui"; //$NON-NLS-1$
-
- /**
- * Returns the singleton Plugin
- */
- public static JptUiPlugin getPlugin() {
- return INSTANCE;
- }
-
- public static void log(IStatus status) {
- INSTANCE.getLog().log(status);
- }
-
- public static void log(String msg) {
- log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, msg, null));
- }
-
- public static void log(Throwable throwable) {
- log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, throwable.getLocalizedMessage(), throwable));
- }
-
-
- public JptUiPlugin() {
- super();
- INSTANCE = this;
- }
-
- /**
- * This gets a .gif from the icons folder.
- */
- public ImageDescriptor getImageDescriptor(String key) {
- if (! key.startsWith("icons/")) {
- key = "icons/" + key;
- }
- if (! key.endsWith(".gif")) {
- key = key + ".gif";
- }
- return imageDescriptorFromPlugin(PLUGIN_ID, key);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/PlatformRegistry.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/PlatformRegistry.java
deleted file mode 100644
index ede93c3a73..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/PlatformRegistry.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-
-public class PlatformRegistry
-{
- // singleton
- private static final PlatformRegistry INSTANCE = new PlatformRegistry();
-
- /**
- * Return the singleton.
- */
- public static PlatformRegistry instance() {
- return INSTANCE;
- }
-
- private static final String EXTENSION_ID =
- "jpaPlatform"; //$NON-NLS-1$
-
- private static final String EL_PLATFORM =
- "jpaPlatform"; //$NON-NLS-1$
-
- private static final String AT_ID =
- "id"; //$NON-NLS-1$
-
- private static final String AT_CLASS =
- "class"; //$NON-NLS-1$
-
- // key: String jpaPlatform id value: IConfigurationElement class descriptor
- private Map<String, IConfigurationElement> jpaPlatforms;
-
-
- /* (non Java doc)
- * restrict access
- */
- private PlatformRegistry() {
- buildJpaPlatforms();
- }
-
-
- private void buildJpaPlatforms() {
- this.jpaPlatforms = new HashMap<String, IConfigurationElement>();
-
- for (Iterator<IConfigurationElement> stream = allConfigElements(); stream.hasNext(); ) {
- buildJpaPlatform(stream.next());
- }
- }
-
- private void buildJpaPlatform(IConfigurationElement configElement) {
- if (! configElement.getName().equals(EL_PLATFORM)) {
- return;
- }
-
- String platformId = configElement.getAttribute(AT_ID);
- String platformClass = configElement.getAttribute(AT_CLASS);
-
- if ((platformId == null) || (platformClass == null)) {
- if (platformId == null) {
- reportMissingAttribute(configElement, AT_ID);
- }
- if (platformClass == null) {
- reportMissingAttribute(configElement, AT_CLASS);
- }
- return;
- }
-
- if (this.jpaPlatforms.containsKey(platformId)) {
- IConfigurationElement otherConfigElement = this.jpaPlatforms.get(platformId);
- reportDuplicatePlatform(configElement, otherConfigElement);
- }
-
- this.jpaPlatforms.put(platformId, configElement);
- }
-
- public IJpaPlatformUi jpaPlatform(String platformId) {
- IConfigurationElement registeredConfigElement = this.jpaPlatforms.get(platformId);
-
- if (registeredConfigElement == null) {
- return null;
- }
-
- try {
- return (IJpaPlatformUi) registeredConfigElement.createExecutableExtension(AT_CLASS);
- }
- catch (CoreException ce) {
- reportFailedInstantiation(registeredConfigElement);
- return null;
- }
- }
-
- private Iterator<IConfigurationElement> allConfigElements() {
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- IExtensionPoint extensionPoint =
- registry.getExtensionPoint(JptUiPlugin.PLUGIN_ID, EXTENSION_ID);
- IExtension[] extensions = extensionPoint.getExtensions();
-
- return new CompositeIterator<IConfigurationElement>(
- new TransformationIterator<IExtension, Iterator<IConfigurationElement>>(CollectionTools.iterator(extensions)) {
- @Override
- protected Iterator<IConfigurationElement> transform(IExtension extension) {
- return CollectionTools.iterator(extension.getConfigurationElements());
- }
- }
- );
- }
-
- // TODO externalize strings
- private void reportMissingAttribute(IConfigurationElement configElement, String attributeName) {
- String message =
- "An extension element \""
- + configElement.getName()
- + "\" in plugin \""
- + configElement.getContributor().getName()
- + "\" is missing a required attribute \""
- + attributeName
- + "\".";
- JptUiPlugin.log(message);
- }
-
- // TODO externalize strings
- private void reportDuplicatePlatform(
- IConfigurationElement oneConfigElement, IConfigurationElement otherConfigElement) {
- String message =
- "The plugins \""
- + oneConfigElement.getContributor().getName()
- + "\" and \""
- + otherConfigElement.getContributor().getName()
- + "\" have registered a duplicate attribute \"id\" "
- + "for the extension element \"jpaVendor\".";
- JptUiPlugin.log(message);
- }
-
- // TODO externalize strings
- private void reportFailedInstantiation(IConfigurationElement configElement) {
- String message =
- "Could not instantiate the class \""
- + configElement.getAttribute(AT_CLASS)
- + "\" for the extension element \""
- + configElement.getName()
- + "\" in the plugin \""
- + configElement.getContributor().getName()
- + "\".";
- JptUiPlugin.log(message);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/SWTChangeEventDispatcherPlatformAdapter.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/SWTChangeEventDispatcherPlatformAdapter.java
deleted file mode 100644
index a6de60cdac..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/SWTChangeEventDispatcherPlatformAdapter.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal;
-
-import java.io.Serializable;
-
-import org.eclipse.jpt.utility.internal.model.ChangeEventDispatcher;
-import org.eclipse.jpt.utility.internal.model.UIChangeEventDispatcher;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * SWT-specific implementation of ChangeEventDispatcher.PlatformAdapter.
- */
-public class SWTChangeEventDispatcherPlatformAdapter
- implements UIChangeEventDispatcher.PlatformAdapter, Serializable
-{
- // singleton
- private static final UIChangeEventDispatcher.PlatformAdapter INSTANCE = new SWTChangeEventDispatcherPlatformAdapter();
-
- private static final ChangeEventDispatcher DISPATCHER = new UIChangeEventDispatcher(INSTANCE);
-
- private static final long serialVersionUID = 1L;
-
-
- /**
- * Return the singleton.
- */
- public static UIChangeEventDispatcher.PlatformAdapter instance() {
- return INSTANCE;
- }
-
- /**
- * Return an SWT change event dispatcher.
- */
- public static ChangeEventDispatcher dispatcher() {
- return DISPATCHER;
- }
-
- /**
- * Ensure single instance.
- */
- private SWTChangeEventDispatcherPlatformAdapter() {
- super();
- }
-
- /**
- * SWT check
- */
- public boolean currentThreadIsUIThread() {
- return Thread.currentThread() == this.display().getThread();
- }
-
- /**
- * Display.asyncExec(Runnable) seems to work OK;
- * but using #syncExec() can somtimes make things
- * more predictable when debugging.
- */
- public void executeOnUIThread(Runnable r) {
- this.display().asyncExec(r);
-// this.display().syncExec(r);
- }
-
- private Display display() {
- return PlatformUI.getWorkbench().getDisplay();
- }
-
- /**
- * Serializable singleton support
- */
- private Object readResolve() {
- return instance();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/SynchronousUiCommandExecutor.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/SynchronousUiCommandExecutor.java
deleted file mode 100644
index 3243de44fb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/SynchronousUiCommandExecutor.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal;
-
-import org.eclipse.jpt.utility.internal.Command;
-import org.eclipse.jpt.utility.internal.CommandExecutor;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * This implementation of CommandExecutor can be used by a non-UI
- * thread to synchronously modify a JPA project with any objects associated
- * with documents that are currently displayed in the UI.
- */
-public final class SynchronousUiCommandExecutor
- implements CommandExecutor
-{
- public static final CommandExecutor INSTANCE = new SynchronousUiCommandExecutor();
-
- public static CommandExecutor instance() {
- return INSTANCE;
- }
-
- // ensure single instance
- private SynchronousUiCommandExecutor() {
- super();
- }
-
- public void execute(Command command) {
- PlatformUI.getWorkbench().getDisplay().syncExec(this.buildRunnable(command));
- }
-
- private Runnable buildRunnable(final Command command) {
- return new Runnable() {
- public void run() {
- command.execute();
- }
- };
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/AddPersistentAttributeToXmlAction.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/AddPersistentAttributeToXmlAction.java
deleted file mode 100644
index f38efd98b4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/AddPersistentAttributeToXmlAction.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.actions;
-
-import java.util.Iterator;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jpt.core.internal.content.orm.XmlPersistentAttribute;
-import org.eclipse.ui.actions.ActionDelegate;
-
-public class AddPersistentAttributeToXmlAction extends ActionDelegate
-{
-
- private ISelection selection;
-
- @Override
- public void selectionChanged(IAction action, ISelection selection) {
- super.selectionChanged(action, selection);
- this.selection = selection;
- }
-
- @Override
- public void run(IAction action) {
- if (this.selection instanceof StructuredSelection) {
- for (Iterator<XmlPersistentAttribute> i = ((StructuredSelection) selection).iterator(); i.hasNext(); ) {
- XmlPersistentAttribute xmlPersistentAttribute = i.next();
- xmlPersistentAttribute.setVirtual(false);
- }
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/AddPersistentAttributeToXmlAndMapAction.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/AddPersistentAttributeToXmlAndMapAction.java
deleted file mode 100644
index f8ee7458a8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/AddPersistentAttributeToXmlAndMapAction.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.actions;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jpt.core.internal.content.orm.XmlPersistentAttribute;
-import org.eclipse.jpt.ui.internal.dialogs.AddPersistentAttributeToXmlAndMapDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IObjectActionDelegate;
-import org.eclipse.ui.IWorkbenchPart;
-
-public class AddPersistentAttributeToXmlAndMapAction
- implements IObjectActionDelegate
-{
- private Shell shell;
-
- private XmlPersistentAttribute unmappedXmlAttribute;
-
-
- public AddPersistentAttributeToXmlAndMapAction() {
- super();
- }
-
- public void run(IAction action) {
- AddPersistentAttributeToXmlAndMapDialog dialog = new AddPersistentAttributeToXmlAndMapDialog(shell, unmappedXmlAttribute);
-
- dialog.create();
- dialog.setBlockOnOpen(true);
- dialog.open();
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- unmappedXmlAttribute = (XmlPersistentAttribute) ((StructuredSelection) selection).getFirstElement();
- }
-
- public void setActivePart(IAction action, IWorkbenchPart targetPart) {
- shell = targetPart.getSite().getShell();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/AddPersistentClassAction.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/AddPersistentClassAction.java
deleted file mode 100644
index 23b4deba52..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/AddPersistentClassAction.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 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.ui.internal.actions;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal;
-import org.eclipse.jpt.ui.internal.dialogs.AddPersistentClassDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IObjectActionDelegate;
-import org.eclipse.ui.IWorkbenchPart;
-
-public class AddPersistentClassAction
- implements IObjectActionDelegate
-{
- private Shell shell;
-
- private EntityMappingsInternal entityMappings;
-
-
- public AddPersistentClassAction() {
- super();
- }
-
- public void run(IAction action) {
- AddPersistentClassDialog dialog = new AddPersistentClassDialog(shell, entityMappings);
-
- dialog.create();
- dialog.setBlockOnOpen(true);
- dialog.open();
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- entityMappings = (EntityMappingsInternal) ((StructuredSelection) selection).getFirstElement();
- }
-
- public void setActivePart(IAction action, IWorkbenchPart targetPart) {
- shell = targetPart.getSite().getShell();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/GenerateDDLAction.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/GenerateDDLAction.java
deleted file mode 100644
index 74143e1eb7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/GenerateDDLAction.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.actions;
-
-import org.eclipse.jpt.core.internal.IJpaProject;
-
-/**
- * GenerateDDLAction
- */
-public class GenerateDDLAction extends ProjectAction {
-
- public GenerateDDLAction() {
- super();
- }
-
- protected void execute(IJpaProject project) {
- this.jpaPlatformUi(project).generateDDL(project, this.getCurrentSelection());
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/GenerateEntitiesAction.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/GenerateEntitiesAction.java
deleted file mode 100644
index a6db0caea0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/GenerateEntitiesAction.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2007 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License 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.ui.internal.actions;
-
-import org.eclipse.jpt.core.internal.IJpaProject;
-
-/**
- * GenerateEntitiesAction
- */
-public class GenerateEntitiesAction extends ProjectAction {
- public GenerateEntitiesAction() {
- super();
- }
-
- protected void execute(IJpaProject project) {
- this.jpaPlatformUi(project).generateEntities(project, this.getCurrentSelection());
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/PersistentAttributeActionFilter.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/PersistentAttributeActionFilter.java
deleted file mode 100644
index 243055089e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/PersistentAttributeActionFilter.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.actions;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.IPersistentAttribute;
-import org.eclipse.ui.IActionFilter;
-
-public class PersistentAttributeActionFilter
- implements IActionFilter
-{
- public static final String IS_MAPPED = "isMapped";
-
-
- public boolean testAttribute(Object target, String name, String value) {
- if (! IS_MAPPED.equals(name)) {
- return false;
- }
-
- Boolean booleanValue;
- if ("true".equals(value)) {
- booleanValue = true;
- }
- else if ("false".equals(value)) {
- booleanValue = false;
- }
- else {
- return false;
- }
-
- boolean mapped = ((IPersistentAttribute) target).mappingKey() != IMappingKeys.NULL_ATTRIBUTE_MAPPING_KEY;
- return mapped == booleanValue;
- }
-
-
- public static final class Factory
- implements IAdapterFactory
- {
- private static final Class[] ADAPTER_TYPES = { IActionFilter.class };
-
- public Object getAdapter(final Object adaptable, final Class adapterType ) {
- if( adapterType == IActionFilter.class ) {
- return new PersistentAttributeActionFilter();
- }
- return null;
- }
-
- public Class[] getAdapterList() {
- return ADAPTER_TYPES;
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/ProjectAction.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/ProjectAction.java
deleted file mode 100644
index 96bd1d9ff6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/ProjectAction.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.actions;
-
-import java.util.Iterator;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jpt.core.internal.IJpaProject;
-import org.eclipse.jpt.core.internal.JptCorePlugin;
-import org.eclipse.jpt.ui.internal.IJpaPlatformUi;
-import org.eclipse.jpt.ui.internal.PlatformRegistry;
-import org.eclipse.ui.IObjectActionDelegate;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * Override any of the #execute() methods.
- */
-public abstract class ProjectAction implements IObjectActionDelegate {
-
- private ISelection currentSelection;
-
-
- public ProjectAction() {
- super();
- }
-
- public void setActivePart(IAction action, IWorkbenchPart targetPart) {
- // do nothing
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- this.currentSelection = selection;
- }
-
- protected IStructuredSelection getCurrentSelection() {
- if (this.currentSelection instanceof IStructuredSelection) {
- return (IStructuredSelection) this.currentSelection;
- }
- return null;
- }
-
- public void run(IAction action) {
- if (this.currentSelection instanceof IStructuredSelection) {
- for (Iterator stream = ((IStructuredSelection) this.currentSelection).iterator(); stream.hasNext(); ) {
- this.execute(stream.next());
- }
- }
- }
-
- protected void execute(Object selection) {
- IProject project = this.projectFromSelection(selection);
- if (project != null) {
- this.execute(project);
- }
- }
-
- protected IProject projectFromSelection(Object selection) {
- if (selection instanceof IProject) {
- return (IProject) selection;
- }
- if (selection instanceof IJavaProject) {
- return ((IJavaProject) selection).getProject();
- }
- return null;
- }
-
- protected IJpaPlatformUi jpaPlatformUi(IJpaProject project) {
- String coreJpaPlatformId = project.jpaPlatform().getId();
- return PlatformRegistry.instance().jpaPlatform(coreJpaPlatformId);
- }
-
- protected void execute(IProject project) {
- IJpaProject jpaProject = JptCorePlugin.jpaProject(project);
- if (jpaProject == null) {
- return;
- }
- this.execute(jpaProject);
- }
-
- protected void execute(IJpaProject project) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/RemovePersistentAttributeFromXmlAction.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/RemovePersistentAttributeFromXmlAction.java
deleted file mode 100644
index 849f0eacd0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/RemovePersistentAttributeFromXmlAction.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.actions;
-
-import java.util.Iterator;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jpt.core.internal.content.orm.XmlPersistentAttribute;
-import org.eclipse.jpt.core.internal.content.orm.XmlPersistentType;
-import org.eclipse.ui.actions.ActionDelegate;
-
-public class RemovePersistentAttributeFromXmlAction extends ActionDelegate
-{
- private ISelection selection;
-
- @Override
- public void selectionChanged(IAction action, ISelection selection) {
- super.selectionChanged(action, selection);
- this.selection = selection;
- }
-
- @Override
- public void run(IAction action) {
- if (this.selection instanceof StructuredSelection) {
- for (Iterator<XmlPersistentAttribute> i = ((StructuredSelection) selection).iterator(); i.hasNext(); ) {
- XmlPersistentAttribute xmlPersistentAttribute = i.next();
- XmlPersistentType xmlPersistentType = xmlPersistentAttribute.typeMapping().getPersistentType();
- xmlPersistentType.getSpecifiedAttributeMappings().remove(xmlPersistentAttribute.getMapping());
- }
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/RemovePersistentClassAction.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/RemovePersistentClassAction.java
deleted file mode 100644
index 3d8a55a236..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/RemovePersistentClassAction.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 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.ui.internal.actions;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal;
-import org.eclipse.jpt.core.internal.content.orm.XmlPersistentType;
-import org.eclipse.jpt.core.internal.content.orm.XmlTypeMapping;
-import org.eclipse.ui.IObjectActionDelegate;
-import org.eclipse.ui.IWorkbenchPart;
-
-public class RemovePersistentClassAction
- implements IObjectActionDelegate
-{
- private XmlPersistentType persistentClass;
-
-
- public RemovePersistentClassAction() {
- super();
- }
-
- public void run(IAction action) {
- XmlTypeMapping mapping = persistentClass.getMapping();
- ((EntityMappingsInternal) mapping.getEntityMappings()).getTypeMappings().remove(mapping);
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- persistentClass = (XmlPersistentType) ((StructuredSelection) selection).getFirstElement();
- }
-
- public void setActivePart(IAction action, IWorkbenchPart targetPart) {
- // do nothing
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/SynchronizeClassesAction.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/SynchronizeClassesAction.java
deleted file mode 100644
index 3b4db8ed75..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/SynchronizeClassesAction.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 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.ui.internal.actions;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jpt.core.internal.synch.SynchronizeClassesJob;
-import org.eclipse.ui.IObjectActionDelegate;
-import org.eclipse.ui.IWorkbenchPart;
-
-public class SynchronizeClassesAction
- implements IObjectActionDelegate
-{
- private IFile file;
-
- public void setActivePart(IAction action, IWorkbenchPart targetPart) {
- // no-op for now
- }
-
- public void run(IAction action) {
- SynchronizeClassesJob job = new SynchronizeClassesJob(file);
- job.schedule();
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- // only one element in actual selection
- file = (IFile) ((StructuredSelection) selection).getFirstElement();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/XmlPersistentAttributeActionFilter.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/XmlPersistentAttributeActionFilter.java
deleted file mode 100644
index 736953be85..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/XmlPersistentAttributeActionFilter.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.actions;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.jpt.core.internal.content.orm.XmlPersistentAttribute;
-import org.eclipse.ui.IActionFilter;
-
-public class XmlPersistentAttributeActionFilter
- extends PersistentAttributeActionFilter
-{
- public static final String IS_VIRTUAL = "isVirtual";
-
-
- public boolean testAttribute(Object target, String name, String value) {
- if (! IS_VIRTUAL.equals(name)) {
- return super.testAttribute(target, name, value);
- }
-
- Boolean booleanValue;
- if ("true".equals(value)) {
- booleanValue = true;
- }
- else if ("false".equals(value)) {
- booleanValue = false;
- }
- else {
- return false;
- }
- return ((XmlPersistentAttribute) target).isVirtual() == booleanValue;
- }
-
-
- public static final class Factory
- implements IAdapterFactory
- {
- private static final Class[] ADAPTER_TYPES = { IActionFilter.class };
-
- public Object getAdapter(final Object adaptable, final Class adapterType ) {
- if( adapterType == IActionFilter.class ) {
- return new XmlPersistentAttributeActionFilter();
- } else {
- return null;
- }
- }
-
- public Class[] getAdapterList() {
- return ADAPTER_TYPES;
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/BaseJpaComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/BaseJpaComposite.java
deleted file mode 100644
index 6c3ff8ba80..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/BaseJpaComposite.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.details;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public abstract class BaseJpaComposite extends BaseJpaController
- implements IJpaComposite
-{
- private Composite composite;
-
- public BaseJpaComposite(Composite parent, int style, CommandStack theCommandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, style, theCommandStack, widgetFactory);
- }
-
- public BaseJpaComposite(Composite parent, CommandStack theCommandStack,TabbedPropertySheetWidgetFactory widgetFactory) {
- this(parent, SWT.NULL, theCommandStack, widgetFactory);
- }
-
- @Override
- protected void buildWidget(Composite parent, int style) {
- super.buildWidget(parent);
- this.composite = createComposite(parent, style);
- initializeLayout(this.composite);
- }
-
- protected Composite createComposite(Composite parent, int style) {
- return this.widgetFactory.createComposite(parent, style);
- }
-
- protected abstract void initializeLayout(Composite composite);
-
- public Control getControl() {
- return this.composite;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/BaseJpaController.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/BaseJpaController.java
deleted file mode 100644
index 84ac1dca1b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/BaseJpaController.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.details;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public abstract class BaseJpaController
-{
- //****** we are using this commandStack in 0 places ********
- //do we plan to use it in the future? *should* we be using it? are we removing emf?
- protected CommandStack commandStack;
-
- protected TabbedPropertySheetWidgetFactory widgetFactory;
-
- //put in the populating flag to stop the circular population of the entity name combo
- //populateEntityNameCombo is calling select() which causes entityNameComboModified() to be called
- //this sets the name in the model which starts the circle over again. We should probably
- //short-circuit this differently, like in the emf model, keep the property change from being fired if
- //a change did not actually occur - KFM
- private boolean populating;
-
-
- public BaseJpaController(Composite parent, CommandStack theCommandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super();
- this.widgetFactory = widgetFactory;
- buildWidget(parent);
- this.commandStack = theCommandStack;
- }
-
- public BaseJpaController(Composite parent, int style, CommandStack theCommandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super();
- this.widgetFactory = widgetFactory;
- buildWidget(parent, style);
- this.commandStack = theCommandStack;
- }
-
-
- /**
- * Override this method if using the constructor without the style bit
- */
- protected void buildWidget(Composite parent) {
- // no op
- }
-
- /**
- * Override this method if using the constructor with the style bit
- */
- protected void buildWidget(Composite parent, int style) {
- // no op
- }
-
- /**
- * This method is called from outside when setting the object of interest
- */
- public final void populate(EObject obj) {
- if (getControl().isDisposed()) {
- return;
- }
- this.populating = true;
- disengageListeners();
- doPopulate(obj);
- engageListeners();
- this.populating = false;
- }
-
- /**
- * This method is called (perhaps internally) when this needs to repopulate
- * but the object of interest has not changed
- */
- public final void populate() {
- if (getControl().isDisposed()) {
- return;
- }
- this.populating = true;
- doPopulate();
- this.populating = false;
- }
-
- protected abstract void doPopulate(EObject obj);
-
- protected abstract void doPopulate();
-
- protected abstract void engageListeners();
-
- protected abstract void disengageListeners();
-
- protected boolean isPopulating() {
- return this.populating;
- }
-
- public TabbedPropertySheetWidgetFactory getWidgetFactory() {
- return this.widgetFactory;
- }
-
- public void dispose() {
- disengageListeners();
- }
-
- public abstract Control getControl();
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/BaseJpaDetailsPage.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/BaseJpaDetailsPage.java
deleted file mode 100644
index d57e13f02a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/BaseJpaDetailsPage.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.details;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.IJpaContentNode;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.forms.widgets.ScrolledForm;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public abstract class BaseJpaDetailsPage extends BaseJpaComposite
- implements IJpaDetailsPage
-{
- private Composite control;
-
- public BaseJpaDetailsPage(
- Composite parent, CommandStack theCommandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, theCommandStack, widgetFactory);
- }
-
- public BaseJpaDetailsPage(
- Composite parent, int style, CommandStack theCommandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, style, theCommandStack, widgetFactory);
- }
-
- @Override
- //using this to get a Scroll bar on the JpaDetailsView
- protected Composite createComposite(Composite parent, int style) {
- ScrolledForm scrolledForm = this.widgetFactory.createScrolledForm(parent);
- //Nesting another composite because combos on the ScrolledForm didn't have a border
- scrolledForm.getBody().setLayout(new FillLayout());
- Composite composite = super.createComposite(scrolledForm.getBody(), style);
- this.control = scrolledForm;
- return composite;
- }
-
- public final void populate(IJpaContentNode contentNode) {
- super.populate(contentNode);
- }
-
- @Override
- protected final void doPopulate(EObject obj) {
- doPopulate((IJpaContentNode) obj);
- }
-
- protected abstract void doPopulate(IJpaContentNode contentNode);
-
-
- @Override
- public Control getControl() {
- return this.control;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/IJpaComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/IJpaComposite.java
deleted file mode 100644
index bd09fed9d7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/IJpaComposite.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.details;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.swt.widgets.Control;
-
-
-public interface IJpaComposite<E extends EObject> {
-
- void populate(E model);
-
- Control getControl();
-
- void dispose();
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/IJpaDetailsPage.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/IJpaDetailsPage.java
deleted file mode 100644
index ae78d2fc38..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/IJpaDetailsPage.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.details;
-
-import org.eclipse.jpt.core.internal.IJpaContentNode;
-import org.eclipse.swt.widgets.Control;
-
-public interface IJpaDetailsPage
-{
- Control getControl();
-
- /**
- * Set the content for the page and populate widgets
- */
- void populate(IJpaContentNode contentNode);
-
-
- /**
- * Perform any other disposal needed
- */
- void dispose();
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/IJpaDetailsProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/IJpaDetailsProvider.java
deleted file mode 100644
index aab2f6f721..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/IJpaDetailsProvider.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.details;
-
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public interface IJpaDetailsProvider
-{
-
- String fileContentType();
-
- /**
- * Build a properties page given the parent Composite and the
- * content node id.
- * It is legal to set the layout for the given Composite.
- */
- IJpaDetailsPage buildDetailsPage(Composite parentComposite, Object contentNodeId, TabbedPropertySheetWidgetFactory widgetFactory);
-
- void dispose();
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/PageBookManager.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/PageBookManager.java
deleted file mode 100644
index 80c583ba2c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/PageBookManager.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Versant. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: Versant. - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.ui.internal.details;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.part.PageBook;
-
-/**
- * A wrapper for a <code>PageBook</code> with convenience methods.
- */
-public class PageBookManager extends PageBook {
-
- private Map pageRecords;
- private Object active;
- private PageBook pageBook;
- private Composite defaultComposite;
-
- /**
- * A <code>PageBookManager<code> is a wrapper for a <code>PageBook</code>. It provides
- * convenience methods to add, remove, activate and inactive pages in the internal <code>PageBook</code>.
- * If a page gets deactivated, the manager activates a default page.
- *
- * @param parent The parent composite to this manager
- * @param aDefaultLabel The label on the the default page.
- */
- public PageBookManager(Composite parent, String aDefaultLabel) {
- super(parent, SWT.NULL);
- this.setLayout(new FillLayout());
- this.pageRecords = new HashMap();
- this.pageBook = new PageBook(this, SWT.NONE);
- this.defaultComposite = new DefaultComposite(pageBook, aDefaultLabel);
- this.pageBook.showPage(this.defaultComposite);
- }
-
- /**
- * @param anObj Activates (flips to top in the <code>PageBook</code>) the associated <code>Composite</code>
- * for the given <code>Object</code>. Activates the <code>DefaultComposite</code> if there is no association
- * for the given <code>Object</code>.
- * @return Return false if there is no <code>Composite</code> association to the given <code>Object</code> or
- * the associated <code>Composite</code> is already active.
- */
- public boolean activate(Object anObj) {
- if(anObj != null && !anObj.equals(this.active) && this.pageRecords.containsKey(anObj)) {
- Composite composite = (Composite) this.pageRecords.get(anObj);
- this.pageBook.showPage(composite);
- this.active = anObj;
- return true;
- } else if((anObj == null || !anObj.equals(this.active)) && !this.pageRecords.containsKey(anObj)) {
- this.pageBook.showPage(this.defaultComposite);
- this.active = null;
- }
- return false;
- }
-
- /**
- * @param anObj
- * @return Returns true if the associated <code>Composite</code> has been deactivated.
- * Returns false if there is no <code>Composite</code> for the given <code>Object</code>
- * or the <code>Composite</code> is already inactive.
- */
- public boolean deactivate(Object anObj) {
- if(anObj.equals(this.active)) {
- this.pageBook.showPage(this.defaultComposite);
- this.active = null;
- return true;
- } else {
- return false;
- }
- }
-
- /**
- * Associates the specified <code>Object</code> with the specified <code>Composite</code>
- * in this <code>PageBookManager</code>.
- * If this manager previously contained a mapping for the <code>Object</code>, the old
- * <code>Composite</code> is replaced by the specified <code>Composite</code>.
- *
- * @param anObj <code>Object</code> with which the specified <code>Composite</code> is to be associated.
- * @param aComposite <code>Composite</code> to be associated with the specified <code>Object</code>.
- *
- * @return previous <code>Composite</code> associated with specified <code>Object</code>,
- * or <tt>null</tt> if there was no mapping for <code>Object</code>.
- */
- public Composite put(Object anObj, Composite aComposite) {
- Composite composite = (Composite) this.pageRecords.put(anObj, aComposite);
- this.activate(anObj);
- return composite;
- }
-
- /**
- * Removes the mapping for this <code>Object</code> from this pagebookmanager if it is present.
- *
- * @param anObj <code>Object</code> whose mapping is to be removed from this <code>PageBookManager</code>.
- * @return previous <code>Composite</code> associated with specified <code>Object</code>.
- */
- public Composite remove(Object anObj) {
- if(anObj.equals(this.active)) {
- this.active = null;
- this.pageBook.showPage(this.defaultComposite);
- }
- return (Composite) this.pageRecords.remove(anObj);
- }
-
- /**
- * @param anObj whose presence in this map is to be tested
- * @return true if this <code>PageBookManager</code> contains a mapping for the
- * given <code>Object</code>. False otherwise.
- */
- public boolean contains(Object anObj) {
- return this.pageRecords.containsKey(anObj);
- }
-
- public Composite get(Object key) {
- return (Composite) pageRecords.get(key);
- }
-
- /**
- * @return The currently active composite
- */
- public Composite getActive() {
- if(this.active == null) {
- return this.defaultComposite;
- } else {
- return (Composite) this.pageRecords.get(this.active);
- }
- }
-
- /**
- * @return The internal <code>PageBook</code> of this <code>PageBookManager</code>.
- * <code>Composite</code>s which should work with this manager needs to be created
- * with this <code>Composite</code> as their parent composite.
- */
- public Composite getComposite() {
- return this.pageBook;
- }
-
- // a default composite which is show if the active composite
- // gets deactivated
- private class DefaultComposite extends Composite {
- public DefaultComposite(Composite aParent, String aDefaultLabel) {
- super(aParent, SWT.NONE);
- setLayout(new FillLayout(SWT.VERTICAL));
- Label label = new Label(this, SWT.LEFT);
- label.setText(aDefaultLabel);
- }
- }
-
- public void dispose() {
- super.dispose();
- Collection composites = this.pageRecords.values();
- for (Iterator i = composites.iterator(); i.hasNext(); ) {
- ((Composite) i.next()).dispose();
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/PersistentAttributeDetailsPage.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/PersistentAttributeDetailsPage.java
deleted file mode 100644
index 068840f6b4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/PersistentAttributeDetailsPage.java
+++ /dev/null
@@ -1,300 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.details;
-
-import java.util.HashMap;
-import java.util.ListIterator;
-import java.util.Map;
-import org.eclipse.emf.common.command.BasicCommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.jface.viewers.IBaseLabelProvider;
-import org.eclipse.jface.viewers.IContentProvider;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jpt.core.internal.IAttributeMapping;
-import org.eclipse.jpt.core.internal.IJpaContentNode;
-import org.eclipse.jpt.core.internal.IPersistentAttribute;
-import org.eclipse.jpt.core.internal.JpaCorePackage;
-import org.eclipse.jpt.ui.internal.IJpaPlatformUi;
-import org.eclipse.jpt.ui.internal.IJpaUiFactory;
-import org.eclipse.jpt.ui.internal.JptUiMessages;
-import org.eclipse.jpt.ui.internal.PlatformRegistry;
-import org.eclipse.jpt.ui.internal.java.details.IAttributeMappingUiProvider;
-import org.eclipse.jpt.ui.internal.widgets.CComboViewer;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.part.PageBook;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public abstract class PersistentAttributeDetailsPage extends BaseJpaDetailsPage
-{
- private IPersistentAttribute attribute;
- private IAttributeMapping attributeMapping;
- private Adapter persistentAttributeListener;
-
- private String currentMappingKey;
-
- private CComboViewer mappingCombo;
-
- private Map<String, IJpaComposite<IAttributeMapping>> mappingComposites;
- protected PageBook mappingPageBook;
- private IJpaComposite<IAttributeMapping> currentMappingComposite;
-
- public PersistentAttributeDetailsPage(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, SWT.NONE, new BasicCommandStack(), widgetFactory);
- this.persistentAttributeListener = buildAttributeListener();
- this.mappingComposites = new HashMap<String, IJpaComposite<IAttributeMapping>>();
- }
-
- protected IJpaPlatformUi jpaPlatformUi() {
- String platformId = getAttribute().jpaPlatform().getId();
- return PlatformRegistry.instance().jpaPlatform(platformId);
- }
-
- protected IJpaUiFactory jpaUiFactory() {
- return jpaPlatformUi().getJpaUiFactory();
- }
-
- protected abstract ListIterator<IAttributeMappingUiProvider> attributeMappingUiProviders();
-
- protected abstract ListIterator<IAttributeMappingUiProvider> defaultAttributeMappingUiProviders();
-
- protected IAttributeMappingUiProvider attributeMappingUiProvider(String key) {
- for (ListIterator<IAttributeMappingUiProvider> i = attributeMappingUiProviders(); i.hasNext(); ) {
- IAttributeMappingUiProvider provider = i.next();
- if (provider.attributeMappingKey() == key) {
- return provider;
- }
- }
- throw new IllegalArgumentException("Unsupported attribute mapping UI provider key: ");
- }
-
- protected abstract IAttributeMappingUiProvider defaultAttributeMappingUiProvider(String key);
-
- private Adapter buildAttributeListener() {
- return new AdapterImpl() {
- @Override
- public void notifyChanged(Notification notification) {
- persistentAttributeChanged(notification);
- }
- };
- }
-
- protected void persistentAttributeChanged(Notification notification) {
- switch (notification.getFeatureID(IPersistentAttribute.class)) {
- case JpaCorePackage.IPERSISTENT_ATTRIBUTE__MAPPING:
- Display.getDefault().asyncExec(
- new Runnable() {
- public void run() {
- populate();
- }
- });
- break;
- }
- }
-
- protected Label buildMappingLabel(Composite parent) {
- return getWidgetFactory().createLabel(parent, JptUiMessages.PersistentAttributePage_mapAs);
- }
-
- protected CComboViewer buildMappingCombo(Composite parent) {
- CCombo combo = getWidgetFactory().createCCombo(parent);
- this.mappingCombo = new CComboViewer(combo);
- this.mappingCombo.setContentProvider(buildContentProvider());
- this.mappingCombo.setLabelProvider(buildLabelProvider());
- this.mappingCombo.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- mappingChanged(event);
- }
- });
- return this.mappingCombo;
- }
-
- private IContentProvider buildContentProvider() {
- return new IStructuredContentProvider() {
- public void dispose() {
- // do nothing
- }
-
- public Object[] getElements(Object inputElement) {
- if (inputElement == null) {
- return new Object[]{};
- }
- return attributeMappingUiProvidersFor((IPersistentAttribute) inputElement);
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- // do nothing
- }
- };
- }
-
- protected abstract IAttributeMappingUiProvider[] attributeMappingUiProvidersFor(IPersistentAttribute persistentAttribute);
-
- private IBaseLabelProvider buildLabelProvider() {
- return new LabelProvider() {
- @Override
- public String getText(Object element) {
- return ((IAttributeMappingUiProvider) element).label();
- }
- };
- }
-
- protected PageBook buildMappingPageBook(Composite parent) {
- this.mappingPageBook = new PageBook(parent, SWT.NONE);
- return this.mappingPageBook;
- }
-
- protected IJpaComposite<IAttributeMapping> buildMappingComposite(PageBook pageBook, String key) {
- if (this.attributeMapping == null || this.attributeMapping.isDefault()) {
- return defaultAttributeMappingUiProvider(key).buildAttributeMappingComposite(jpaUiFactory(), pageBook, this.commandStack, getWidgetFactory());
- }
-
- return attributeMappingUiProvider(key).buildAttributeMappingComposite(jpaUiFactory(), pageBook, this.commandStack, getWidgetFactory());
- }
-
- void mappingChanged(SelectionChangedEvent event) {
- if (isPopulating()) {
- return;
- }
- if (event.getSelection() instanceof StructuredSelection) {
- IAttributeMappingUiProvider provider = (IAttributeMappingUiProvider) ((StructuredSelection) event.getSelection()).getFirstElement();
- String key = (CollectionTools.contains(defaultAttributeMappingUiProviders(), provider) ? null : provider.attributeMappingKey());
- this.attribute.setSpecifiedMappingKey(key);
- }
- }
-
- @Override
- protected void doPopulate(IJpaContentNode persistentAttributeNode) {
- this.attribute = (IPersistentAttribute) persistentAttributeNode;
- populateMappingComboAndPage();
- }
-
- @Override
- protected void doPopulate() {
- populateMappingComboAndPage();
- }
-
- @Override
- protected void engageListeners() {
- if (this.attribute != null) {
- this.attribute.eAdapters().add(this.persistentAttributeListener);
- }
- }
-
- @Override
- protected void disengageListeners() {
- if (this.attribute != null) {
- this.attribute.eAdapters().remove(this.persistentAttributeListener);
- }
- }
-
- private void populateMappingComboAndPage() {
- if (this.attribute == null) {
- this.attributeMapping = null;
- this.currentMappingKey = null;
- this.mappingCombo.setInput(null);
- this.mappingCombo.setSelection(StructuredSelection.EMPTY);
-
- if (this.currentMappingComposite != null) {
- this.currentMappingComposite.populate(null);
- this.currentMappingComposite = null;
- }
-
- return;
- }
- this.attributeMapping = this.attribute.getMapping();
- setComboData();
-
- populateMappingPage(this.attributeMapping == null ? null : this.attributeMapping.getKey());
- }
-
- private void populateMappingPage(String mappingKey) {
- if (this.currentMappingComposite != null) {
- if (mappingKey == this.currentMappingKey) {
- if (this.currentMappingComposite != null) {
- this.currentMappingComposite.populate(this.attributeMapping);
- return;
- }
- }
- else {
- this.currentMappingComposite.populate(null);
- // don't return
- }
- }
-
- this.currentMappingKey = mappingKey;
-
- IJpaComposite<IAttributeMapping> composite = mappingCompositeFor(mappingKey);
- this.mappingPageBook.showPage(composite.getControl());
-
- this.currentMappingComposite = composite;
- this.currentMappingComposite.populate(this.attributeMapping);
- }
-
- private void setComboData() {
- if (this.attribute != this.mappingCombo.getInput()) {
- this.mappingCombo.setInput(this.attribute);
- }
- if (this.attributeMapping == null || this.attributeMapping.isDefault()) {
- this.mappingCombo.setSelection(new StructuredSelection(this.mappingCombo.getElementAt(0)));
- }
- else {
- IAttributeMappingUiProvider provider = attributeMappingUiProvider(this.attribute.mappingKey());
- if (provider != null && ! provider.equals(((StructuredSelection) this.mappingCombo.getSelection()).getFirstElement())) {
- this.mappingCombo.setSelection(new StructuredSelection(provider));
- }
- }
- }
-
- private IJpaComposite<IAttributeMapping> mappingCompositeFor(String key) {
- IJpaComposite<IAttributeMapping> composite = this.mappingComposites.get(key);
- if (composite != null) {
- return composite;
- }
-
- composite = buildMappingComposite(this.mappingPageBook, key);
-
- if (composite != null) {
- this.mappingComposites.put(key, composite);
- }
-
- return composite;
- }
-
-//TODO focus??
-// public boolean setFocus() {
-// super.setFocus();
-// return mappingCombo.getCombo().setFocus();
-// }
-
- @Override
- public void dispose() {
- disengageListeners();
- for (IJpaComposite<IAttributeMapping> composite : this.mappingComposites.values()) {
- composite.dispose();
- }
- super.dispose();
- }
-
- public IPersistentAttribute getAttribute() {
- return this.attribute;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/PersistentTypeDetailsPage.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/PersistentTypeDetailsPage.java
deleted file mode 100644
index 88b58c15fb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/PersistentTypeDetailsPage.java
+++ /dev/null
@@ -1,271 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.details;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.ListIterator;
-import java.util.Map;
-import org.eclipse.emf.common.command.BasicCommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.jface.viewers.IBaseLabelProvider;
-import org.eclipse.jface.viewers.IContentProvider;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jpt.core.internal.IJpaContentNode;
-import org.eclipse.jpt.core.internal.IPersistentType;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.core.internal.JpaCorePackage;
-import org.eclipse.jpt.ui.internal.JptUiMessages;
-import org.eclipse.jpt.ui.internal.java.details.ITypeMappingUiProvider;
-import org.eclipse.jpt.ui.internal.widgets.CComboViewer;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.part.PageBook;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public abstract class PersistentTypeDetailsPage extends BaseJpaDetailsPage
-{
- private IPersistentType persistentType;
- private Adapter persistentTypeListener;
-
- private String currentMappingKey;
-
- private CComboViewer typeMappingCombo;
-
- private Map<String, IJpaComposite<ITypeMapping>> composites;
-
- protected PageBook typeMappingPageBook;
-
- private IJpaComposite<ITypeMapping> visibleMappingComposite;
-
- public PersistentTypeDetailsPage(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, SWT.NONE, new BasicCommandStack(), widgetFactory);
- this.persistentTypeListener = buildPersistentTypeListener();
- this.composites = new HashMap<String, IJpaComposite<ITypeMapping>>();
- }
-
- protected abstract ListIterator<ITypeMappingUiProvider> typeMappingUiProviders();
-
- private ITypeMappingUiProvider typeMappingUiProvider(String key) {
- for (ListIterator<ITypeMappingUiProvider> i = this.typeMappingUiProviders(); i.hasNext();) {
- ITypeMappingUiProvider provider = i.next();
- if (provider.mappingKey() == key) {
- return provider;
- }
- }
- throw new IllegalArgumentException("Unsupported type mapping UI provider key: " + key);
- }
-
- private Adapter buildPersistentTypeListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- persistentTypeChanged(notification);
- }
- };
- }
-
- private void persistentTypeChanged(Notification notification) {
- switch (notification.getFeatureID(IPersistentType.class)) {
- case JpaCorePackage.IPERSISTENT_TYPE__MAPPING_KEY:
- Display.getDefault().asyncExec(
- new Runnable() {
- public void run() {
- populate();
- }
- });
- break;
- }
- }
-
- protected Label buildTypeMappingLabel(Composite parent) {
- return getWidgetFactory().createLabel(parent, JptUiMessages.PersistentTypePage_mapAs);
- }
-
- protected CComboViewer buildTypeMappingCombo(Composite parent) {
- CCombo combo = getWidgetFactory().createCCombo(parent);
- this.typeMappingCombo = new CComboViewer(combo);
- this.typeMappingCombo.setContentProvider(buildContentProvider());
- this.typeMappingCombo.setLabelProvider(buildLabelProvider());
- this.typeMappingCombo.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- typeMappingChanged(event);
- }
- });
- return this.typeMappingCombo;
- }
-
- private IContentProvider buildContentProvider() {
- return new IStructuredContentProvider() {
- public void dispose() {
- // do nothing
- }
-
- public Object[] getElements(Object inputElement) {
- return (persistentType == null) ?
- new String[] {}:
- CollectionTools.array(PersistentTypeDetailsPage.this.typeMappingUiProviders());
- }
-
- public void inputChanged(
- Viewer viewer, Object oldInput, Object newInput) {
- // do nothing
- }
- };
- }
- private IBaseLabelProvider buildLabelProvider() {
- return new LabelProvider() {
- @Override
- public String getText(Object element) {
- return ((ITypeMappingUiProvider) element).label();
- }
- };
- }
-
- protected PageBook buildTypeMappingPageBook(Composite parent) {
- this.typeMappingPageBook = new PageBook(parent, SWT.NONE);
- return this.typeMappingPageBook;
- }
-
-
- private void typeMappingChanged(SelectionChangedEvent event) {
- if (isPopulating()) {
- return;
- }
- if (event.getSelection() instanceof StructuredSelection) {
- ITypeMappingUiProvider provider = (ITypeMappingUiProvider) ((StructuredSelection) event.getSelection()).getFirstElement();
- this.persistentType.setMappingKey(provider.mappingKey());
- }
- }
-
- @Override
- protected void doPopulate(IJpaContentNode persistentTypeNode) {
- this.persistentType = (IPersistentType) persistentTypeNode;
- populateMappingComboAndPage();
- }
-
- @Override
- protected void doPopulate() {
- populateMappingComboAndPage();
- }
-
- protected void engageListeners() {
- if (this.persistentType != null) {
- this.persistentType.eAdapters().add(this.persistentTypeListener);
- }
- }
-
- protected void disengageListeners() {
- if (this.persistentType != null) {
- this.persistentType.eAdapters().remove(this.persistentTypeListener);
- }
- }
-
- private void populateMappingComboAndPage() {
- if (this.persistentType == null) {
- this.currentMappingKey = null;
- this.typeMappingCombo.setInput(null);
- this.typeMappingCombo.setSelection(StructuredSelection.EMPTY);
-
- if (this.visibleMappingComposite != null) {
- this.visibleMappingComposite.populate(null);
- this.visibleMappingComposite = null;
- }
-
- return;
- }
-
- String mappingKey = this.persistentType.getMapping().getKey();
- setComboData(mappingKey);
-
- populateMappingPage(mappingKey);
- }
-
- private void populateMappingPage(String mappingKey) {
- if (this.visibleMappingComposite != null) {
- if (mappingKey == this.currentMappingKey) {
- if (this.visibleMappingComposite != null) {
- this.visibleMappingComposite.populate(this.persistentType.getMapping());
- return;
- }
- }
- else {
- this.visibleMappingComposite.populate(null);
- // don't return
- }
- }
-
- this.currentMappingKey = mappingKey;
-
- IJpaComposite mappingComposite = mappingCompositeFor(mappingKey);
- this.typeMappingPageBook.showPage(mappingComposite.getControl());
-
- this.visibleMappingComposite = mappingComposite;
- this.visibleMappingComposite.populate(this.persistentType.getMapping());
- }
-
- private void setComboData(String mappingKey) {
- if (this.persistentType != this.typeMappingCombo.getInput()) {
- this.typeMappingCombo.setInput(this.persistentType);
- }
-
- ITypeMappingUiProvider provider = typeMappingUiProvider(mappingKey);
- if (! provider.equals(((StructuredSelection) this.typeMappingCombo.getSelection()).getFirstElement())) {
- this.typeMappingCombo.setSelection(new StructuredSelection(provider));
- }
- }
-
- private IJpaComposite<ITypeMapping> mappingCompositeFor(String key) {
- IJpaComposite<ITypeMapping> mappingComposite = this.composites.get(key);
- if (mappingComposite != null) {
- return mappingComposite;
- }
-
- mappingComposite = buildMappingComposite(this.typeMappingPageBook, key);
-
- if (mappingComposite != null) {
- this.composites.put(key, mappingComposite);
- }
-
- return mappingComposite;
- }
-
- protected IJpaComposite<ITypeMapping> buildMappingComposite(PageBook pageBook, String key) {
- return typeMappingUiProvider(key).buildPersistentTypeMappingComposite(pageBook, this.commandStack, getWidgetFactory());
- }
-
-//TODO focus??
-// public boolean setFocus() {
-// super.setFocus();
-// return typeMappingCombo.getCombo().setFocus();
-// }
-
- public void dispose() {
- disengageListeners();
- for (Iterator<IJpaComposite<ITypeMapping>> i = this.composites.values().iterator(); i.hasNext(); ) {
- i.next().dispose();
- }
- super.dispose();
- }
-
- public IPersistentType getPersistentType() {
- return this.persistentType;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/dialogs/AddPersistentAttributeToXmlAndMapDialog.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/dialogs/AddPersistentAttributeToXmlAndMapDialog.java
deleted file mode 100644
index 9db8842e31..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/dialogs/AddPersistentAttributeToXmlAndMapDialog.java
+++ /dev/null
@@ -1,184 +0,0 @@
-package org.eclipse.jpt.ui.internal.dialogs;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.StatusDialog;
-import org.eclipse.jface.viewers.ComboViewer;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jpt.core.internal.content.orm.XmlPersistentAttribute;
-import org.eclipse.jpt.ui.internal.JptUiMessages;
-import org.eclipse.jpt.ui.internal.JptUiPlugin;
-import org.eclipse.jpt.ui.internal.java.details.IAttributeMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.mappings.properties.BasicMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.mappings.properties.EmbeddedIdMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.mappings.properties.EmbeddedMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.mappings.properties.IdMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.mappings.properties.ManyToManyMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.mappings.properties.ManyToOneMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.mappings.properties.OneToManyMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.mappings.properties.OneToOneMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.mappings.properties.TransientMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.mappings.properties.VersionMappingUiProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-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;
-
-public class AddPersistentAttributeToXmlAndMapDialog extends StatusDialog
-{
- private XmlPersistentAttribute unmappedPersistentAttribute;
-
- private Text attributeText;
-
- private ComboViewer mappingCombo;
-
-
- public AddPersistentAttributeToXmlAndMapDialog(Shell parentShell, XmlPersistentAttribute unmappedPersistentAttribute) {
- super(parentShell);
- this.unmappedPersistentAttribute = unmappedPersistentAttribute;
- setTitle(JptUiMessages.AddPersistentAttributeDialog_title);
- }
-
- protected Control createDialogArea(Composite parent) {
- Composite dialogArea = (Composite) super.createDialogArea(parent);
-
- Composite composite = new Composite(dialogArea, SWT.NULL);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
- composite.setLayout(new GridLayout());
-
- createLabel(composite, 1, JptUiMessages.AddPersistentAttributeDialog_attributeLabel);
-
- attributeText = createText(composite, 1);
-// attributeText.addModifyListener(
-// new ModifyListener() {
-// public void modifyText(ModifyEvent e) {
-// validate();
-// }
-// }
-// );
- attributeText.setText(unmappedPersistentAttribute.getName());
- attributeText.setEditable(false);
-
- createLabel(composite, 1, JptUiMessages.AddPersistentClassDialog_mappingLabel);
-
- mappingCombo = new ComboViewer(createCombo(composite, 1));
- mappingCombo.setContentProvider(
- new IStructuredContentProvider() {
- public void dispose() {}
-
- public Object[] getElements(Object inputElement) {
- return new Object[] {
- BasicMappingUiProvider.instance(),
- EmbeddedMappingUiProvider.instance(),
- EmbeddedIdMappingUiProvider.instance(),
- IdMappingUiProvider.instance(),
- ManyToManyMappingUiProvider.instance(),
- ManyToOneMappingUiProvider.instance(),
- OneToManyMappingUiProvider.instance(),
- OneToOneMappingUiProvider.instance(),
- TransientMappingUiProvider.instance(),
- VersionMappingUiProvider.instance()
- };
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
- });
- mappingCombo.setLabelProvider(
- new LabelProvider() {
- @Override
- public String getText(Object element) {
- return ((IAttributeMappingUiProvider) element).label();
- }
- });
- mappingCombo.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- validate();
- }
- });
- mappingCombo.setInput("FOO");
- mappingCombo.getCombo().select(0); // select Basic to begin
-
- // TODO - F1 Help
- // PlatformUI.getWorkbench().getHelpSystem().setHelp(group, IDaliHelpContextIds.NEW_JPA_PROJECT_CONTENT_PAGE_DATABASE);
-
- //getButton(IDialogConstants.OK_ID).setEnabled(false); // disabled to start
- applyDialogFont(dialogArea);
-
- validate();
-
- return dialogArea;
- }
-
- private Label createLabel(Composite container, int span, String text) {
- Label label = new Label(container, SWT.NONE);
- label.setText(text);
- GridData gd = new GridData();
- gd.horizontalSpan = span;
- label.setLayoutData(gd);
- return label;
- }
-
- private Text createText(Composite container, int span) {
- Text text = new Text(container, SWT.BORDER | SWT.SINGLE);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = span;
- gd.widthHint = 250;
- text.setLayoutData(gd);
- return text;
- }
-
- private Combo createCombo(Composite container, int span) {
- Combo combo = new Combo(container, SWT.BORDER | SWT.SINGLE | SWT.READ_ONLY);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = span;
- combo.setLayoutData(gd);
- return combo;
- }
-
- public String getAttributeName() {
- return attributeText.getText();
- }
-
- public String getMappingKey() {
- StructuredSelection selection = (StructuredSelection) mappingCombo.getSelection();
- return (selection.isEmpty()) ? null : ((IAttributeMappingUiProvider) selection.getFirstElement()).attributeMappingKey();
- }
-
- private void validate() {
-// if (entityMappings.containsPersistentType(type)) {
-// updateStatus(
-// new Status(
-// IStatus.WARNING, JptUiPlugin.PLUGIN_ID,
-// JptUiMessages.AddPersistentClassDialog_duplicateClassWarning));
-// return;
-// }
-//
- String mappingKey = getMappingKey();
- if (mappingKey == null) {
- updateStatus(
- new Status(
- IStatus.ERROR, JptUiPlugin.PLUGIN_ID,
- JptUiMessages.AddPersistentAttributeDialog_noMappingKeyError));
- return;
- }
-
- updateStatus(Status.OK_STATUS);
- }
-
- @Override
- protected void okPressed() {
- unmappedPersistentAttribute.setSpecifiedMappingKey(getMappingKey());
- unmappedPersistentAttribute.setVirtual(false);
- super.okPressed();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/dialogs/AddPersistentClassDialog.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/dialogs/AddPersistentClassDialog.java
deleted file mode 100644
index df5f48df2a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/dialogs/AddPersistentClassDialog.java
+++ /dev/null
@@ -1,274 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.dialogs;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.search.IJavaSearchScope;
-import org.eclipse.jdt.core.search.SearchEngine;
-import org.eclipse.jdt.ui.IJavaElementSearchConstants;
-import org.eclipse.jdt.ui.JavaUI;
-import org.eclipse.jface.dialogs.StatusDialog;
-import org.eclipse.jface.viewers.ComboViewer;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jpt.core.internal.IJpaProject;
-import org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal;
-import org.eclipse.jpt.ui.internal.JptUiMessages;
-import org.eclipse.jpt.ui.internal.JptUiPlugin;
-import org.eclipse.jpt.ui.internal.java.details.ITypeMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.mappings.properties.EmbeddableUiProvider;
-import org.eclipse.jpt.ui.internal.java.mappings.properties.EntityUiProvider;
-import org.eclipse.jpt.ui.internal.java.mappings.properties.MappedSuperclassUiProvider;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-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.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.SelectionDialog;
-import org.eclipse.ui.progress.IProgressService;
-
-public class AddPersistentClassDialog extends StatusDialog
-{
- private EntityMappingsInternal entityMappings;
-
- private Text classText;
-
- private Button classBrowseButton;
-
- private ComboViewer mappingCombo;
-
-
- public AddPersistentClassDialog(Shell parentShell, EntityMappingsInternal entityMappings) {
- super(parentShell);
- this.entityMappings = entityMappings;
- setTitle(JptUiMessages.AddPersistentClassDialog_title);
- }
-
- protected Control createDialogArea(Composite parent) {
- Composite dialogArea = (Composite) super.createDialogArea(parent);
-
- Composite composite = new Composite(dialogArea, SWT.NULL);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
- composite.setLayout(new GridLayout(2, false));
-
- createLabel(composite, 2, JptUiMessages.AddPersistentClassDialog_classLabel);
-
- classText = createText(composite, 1);
- classText.addModifyListener(
- new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- validate();
- }
- }
- );
-
- classBrowseButton = createButton(composite, 1, JptUiMessages.General_browse);
- classBrowseButton.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- IType type = chooseType();
- if (type != null) {
- classText.setText(type.getFullyQualifiedName());
- }
- }
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
- });
-
- createLabel(composite, 2, JptUiMessages.AddPersistentClassDialog_mappingLabel);
-
- mappingCombo = new ComboViewer(createCombo(composite, 2));
- mappingCombo.setContentProvider(
- new IStructuredContentProvider() {
- public void dispose() {}
-
- public Object[] getElements(Object inputElement) {
- return new Object[] {
- MappedSuperclassUiProvider.instance(),
- EntityUiProvider.instance(),
- EmbeddableUiProvider.instance()
- };
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
- });
- mappingCombo.setLabelProvider(
- new LabelProvider() {
- @Override
- public String getText(Object element) {
- return ((ITypeMappingUiProvider) element).label();
- }
- });
- mappingCombo.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- validate();
- }
- });
- mappingCombo.setInput("FOO");
- mappingCombo.getCombo().select(1); // select Entity to begin
-
- // TODO - F1 Help
- // PlatformUI.getWorkbench().getHelpSystem().setHelp(group, IDaliHelpContextIds.NEW_JPA_PROJECT_CONTENT_PAGE_DATABASE);
-
- //getButton(IDialogConstants.OK_ID).setEnabled(false); // disabled to start
- applyDialogFont(dialogArea);
-
- validate();
-
- return dialogArea;
- }
-
- private Label createLabel(Composite container, int span, String text) {
- Label label = new Label(container, SWT.NONE);
- label.setText(text);
- GridData gd = new GridData();
- gd.horizontalSpan = span;
- label.setLayoutData(gd);
- return label;
- }
-
- private Text createText(Composite container, int span) {
- Text text = new Text(container, SWT.BORDER | SWT.SINGLE);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = span;
- gd.widthHint = 250;
- text.setLayoutData(gd);
- return text;
- }
-
- private Button createButton(Composite container, int span, String text) {
- Button button = new Button(container, SWT.NONE);
- button.setText(text);
- GridData gd = new GridData();
- gd.horizontalSpan = span;
- button.setLayoutData(gd);
- return button;
- }
-
- private Combo createCombo(Composite container, int span) {
- Combo combo = new Combo(container, SWT.BORDER | SWT.SINGLE | SWT.READ_ONLY);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = span;
- combo.setLayoutData(gd);
- return combo;
- }
-
- private IJpaProject getJpaProject() {
- return entityMappings.getJpaProject();
- }
-
- public String getClassName() {
- return classText.getText();
- }
-
- public String getMappingKey() {
- StructuredSelection selection = (StructuredSelection) mappingCombo.getSelection();
- return (selection.isEmpty()) ? null : ((ITypeMappingUiProvider) selection.getFirstElement()).mappingKey();
- }
-
- protected IType chooseType() {
- IJavaElement[] elements= new IJavaElement[] { getJpaProject().javaProject() };
- IJavaSearchScope scope= SearchEngine.createJavaSearchScope(elements);
- IProgressService service = PlatformUI.getWorkbench().getProgressService();
-
- SelectionDialog typeSelectionDialog;
- try {
- typeSelectionDialog =
- JavaUI.createTypeDialog(
- getShell(), service, scope,
- IJavaElementSearchConstants.CONSIDER_CLASSES,
- false, getClassName());
- }
- catch (JavaModelException e) {
- JptUiPlugin.log(e);
- throw new RuntimeException(e);
- }
- typeSelectionDialog.setTitle(JptUiMessages.AddPersistentClassDialog_classDialog_title);
- typeSelectionDialog.setMessage(JptUiMessages.AddPersistentClassDialog_classDialog_message);
-
- if (typeSelectionDialog.open() == Window.OK) {
- return (IType) typeSelectionDialog.getResult()[0];
- }
- return null;
- }
-
- private void validate() {
- String className = getClassName();
-
- if (StringTools.stringIsEmpty(className)) {
- updateStatus(
- new Status(
- IStatus.ERROR, JptUiPlugin.PLUGIN_ID,
- JptUiMessages.AddPersistentClassDialog_noClassError));
- return;
- }
-
- IType type;
- try {
- type = getJpaProject().javaProject().findType(className);
- }
- catch (JavaModelException jme) {
- type = null;
- }
-
- if (type == null) {
- updateStatus(
- new Status(
- IStatus.WARNING, JptUiPlugin.PLUGIN_ID,
- JptUiMessages.AddPersistentClassDialog_classNotFoundWarning));
- return;
- }
-
- if (entityMappings.containsPersistentType(type)) {
- updateStatus(
- new Status(
- IStatus.WARNING, JptUiPlugin.PLUGIN_ID,
- JptUiMessages.AddPersistentClassDialog_duplicateClassWarning));
- return;
- }
-
- String mappingKey = getMappingKey();
- if (mappingKey == null) {
- updateStatus(
- new Status(
- IStatus.ERROR, JptUiPlugin.PLUGIN_ID,
- JptUiMessages.AddPersistentClassDialog_noMappingKeyError));
- return;
- }
-
- updateStatus(Status.OK_STATUS);
- }
-
- @Override
- protected void okPressed() {
- entityMappings.addMapping(getClassName(), getMappingKey());
- super.okPressed();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/generic/EntitiesGenerator.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/generic/EntitiesGenerator.java
deleted file mode 100644
index 8613951a8b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/generic/EntitiesGenerator.java
+++ /dev/null
@@ -1,293 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2007 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License 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.ui.internal.generic;
-
-import java.util.Collection;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.resources.WorkspaceJob;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.jpt.core.internal.IJpaFile;
-import org.eclipse.jpt.core.internal.IJpaProject;
-import org.eclipse.jpt.core.internal.synch.SynchronizeClassesJob;
-import org.eclipse.jpt.gen.internal.EntityGenerator;
-import org.eclipse.jpt.gen.internal.PackageGenerator;
-import org.eclipse.jpt.ui.internal.JptUiMessages;
-import org.eclipse.jpt.ui.internal.wizards.GenerateEntitiesWizard;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * EntitiesGenerator
- */
-public class EntitiesGenerator
-{
- private IJpaProject project;
- private IStructuredSelection selection;
-
- // ********** constructors **********
-
- static public void generate( IJpaProject project, IStructuredSelection selection) {
- if(project == null) {
- throw new NullPointerException();
- }
- new EntitiesGenerator( project, selection).generate();
- }
-
- public EntitiesGenerator() {
- super();
- }
-
- private EntitiesGenerator( IJpaProject project, IStructuredSelection selection) {
- super();
- this.project = project;
- this.selection = selection;
- }
-
- // ********** behavior **********
-
- protected void generate() {
- GenerateEntitiesWizard wizard = new GenerateEntitiesWizard(this.project, this.selection);
-
- WizardDialog dialog = new WizardDialog(this.getCurrentShell(), wizard);
- dialog.create();
- int returnCode = dialog.open();
- if (returnCode == Window.OK) {
- WorkspaceJob runnable = new GenerateEntitiesRunnable(
- wizard.getPackageGeneratorConfig(),
- wizard.getEntityGeneratorConfig(),
- wizard.getSelectedTables(),
- wizard.synchronizePersistenceXml(),
- project,
- new OverwriteConfirmer(this.getCurrentShell())
- );
-
- runnable.schedule();
- }
- }
-
- private Shell getCurrentShell() {
- return Display.getCurrent().getActiveShell();
- }
-
- // ********** runnable **********
-
- static class GenerateEntitiesRunnable extends WorkspaceJob {
- private final PackageGenerator.Config packageConfig;
- private final EntityGenerator.Config entityConfig;
- private final Collection selectedTables;
- private final boolean synchronizePersistenceXml;
- private final EntityGenerator.OverwriteConfirmer overwriteConfirmer;
- private final IJpaProject project;
-
- GenerateEntitiesRunnable(
- PackageGenerator.Config packageConfig,
- EntityGenerator.Config entityConfig,
- Collection selectedTables,
- boolean synchronizePersistenceXml,
- IJpaProject project,
- EntityGenerator.OverwriteConfirmer overwriteConfirmer
- ) {
- super("Generating Entities");
- this.packageConfig = packageConfig;
- this.entityConfig = entityConfig;
- this.selectedTables = selectedTables;
- this.synchronizePersistenceXml = synchronizePersistenceXml;
- this.overwriteConfirmer = overwriteConfirmer;
- this.project = project;
- setRule(project.project());
- }
-
- @Override
- public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
- PackageGenerator.generateEntities(this.packageConfig, this.entityConfig, this.selectedTables, this.overwriteConfirmer, monitor);
- //force resourceChangeEvents to be posted before synchronizing persistence.xml
- ResourcesPlugin.getWorkspace().checkpoint(false);
- if (synchronizePersistenceXml) {
- // we currently only support *one* persistence.xml file per project
- IJpaFile resource = project.jpaPlatform().validPersistenceXmlFiles().next();
- if (resource != null) {
- SynchronizeClassesJob job = new SynchronizeClassesJob(resource.getFile());
- job.schedule();
- }
- }
-
- return Status.OK_STATUS;
- }
-
- }
-
- // ********** overwrite confirmer **********
-
- static class OverwriteConfirmer implements EntityGenerator.OverwriteConfirmer {
- private Shell shell;
- private boolean overwriteAll = false;
- private boolean skipAll = false;
-
- OverwriteConfirmer(Shell shell) {
- super();
- this.shell = shell;
- }
-
- public boolean overwrite(final String className) {
- if (this.overwriteAll) {
- return true;
- }
- if (this.skipAll) {
- return false;
- }
- return this.promptUser(className);
- }
-
- private boolean promptUser(String className) {
-
- final OverwriteConfirmerDialog dialog = new OverwriteConfirmerDialog(this.shell, className);
- //get on the UI thread synchronously, need feedback before continuing
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- dialog.open();
- }
- });
- if (dialog.getReturnCode() == Window.CANCEL) {
- throw new OperationCanceledException();
- }
- if (dialog.yes()) {
- return true;
- } else if (dialog.yesToAll()) {
- this.overwriteAll = true;
- return true;
- } else if (dialog.no()) {
- return false;
- } else if (dialog.noToAll()) {
- this.skipAll = true;
- return false;
- }
- throw new IllegalStateException();
- }
-
- }
-
- // ********** dialog **********
-
- static class OverwriteConfirmerDialog extends Dialog {
- private final String className;
- private boolean yes = false;
- private boolean yesToAll = false;
- private boolean no = false;
- private boolean noToAll = false;
-
- OverwriteConfirmerDialog(Shell parent, String className) {
- super(parent);
- this.className = className;
- }
-
- protected void configureShell(Shell shell) {
- super.configureShell(shell);
- shell.setText(JptUiMessages.OverwriteConfirmerDialog_title);
- }
-
- protected Control createDialogArea(Composite parent) {
- Composite composite = (Composite) super.createDialogArea(parent);
- GridLayout gridLayout = (GridLayout) composite.getLayout();
- gridLayout.numColumns = 2;
-
- Label text = new Label(composite, SWT.LEFT);
- text.setText(NLS.bind(JptUiMessages.OverwriteConfirmerDialog_text, this.className));
- text.setLayoutData(new GridData());
-
- return composite;
- }
-
- protected void createButtonsForButtonBar(Composite parent) {
- this.createButton(parent, IDialogConstants.YES_ID, IDialogConstants.YES_LABEL, false);
- this.createButton(parent, IDialogConstants.YES_TO_ALL_ID, IDialogConstants.YES_TO_ALL_LABEL, false);
- this.createButton(parent, IDialogConstants.NO_ID, IDialogConstants.NO_LABEL, true);
- this.createButton(parent, IDialogConstants.NO_TO_ALL_ID, IDialogConstants.NO_TO_ALL_LABEL, false);
- this.createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
- }
-
- protected void buttonPressed(int buttonId) {
- switch (buttonId) {
- case IDialogConstants.YES_ID :
- this.yesPressed();
- break;
- case IDialogConstants.YES_TO_ALL_ID :
- this.yesToAllPressed();
- break;
- case IDialogConstants.NO_ID :
- this.noPressed();
- break;
- case IDialogConstants.NO_TO_ALL_ID :
- this.noToAllPressed();
- break;
- case IDialogConstants.CANCEL_ID :
- this.cancelPressed();
- break;
- default :
- break;
- }
- }
-
- private void yesPressed() {
- this.yes = true;
- this.setReturnCode(OK);
- this.close();
- }
-
- private void yesToAllPressed() {
- this.yesToAll = true;
- this.setReturnCode(OK);
- this.close();
- }
-
- private void noPressed() {
- this.no = true;
- this.setReturnCode(OK);
- this.close();
- }
-
- private void noToAllPressed() {
- this.noToAll = true;
- this.setReturnCode(OK);
- this.close();
- }
-
- boolean yes() {
- return this.yes;
- }
-
- boolean yesToAll() {
- return this.yesToAll;
- }
-
- boolean no() {
- return this.no;
- }
-
- boolean noToAll() {
- return this.noToAll;
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/generic/GenericPlatformUi.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/generic/GenericPlatformUi.java
deleted file mode 100644
index 1490e5fc21..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/generic/GenericPlatformUi.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.generic;
-
-import java.text.MessageFormat;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jpt.core.internal.IJpaProject;
-import org.eclipse.jpt.ui.internal.BaseJpaPlatformUi;
-import org.eclipse.jpt.ui.internal.GenericJpaUiFactory;
-import org.eclipse.jpt.ui.internal.IJpaUiFactory;
-import org.eclipse.jpt.ui.internal.JptUiMessages;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-
-public class GenericPlatformUi extends BaseJpaPlatformUi
-{
- public GenericPlatformUi() {
- super();
- }
-
- @Override
- protected IJpaUiFactory createJpaUiFactory() {
- return new GenericJpaUiFactory();
- }
-
- public void generateDDL(IJpaProject project, IStructuredSelection selection) {
- this.displayNotSupportedMessage(JptUiMessages.GenericPlatformUiDialog_notSupportedMessageTitle, JptUiMessages.GenericPlatformUiDialog_notSupportedMessageText);
- }
-
- protected void displayNotSupportedMessage(String title, String message) {
- String formattedMessage = MessageFormat.format( message, (Object [])(new String [] { message}));
- Shell currentShell = Display.getCurrent().getActiveShell();
- MessageDialog.openInformation(currentShell, title, formattedMessage);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/IAttributeMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/IAttributeMappingUiProvider.java
deleted file mode 100644
index 4493c0c794..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/IAttributeMappingUiProvider.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.java.details;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.jpt.core.internal.IAttributeMapping;
-import org.eclipse.jpt.ui.internal.IJpaUiFactory;
-import org.eclipse.jpt.ui.internal.details.IJpaComposite;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-
-public interface IAttributeMappingUiProvider
-{
- /**
- * A unique string that corresponds to the key of a MappingProvider in the core
- * (IJavaAttributeMappingProvider and/or IXmlAttributeMappingProvider)
- */
- String attributeMappingKey();
-
- /**
- * A label to be displayed to the label as an option in the mapping type combo box
- * @return
- */
- String label();
-
- /**
- * The IJpaComposite that correponds to this mapping type. This will be displayed
- * by the PersistentAttributeDetailsPage when the mapping key matches the key given
- * by this provider. The composites will be stored in a Map with the mapping key as the key.
- * @param factory
- * @param parent
- * @param commandStack
- * @param widgetFactory
- *
- * @return
- */
- IJpaComposite<IAttributeMapping> buildAttributeMappingComposite(
- IJpaUiFactory factory, Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory);
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/ITypeMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/ITypeMappingUiProvider.java
deleted file mode 100644
index 51318e9568..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/ITypeMappingUiProvider.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.java.details;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.ui.internal.details.IJpaComposite;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public interface ITypeMappingUiProvider
-{
- /**
- * A unique string that corresponds to the key of a MappingProvider in the core
- */
- String mappingKey();
-
- /**
- * A label to be displayed to the label as an option in the mapping type combo box
- * @return
- */
- String label();
-
- /**
- * The IJpaComposite that correponds to this mapping type. This will be displayed
- * by the PersistentTypeDetailsPage when the mapping key matches the key given
- * by this provider. The composites will be stored in a Map with the mapping key as the key.
- *
- * @param parent
- * @param commandStack
- * @param widgetFactory
- * @return
- */
- IJpaComposite<ITypeMapping> buildPersistentTypeMappingComposite(
- Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory);
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaDetailsProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaDetailsProvider.java
deleted file mode 100644
index 314f1c505c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaDetailsProvider.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.java.details;
-
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jpt.core.internal.content.java.IJavaContentNodes;
-import org.eclipse.jpt.ui.internal.details.IJpaDetailsPage;
-import org.eclipse.jpt.ui.internal.details.IJpaDetailsProvider;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class JavaDetailsProvider
- implements IJpaDetailsProvider
-{
- public JavaDetailsProvider() {
- super();
- }
-
- public String fileContentType() {
- return JavaCore.JAVA_SOURCE_CONTENT_TYPE;
- }
-
- public IJpaDetailsPage buildDetailsPage(
- Composite parentComposite, Object contentNodeId, TabbedPropertySheetWidgetFactory widgetFactory) {
- if (contentNodeId.equals(IJavaContentNodes.PERSISTENT_TYPE_ID)) {
- return new JavaPersistentTypeDetailsPage(parentComposite, widgetFactory);
- }
- else if (contentNodeId.equals(IJavaContentNodes.PERSISTENT_ATTRIBUTE_ID)) {
- return new JavaPersistentAttributeDetailsPage(parentComposite, widgetFactory);
- }
-
- return null;
- }
-
- public void dispose() {
- // no op ... for now
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaPersistentAttributeDetailsPage.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaPersistentAttributeDetailsPage.java
deleted file mode 100644
index 98536000ad..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaPersistentAttributeDetailsPage.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.java.details;
-
-import java.util.ListIterator;
-import org.eclipse.jpt.core.internal.IPersistentAttribute;
-import org.eclipse.jpt.ui.internal.details.PersistentAttributeDetailsPage;
-import org.eclipse.jpt.ui.internal.java.mappings.properties.NullAttributeMappingUiProvider;
-import org.eclipse.jpt.ui.internal.widgets.CComboViewer;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.part.PageBook;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class JavaPersistentAttributeDetailsPage
- extends PersistentAttributeDetailsPage
-{
- public JavaPersistentAttributeDetailsPage(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, widgetFactory);
- }
-
-
- @Override
- protected ListIterator<IAttributeMappingUiProvider> attributeMappingUiProviders() {
- return jpaPlatformUi().javaAttributeMappingUiProviders();
- }
-
- protected IAttributeMappingUiProvider nullAttributeMappingUiProvider() {
- return NullAttributeMappingUiProvider.instance();
- }
-
- @Override
- protected ListIterator<IAttributeMappingUiProvider> defaultAttributeMappingUiProviders() {
- return jpaPlatformUi().defaultJavaAttributeMappingUiProviders();
- }
-
-
- /**
- * These IAtttributeMappingUiProviders will be used as elements in the attributeMapping combo
- * The first element in the combo will be one of the defaultAttributeMappingUiProviders or
- * if none of those apply the nullAttributeMappingUiProvider will be used. The rest of the elements
- * will be the attributeMappingUiProviders. The defaultAttributeMappingUiProvider is
- * determined by matching its key with the key of the current attributeMapping.
- */
- @Override
- protected IAttributeMappingUiProvider[] attributeMappingUiProvidersFor(IPersistentAttribute persistentAttribute) {
- IAttributeMappingUiProvider[] providers = new IAttributeMappingUiProvider[CollectionTools.size(attributeMappingUiProviders()) + 1];
- providers[0] = defaultAttributeMappingUiProvider(persistentAttribute.defaultMappingKey());
- int i = 1;
- for (ListIterator<IAttributeMappingUiProvider> iterator = attributeMappingUiProviders(); iterator.hasNext(); ) {
- providers[i++] = iterator.next();
- }
- return providers;
- }
-
- @Override
- protected IAttributeMappingUiProvider defaultAttributeMappingUiProvider(String key) {
- for (ListIterator<IAttributeMappingUiProvider> i = defaultAttributeMappingUiProviders(); i.hasNext(); ) {
- IAttributeMappingUiProvider provider = i.next();
- if (provider.attributeMappingKey() == key) {
- return provider;
- }
- }
- return this.nullAttributeMappingUiProvider();
- }
-
- @Override
- protected void initializeLayout(Composite composite) {
- composite.setLayout(new GridLayout(2, false));
-
- GridData gridData;
-
- buildMappingLabel(composite);
-
- CComboViewer mappingCombo = buildMappingCombo(composite);
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- mappingCombo.getCombo().setLayoutData(gridData);
-
- PageBook book = buildMappingPageBook(composite);
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- gridData.horizontalSpan = 2;
- book.setLayoutData(gridData);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaPersistentTypeDetailsPage.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaPersistentTypeDetailsPage.java
deleted file mode 100644
index c795b37178..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaPersistentTypeDetailsPage.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.java.details;
-
-import java.util.ListIterator;
-import org.eclipse.jpt.ui.internal.IJpaPlatformUi;
-import org.eclipse.jpt.ui.internal.PlatformRegistry;
-import org.eclipse.jpt.ui.internal.details.PersistentTypeDetailsPage;
-import org.eclipse.jpt.ui.internal.widgets.CComboViewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.part.PageBook;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class JavaPersistentTypeDetailsPage extends
- PersistentTypeDetailsPage
-{
-
- public JavaPersistentTypeDetailsPage(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, widgetFactory);
- }
-
- protected IJpaPlatformUi jpaPlatformUi() {
- String platformId = getPersistentType().jpaPlatform().getId();
- return PlatformRegistry.instance().jpaPlatform(platformId);
- }
-
- @Override
- protected ListIterator<ITypeMappingUiProvider> typeMappingUiProviders() {
- return jpaPlatformUi().javaTypeMappingUiProviders();
- }
-
- @Override
- protected void initializeLayout(Composite composite) {
- GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = 2;
- composite.setLayout(gridLayout);
-
- buildTypeMappingLabel(composite);
-
- CComboViewer typeMappingCombo = buildTypeMappingCombo(composite);
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- typeMappingCombo.getCombo().setLayoutData(gridData);
-
- PageBook typeMappingPageBook = buildTypeMappingPageBook(composite);
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- gridData.horizontalSpan = 2;
- typeMappingPageBook.setLayoutData(gridData);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/BasicMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/BasicMappingUiProvider.java
deleted file mode 100644
index f9882fb990..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/BasicMappingUiProvider.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.java.mappings.properties;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.ui.internal.IJpaUiFactory;
-import org.eclipse.jpt.ui.internal.details.IJpaComposite;
-import org.eclipse.jpt.ui.internal.java.details.IAttributeMappingUiProvider;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class BasicMappingUiProvider
- implements IAttributeMappingUiProvider
-{
-
- // singleton
- private static final BasicMappingUiProvider INSTANCE = new BasicMappingUiProvider();
-
- /**
- * Return the singleton.
- */
- public static IAttributeMappingUiProvider instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure non-instantiability.
- */
- private BasicMappingUiProvider() {
- super();
- }
-
- public String attributeMappingKey() {
- return IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY;
- }
-
- public String label() {
- return JptUiMappingsMessages.PersistentAttributePage_BasicLabel;
- }
-
- public IJpaComposite buildAttributeMappingComposite(IJpaUiFactory factory, Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return factory.createBasicMappingComposite(parent, commandStack, widgetFactory);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/DefaultBasicMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/DefaultBasicMappingUiProvider.java
deleted file mode 100644
index 5eee3a03f9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/DefaultBasicMappingUiProvider.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.java.mappings.properties;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.ui.internal.IJpaUiFactory;
-import org.eclipse.jpt.ui.internal.details.IJpaComposite;
-import org.eclipse.jpt.ui.internal.java.details.IAttributeMappingUiProvider;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class DefaultBasicMappingUiProvider
- implements IAttributeMappingUiProvider
-{
- // singleton
- private static final DefaultBasicMappingUiProvider INSTANCE = new DefaultBasicMappingUiProvider();
-
- /**
- * Return the singleton.
- */
- public static IAttributeMappingUiProvider instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure non-instantiability.
- */
- private DefaultBasicMappingUiProvider() {
- super();
- }
-
- public String attributeMappingKey() {
- return IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY;
- }
-
- public String label() {
- return "Default (" + JptUiMappingsMessages.PersistentAttributePage_BasicLabel + ")";
- }
-
- public IJpaComposite buildAttributeMappingComposite(IJpaUiFactory factory, Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return factory.createBasicMappingComposite(parent, commandStack, widgetFactory);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/DefaultEmbeddedMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/DefaultEmbeddedMappingUiProvider.java
deleted file mode 100644
index f8c882dba3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/DefaultEmbeddedMappingUiProvider.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.java.mappings.properties;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.ui.internal.IJpaUiFactory;
-import org.eclipse.jpt.ui.internal.details.IJpaComposite;
-import org.eclipse.jpt.ui.internal.java.details.IAttributeMappingUiProvider;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class DefaultEmbeddedMappingUiProvider
- implements IAttributeMappingUiProvider
-{
- // singleton
- private static final DefaultEmbeddedMappingUiProvider INSTANCE = new DefaultEmbeddedMappingUiProvider();
-
- /**
- * Return the singleton.
- */
- public static IAttributeMappingUiProvider instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure non-instantiability.
- */
- private DefaultEmbeddedMappingUiProvider() {
- super();
- }
-
- public String attributeMappingKey() {
- return IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY;
- }
-
- public String label() {
- return "Default (" + JptUiMappingsMessages.PersistentAttributePage_EmbeddedLabel + ")";
- }
-
- public IJpaComposite buildAttributeMappingComposite(IJpaUiFactory factory, Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return factory.createEmbeddedMappingComposite(parent, commandStack, widgetFactory);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/EmbeddableUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/EmbeddableUiProvider.java
deleted file mode 100644
index b15444d07a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/EmbeddableUiProvider.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.java.mappings.properties;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.ui.internal.details.IJpaComposite;
-import org.eclipse.jpt.ui.internal.java.details.ITypeMappingUiProvider;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.mappings.details.EmbeddableComposite;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class EmbeddableUiProvider implements ITypeMappingUiProvider
-{
- // singleton
- private static final EmbeddableUiProvider INSTANCE = new EmbeddableUiProvider();
-
- /**
- * Return the singleton.
- */
- public static ITypeMappingUiProvider instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure non-instantiability.
- */
- private EmbeddableUiProvider() {
- super();
- }
-
- public String mappingKey() {
- return IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY;
- }
-
- public String label() {
- return JptUiMappingsMessages.PersistentTypePage_EmbeddableLabel;
- }
-
- public IJpaComposite buildPersistentTypeMappingComposite(
- Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return new EmbeddableComposite(parent, commandStack, widgetFactory);
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/EmbeddedIdMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/EmbeddedIdMappingUiProvider.java
deleted file mode 100644
index 65b4665844..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/EmbeddedIdMappingUiProvider.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.java.mappings.properties;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.ui.internal.IJpaUiFactory;
-import org.eclipse.jpt.ui.internal.details.IJpaComposite;
-import org.eclipse.jpt.ui.internal.java.details.IAttributeMappingUiProvider;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class EmbeddedIdMappingUiProvider
- implements IAttributeMappingUiProvider
-{
-
- // singleton
- private static final EmbeddedIdMappingUiProvider INSTANCE = new EmbeddedIdMappingUiProvider();
-
- /**
- * Return the singleton.
- */
- public static IAttributeMappingUiProvider instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure non-instantiability.
- */
- private EmbeddedIdMappingUiProvider() {
- super();
- }
-
- public String attributeMappingKey() {
- return IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY;
- }
-
- public String label() {
- return JptUiMappingsMessages.PersistentAttributePage_EmbeddedIdLabel;
- }
-
- public IJpaComposite buildAttributeMappingComposite(IJpaUiFactory factory, Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return factory.createEmbeddedIdMappingComposite(parent, commandStack, widgetFactory);
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/EmbeddedMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/EmbeddedMappingUiProvider.java
deleted file mode 100644
index e5387c4290..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/EmbeddedMappingUiProvider.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.java.mappings.properties;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.ui.internal.IJpaUiFactory;
-import org.eclipse.jpt.ui.internal.details.IJpaComposite;
-import org.eclipse.jpt.ui.internal.java.details.IAttributeMappingUiProvider;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class EmbeddedMappingUiProvider
- implements IAttributeMappingUiProvider
-{
-
- // singleton
- private static final EmbeddedMappingUiProvider INSTANCE = new EmbeddedMappingUiProvider();
-
- /**
- * Return the singleton.
- */
- public static IAttributeMappingUiProvider instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure non-instantiability.
- */
- private EmbeddedMappingUiProvider() {
- super();
- }
-
- public String attributeMappingKey() {
- return IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY;
- }
-
- public String label() {
- return JptUiMappingsMessages.PersistentAttributePage_EmbeddedLabel;
- }
-
- public IJpaComposite buildAttributeMappingComposite(IJpaUiFactory factory, Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return factory.createEmbeddedMappingComposite(parent, commandStack, widgetFactory);
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/EntityUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/EntityUiProvider.java
deleted file mode 100644
index 64c4c2a55e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/EntityUiProvider.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.java.mappings.properties;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.ui.internal.details.IJpaComposite;
-import org.eclipse.jpt.ui.internal.java.details.ITypeMappingUiProvider;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.mappings.details.EntityComposite;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class EntityUiProvider implements ITypeMappingUiProvider
-{
- // singleton
- private static final EntityUiProvider INSTANCE = new EntityUiProvider();
-
- /**
- * Return the singleton.
- */
- public static ITypeMappingUiProvider instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure non-instantiability.
- */
- private EntityUiProvider() {
- super();
- }
-
- public String mappingKey() {
- return IMappingKeys.ENTITY_TYPE_MAPPING_KEY;
- }
-
- public String label() {
- return JptUiMappingsMessages.PersistentTypePage_EntityLabel;
- }
-
- public IJpaComposite buildPersistentTypeMappingComposite(
- Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return new EntityComposite(parent, commandStack, widgetFactory);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/IdMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/IdMappingUiProvider.java
deleted file mode 100644
index 2d1dafd6f7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/IdMappingUiProvider.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.java.mappings.properties;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.ui.internal.IJpaUiFactory;
-import org.eclipse.jpt.ui.internal.details.IJpaComposite;
-import org.eclipse.jpt.ui.internal.java.details.IAttributeMappingUiProvider;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class IdMappingUiProvider
- implements IAttributeMappingUiProvider
-{
- // singleton
- private static final IdMappingUiProvider INSTANCE = new IdMappingUiProvider();
-
- /**
- * Return the singleton.
- */
- public static IAttributeMappingUiProvider instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure non-instantiability.
- */
- private IdMappingUiProvider() {
- super();
- }
-
- public String attributeMappingKey() {
- return IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY;
- }
-
- public String label() {
- return JptUiMappingsMessages.PersistentAttributePage_IdLabel;
- }
-
- public IJpaComposite buildAttributeMappingComposite(IJpaUiFactory factory, Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return factory.createIdMappingComposite(parent, commandStack, widgetFactory);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/ManyToManyMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/ManyToManyMappingUiProvider.java
deleted file mode 100644
index 286c454427..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/ManyToManyMappingUiProvider.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.java.mappings.properties;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.ui.internal.IJpaUiFactory;
-import org.eclipse.jpt.ui.internal.details.IJpaComposite;
-import org.eclipse.jpt.ui.internal.java.details.IAttributeMappingUiProvider;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class ManyToManyMappingUiProvider
- implements IAttributeMappingUiProvider
-{
- // singleton
- private static final ManyToManyMappingUiProvider INSTANCE = new ManyToManyMappingUiProvider();
-
- /**
- * Return the singleton.
- */
- public static IAttributeMappingUiProvider instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure non-instantiability.
- */
- private ManyToManyMappingUiProvider() {
- super();
- }
-
- public String attributeMappingKey() {
- return IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY;
- }
-
- public String label() {
- return JptUiMappingsMessages.PersistentAttributePage_ManyToManyLabel;
- }
-
- public IJpaComposite buildAttributeMappingComposite(IJpaUiFactory factory, Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return factory.createManyToManyMappingComposite(parent, commandStack, widgetFactory);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/ManyToOneMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/ManyToOneMappingUiProvider.java
deleted file mode 100644
index ea619de917..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/ManyToOneMappingUiProvider.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.java.mappings.properties;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.ui.internal.IJpaUiFactory;
-import org.eclipse.jpt.ui.internal.details.IJpaComposite;
-import org.eclipse.jpt.ui.internal.java.details.IAttributeMappingUiProvider;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class ManyToOneMappingUiProvider
- implements IAttributeMappingUiProvider
-{
- // singleton
- private static final ManyToOneMappingUiProvider INSTANCE = new ManyToOneMappingUiProvider();
-
- /**
- * Return the singleton.
- */
- public static IAttributeMappingUiProvider instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure non-instantiability.
- */
- private ManyToOneMappingUiProvider() {
- super();
- }
-
- public String attributeMappingKey() {
- return IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY;
- }
-
- public String label() {
- return JptUiMappingsMessages.PersistentAttributePage_ManyToOneLabel;
- }
-
- public IJpaComposite buildAttributeMappingComposite(IJpaUiFactory factory, Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return factory.createManyToOneMappingComposite(parent, commandStack, widgetFactory);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/MappedSuperclassUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/MappedSuperclassUiProvider.java
deleted file mode 100644
index e15397c483..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/MappedSuperclassUiProvider.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.java.mappings.properties;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.ui.internal.details.IJpaComposite;
-import org.eclipse.jpt.ui.internal.java.details.ITypeMappingUiProvider;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.mappings.details.MappedSuperclassComposite;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class MappedSuperclassUiProvider implements ITypeMappingUiProvider
-{
- // singleton
- private static final MappedSuperclassUiProvider INSTANCE = new MappedSuperclassUiProvider();
-
- /**
- * Return the singleton.
- */
- public static ITypeMappingUiProvider instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure non-instantiability.
- */
- private MappedSuperclassUiProvider() {
- super();
- }
-
- public String mappingKey() {
- return IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY;
- }
-
- public String label() {
- return JptUiMappingsMessages.PersistentTypePage_MappedSuperclassLabel;
- }
-
- public IJpaComposite buildPersistentTypeMappingComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return new MappedSuperclassComposite(parent, commandStack, widgetFactory);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/NullAttributeMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/NullAttributeMappingUiProvider.java
deleted file mode 100644
index ca2907b5ce..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/NullAttributeMappingUiProvider.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.java.mappings.properties;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.ui.internal.IJpaUiFactory;
-import org.eclipse.jpt.ui.internal.details.IJpaComposite;
-import org.eclipse.jpt.ui.internal.java.details.IAttributeMappingUiProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class NullAttributeMappingUiProvider
- implements IAttributeMappingUiProvider
-{
-
- // singleton
- private static final NullAttributeMappingUiProvider INSTANCE = new NullAttributeMappingUiProvider();
-
- /**
- * Return the singleton.
- */
- public static IAttributeMappingUiProvider instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure non-instantiability.
- */
- private NullAttributeMappingUiProvider() {
- super();
- }
-
-
- public String attributeMappingKey() {
- return null;
- }
-
- public String label() {
- return "";
- }
-
- public IJpaComposite buildAttributeMappingComposite(IJpaUiFactory factory, Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return new NullComposite(parent);
- }
-
-
- public static class NullComposite extends Composite
- implements IJpaComposite
- {
- NullComposite(Composite parent) {
- super(parent, SWT.NONE);
- }
-
- public void populate(EObject model) {
- // no op
- }
-
- @Override
- public void dispose() {
- super.dispose();
- }
- public Control getControl() {
- return this;
- }
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/NullTypeMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/NullTypeMappingUiProvider.java
deleted file mode 100644
index 1b44936878..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/NullTypeMappingUiProvider.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.java.mappings.properties;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.ui.internal.details.IJpaComposite;
-import org.eclipse.jpt.ui.internal.java.details.ITypeMappingUiProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class NullTypeMappingUiProvider implements ITypeMappingUiProvider
-{
- // singleton
- private static final NullTypeMappingUiProvider INSTANCE = new NullTypeMappingUiProvider();
-
- /**
- * Return the singleton.
- */
- public static ITypeMappingUiProvider instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure non-instantiability.
- */
- private NullTypeMappingUiProvider() {
- super();
- }
-
- public String mappingKey() {
- return null;
- }
-
- public String label() {
- return "";
- }
-
- public IJpaComposite buildPersistentTypeMappingComposite(
- Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return new NullComposite(parent);
- }
-
-
- public static class NullComposite extends Composite
- implements IJpaComposite
- {
- private Composite composite;
- NullComposite(Composite parent) {
- super(parent, SWT.NONE);
- this.composite = new Composite(parent, SWT.NONE);
- }
-
- public void populate(EObject model) {
- // no op
- }
-
- @Override
- public void dispose() {
- super.dispose();
- }
-
- public Control getControl() {
- return this.composite;
- }
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/OneToManyMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/OneToManyMappingUiProvider.java
deleted file mode 100644
index cc9fd85c26..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/OneToManyMappingUiProvider.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.java.mappings.properties;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.ui.internal.IJpaUiFactory;
-import org.eclipse.jpt.ui.internal.details.IJpaComposite;
-import org.eclipse.jpt.ui.internal.java.details.IAttributeMappingUiProvider;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class OneToManyMappingUiProvider
- implements IAttributeMappingUiProvider
-{
- // singleton
- private static final OneToManyMappingUiProvider INSTANCE = new OneToManyMappingUiProvider();
-
- /**
- * Return the singleton.
- */
- public static IAttributeMappingUiProvider instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure non-instantiability.
- */
- private OneToManyMappingUiProvider() {
- super();
- }
-
- public String attributeMappingKey() {
- return IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY;
- }
-
- public String label() {
- return JptUiMappingsMessages.PersistentAttributePage_OneToManyLabel;
- }
-
- public IJpaComposite buildAttributeMappingComposite(IJpaUiFactory factory, Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return factory.createOneToManyMappingComposite(parent, commandStack, widgetFactory);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/OneToOneMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/OneToOneMappingUiProvider.java
deleted file mode 100644
index d59e50ca32..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/OneToOneMappingUiProvider.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.java.mappings.properties;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.ui.internal.IJpaUiFactory;
-import org.eclipse.jpt.ui.internal.details.IJpaComposite;
-import org.eclipse.jpt.ui.internal.java.details.IAttributeMappingUiProvider;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class OneToOneMappingUiProvider
- implements IAttributeMappingUiProvider
-{
-
- // singleton
- private static final OneToOneMappingUiProvider INSTANCE = new OneToOneMappingUiProvider();
-
- /**
- * Return the singleton.
- */
- public static IAttributeMappingUiProvider instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure non-instantiability.
- */
- private OneToOneMappingUiProvider() {
- super();
- }
-
- public String attributeMappingKey() {
- return IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY;
- }
-
- public String label() {
- return JptUiMappingsMessages.PersistentAttributePage_OneToOneLabel;
- }
-
- public IJpaComposite buildAttributeMappingComposite(IJpaUiFactory factory, Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return factory.createOneToOneMappingComposite(parent, commandStack, widgetFactory);
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/TransientMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/TransientMappingUiProvider.java
deleted file mode 100644
index 10d679d8da..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/TransientMappingUiProvider.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.java.mappings.properties;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.ui.internal.IJpaUiFactory;
-import org.eclipse.jpt.ui.internal.details.IJpaComposite;
-import org.eclipse.jpt.ui.internal.java.details.IAttributeMappingUiProvider;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class TransientMappingUiProvider
- implements IAttributeMappingUiProvider
-{
-
- // singleton
- private static final TransientMappingUiProvider INSTANCE = new TransientMappingUiProvider();
-
- /**
- * Return the singleton.
- */
- public static IAttributeMappingUiProvider instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure non-instantiability.
- */
- private TransientMappingUiProvider() {
- super();
- }
-
- public String attributeMappingKey() {
- return IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY;
- }
-
- public String label() {
- return JptUiMappingsMessages.PersistentAttributePage_TransientLabel;
- }
-
- public IJpaComposite buildAttributeMappingComposite(IJpaUiFactory factory, Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return factory.createTransientMappingComposite(parent, commandStack, widgetFactory);
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/VersionMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/VersionMappingUiProvider.java
deleted file mode 100644
index 67f4d523f1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/VersionMappingUiProvider.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.java.mappings.properties;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.ui.internal.IJpaUiFactory;
-import org.eclipse.jpt.ui.internal.details.IJpaComposite;
-import org.eclipse.jpt.ui.internal.java.details.IAttributeMappingUiProvider;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class VersionMappingUiProvider
- implements IAttributeMappingUiProvider
-{
-
- // singleton
- private static final VersionMappingUiProvider INSTANCE = new VersionMappingUiProvider();
-
- /**
- * Return the singleton.
- */
- public static IAttributeMappingUiProvider instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure non-instantiability.
- */
- private VersionMappingUiProvider() {
- super();
- }
-
- public String attributeMappingKey() {
- return IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY;
- }
-
- public String label() {
- return JptUiMappingsMessages.PersistentAttributePage_VersionLabel;
- }
-
- public IJpaComposite buildAttributeMappingComposite(IJpaUiFactory factory, Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return factory.createVersionMappingComposite(parent, commandStack, widgetFactory);
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/structure/JavaCompilationUnitItemProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/structure/JavaCompilationUnitItemProvider.java
deleted file mode 100644
index ba60ac46d8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/structure/JavaCompilationUnitItemProvider.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 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.ui.internal.java.structure;
-
-import java.util.Collection;
-import org.eclipse.emf.common.notify.AdapterFactory;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
-import org.eclipse.emf.edit.provider.IItemLabelProvider;
-import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
-import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
-import org.eclipse.emf.edit.provider.ItemProviderAdapter;
-import org.eclipse.emf.edit.provider.ViewerNotification;
-import org.eclipse.jpt.core.internal.content.java.JpaCompilationUnit;
-import org.eclipse.jpt.core.internal.content.java.JpaJavaPackage;
-
-public class JavaCompilationUnitItemProvider extends ItemProviderAdapter
- implements IEditingDomainItemProvider,
- IStructuredItemContentProvider,
- ITreeItemContentProvider,
- IItemLabelProvider
-{
- public JavaCompilationUnitItemProvider(AdapterFactory adapterFactory) {
- super(adapterFactory);
- }
-
- @Override
- protected Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) {
- if (this.childrenFeatures == null) {
- super.getChildrenFeatures(object);
- this.childrenFeatures.add(JpaJavaPackage.Literals.JPA_COMPILATION_UNIT__TYPES);
- }
- return this.childrenFeatures;
- }
-
- @Override
- public void notifyChanged(Notification notification) {
- updateChildren(notification);
-
- switch (notification.getFeatureID(JpaCompilationUnit.class)) {
- case JpaJavaPackage.JPA_COMPILATION_UNIT__TYPES:
- fireNotifyChanged(
- new ViewerNotification(
- notification, notification.getNotifier(), true, false));
- return;
- }
-
- super.notifyChanged(notification);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/structure/JavaPersistentAttributeItemProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/structure/JavaPersistentAttributeItemProvider.java
deleted file mode 100644
index 902c83233e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/structure/JavaPersistentAttributeItemProvider.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.java.structure;
-
-import org.eclipse.emf.common.notify.AdapterFactory;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
-import org.eclipse.emf.edit.provider.IItemLabelProvider;
-import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
-import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
-import org.eclipse.emf.edit.provider.ItemProviderAdapter;
-import org.eclipse.emf.edit.provider.ViewerNotification;
-import org.eclipse.jpt.core.internal.IAttributeMapping;
-import org.eclipse.jpt.core.internal.IPersistentAttribute;
-import org.eclipse.jpt.core.internal.JpaCorePackage;
-import org.eclipse.jpt.core.internal.mappings.IBasic;
-import org.eclipse.jpt.core.internal.mappings.IEmbedded;
-import org.eclipse.jpt.core.internal.mappings.IEmbeddedId;
-import org.eclipse.jpt.core.internal.mappings.IId;
-import org.eclipse.jpt.core.internal.mappings.IManyToMany;
-import org.eclipse.jpt.core.internal.mappings.IManyToOne;
-import org.eclipse.jpt.core.internal.mappings.IOneToMany;
-import org.eclipse.jpt.core.internal.mappings.IOneToOne;
-import org.eclipse.jpt.core.internal.mappings.ITransient;
-import org.eclipse.jpt.core.internal.mappings.IVersion;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsImages;
-
-public class JavaPersistentAttributeItemProvider extends ItemProviderAdapter
- implements IEditingDomainItemProvider,
- IStructuredItemContentProvider,
- ITreeItemContentProvider,
- IItemLabelProvider
-{
- public JavaPersistentAttributeItemProvider(AdapterFactory adapterFactory) {
- super(adapterFactory);
- }
-
- @Override
- public Object getImage(Object object) {
- IAttributeMapping mapping = ((IPersistentAttribute) object).getMapping();
-
- if (mapping instanceof IBasic) {
- return JptUiMappingsImages.getImage(JptUiMappingsImages.BASIC);
- }
- else if (mapping instanceof IId) {
- return JptUiMappingsImages.getImage(JptUiMappingsImages.ID);
- }
- else if (mapping instanceof IVersion) {
- return JptUiMappingsImages.getImage(JptUiMappingsImages.VERSION);
- }
- else if (mapping instanceof IEmbedded) {
- return JptUiMappingsImages.getImage(JptUiMappingsImages.EMBEDDED);
- }
- else if (mapping instanceof IEmbeddedId) {
- return JptUiMappingsImages.getImage(JptUiMappingsImages.EMBEDDED_ID);
- }
- else if (mapping instanceof IOneToOne) {
- return JptUiMappingsImages.getImage(JptUiMappingsImages.ONE_TO_ONE);
- }
- else if (mapping instanceof IOneToMany) {
- return JptUiMappingsImages.getImage(JptUiMappingsImages.ONE_TO_MANY);
- }
- else if (mapping instanceof IManyToOne) {
- return JptUiMappingsImages.getImage(JptUiMappingsImages.MANY_TO_ONE);
- }
- else if (mapping instanceof IManyToMany) {
- return JptUiMappingsImages.getImage(JptUiMappingsImages.MANY_TO_MANY);
- }
- else if (mapping instanceof ITransient) {
- return JptUiMappingsImages.getImage(JptUiMappingsImages.TRANSIENT);
- }
- else {
- return JptUiMappingsImages.getImage(JptUiMappingsImages.NULL_ATTRIBUTE_MAPPING);
- }
- }
-
- @Override
- public String getText(Object object) {
- return ((IPersistentAttribute) object).getName();
- }
-
- @Override
- public void notifyChanged(Notification notification) {
- updateChildren(notification);
-
- switch (notification.getFeatureID(IPersistentAttribute.class)) {
- case JpaCorePackage.IPERSISTENT_ATTRIBUTE__MAPPING:
- fireNotifyChanged(new ViewerNotification(notification, notification
- .getNotifier(), false, true));
- return;
- }
- super.notifyChanged(notification);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/structure/JavaPersistentTypeItemProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/structure/JavaPersistentTypeItemProvider.java
deleted file mode 100644
index c1cd5bb875..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/structure/JavaPersistentTypeItemProvider.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 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.ui.internal.java.structure;
-
-import java.util.Collection;
-import org.eclipse.emf.common.notify.AdapterFactory;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
-import org.eclipse.emf.edit.provider.IItemLabelProvider;
-import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
-import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
-import org.eclipse.emf.edit.provider.ItemProviderAdapter;
-import org.eclipse.emf.edit.provider.ViewerNotification;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jpt.core.internal.IPersistentType;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.core.internal.JpaCorePackage;
-import org.eclipse.jpt.core.internal.content.java.JavaPersistentType;
-import org.eclipse.jpt.core.internal.content.java.JpaJavaPackage;
-import org.eclipse.jpt.core.internal.mappings.IEmbeddable;
-import org.eclipse.jpt.core.internal.mappings.IEntity;
-import org.eclipse.jpt.core.internal.mappings.IMappedSuperclass;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsImages;
-
-public class JavaPersistentTypeItemProvider extends ItemProviderAdapter
- implements IEditingDomainItemProvider,
- IStructuredItemContentProvider,
- ITreeItemContentProvider,
- IItemLabelProvider
-{
- public JavaPersistentTypeItemProvider(AdapterFactory adapterFactory) {
- super(adapterFactory);
- }
-
-
- @Override
- protected Collection getChildrenFeatures(Object object) {
- if (childrenFeatures == null) {
- super.getChildrenFeatures(object);
- childrenFeatures.add(JpaJavaPackage.Literals.JAVA_PERSISTENT_TYPE__ATTRIBUTES);
- }
- return childrenFeatures;
- }
-
- @Override
- public Object getImage(Object object) {
- ITypeMapping mapping = ((IPersistentType) object).getMapping();
-
-
- if (mapping instanceof IEntity) {
- return JptUiMappingsImages.getImage(JptUiMappingsImages.ENTITY);
- }
- else if (mapping instanceof IEmbeddable) {
- return JptUiMappingsImages.getImage(JptUiMappingsImages.EMBEDDABLE);
- }
- else if (mapping instanceof IMappedSuperclass) {
- return JptUiMappingsImages.getImage(JptUiMappingsImages.MAPPED_SUPERCLASS);
- }
- else {
- return null;
- }
- }
-
- @Override
- public String getText(Object object) {
- IType type = ((IPersistentType) object).findJdtType();
- return (type == null) ? "" : type.getElementName();
- }
-
- @Override
- public void notifyChanged(Notification notification) {
- updateChildren(notification);
-
- switch (notification.getFeatureID(JavaPersistentType.class)) {
- case JpaCorePackage.IPERSISTENT_TYPE__MAPPING_KEY:
- fireNotifyChanged(
- new ViewerNotification(
- notification, notification.getNotifier(), false, true));
- return;
-
- case JpaJavaPackage.JAVA_PERSISTENT_TYPE__ATTRIBUTES:
- fireNotifyChanged(
- new ViewerNotification(
- notification, notification.getNotifier(), true, false));
- return;
- }
-
- super.notifyChanged(notification);
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/structure/JavaStructureProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/structure/JavaStructureProvider.java
deleted file mode 100644
index a1af28c175..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/structure/JavaStructureProvider.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 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.ui.internal.java.structure;
-
-import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
-import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jpt.ui.internal.structure.IJpaStructureProvider;
-
-public class JavaStructureProvider implements IJpaStructureProvider
-{
- public String fileContentType() {
- return JavaCore.JAVA_SOURCE_CONTENT_TYPE;
- }
-
- public ITreeContentProvider buildContentProvider() {
- return new AdapterFactoryContentProvider(new JpaCoreJavaItemProviderAdapterFactory());
- }
-
- public ILabelProvider buildLabelProvider() {
- return new AdapterFactoryLabelProvider(new JpaCoreJavaItemProviderAdapterFactory());
- }
-
- public void dispose() {
- // TODO Auto-generated method stub
-
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/structure/JpaCoreJavaItemProviderAdapterFactory.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/structure/JpaCoreJavaItemProviderAdapterFactory.java
deleted file mode 100644
index 730853482c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/structure/JpaCoreJavaItemProviderAdapterFactory.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 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.ui.internal.java.structure;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.Notifier;
-import org.eclipse.emf.edit.provider.ChangeNotifier;
-import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
-import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
-import org.eclipse.emf.edit.provider.IChangeNotifier;
-import org.eclipse.emf.edit.provider.IDisposable;
-import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
-import org.eclipse.emf.edit.provider.IItemLabelProvider;
-import org.eclipse.emf.edit.provider.INotifyChangedListener;
-import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
-import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
-import org.eclipse.jpt.core.internal.content.java.util.JpaJavaAdapterFactory;
-
-/**
- * This is the factory that is used to provide the interfaces needed to support Viewers.
- * The adapters generated by this factory convert EMF adapter notifications into calls to {@link #fireNotifyChanged fireNotifyChanged}.
- * The adapters also support Eclipse property sheets.
- * Note that most of the adapters are shared among multiple instances.
- */
-public class JpaCoreJavaItemProviderAdapterFactory
- extends JpaJavaAdapterFactory
- implements ComposeableAdapterFactory,
- IChangeNotifier,
- IDisposable
-{
- /**
- * This keeps track of the root adapter factory that delegates to this adapter factory.
- */
- protected ComposedAdapterFactory parentAdapterFactory;
-
- /**
- * This is used to implement {@link org.eclipse.emf.edit.provider.IChangeNotifier}.
- */
- protected IChangeNotifier changeNotifier = new ChangeNotifier();
-
- /**
- * This keeps track of all the supported types checked by {@link #isFactoryForType isFactoryForType}.
- */
- protected Collection supportedTypes = new ArrayList();
-
-
- public JpaCoreJavaItemProviderAdapterFactory() {
- supportedTypes.add(IEditingDomainItemProvider.class);
- supportedTypes.add(IStructuredItemContentProvider.class);
- supportedTypes.add(ITreeItemContentProvider.class);
- supportedTypes.add(IItemLabelProvider.class);
- }
-
-
- protected JavaCompilationUnitItemProvider javaCompilationUnitItemProvider;
-
- public Adapter createJpaCompilationUnitAdapter() {
- if (javaCompilationUnitItemProvider == null) {
- javaCompilationUnitItemProvider = new JavaCompilationUnitItemProvider(this);
- }
-
- return javaCompilationUnitItemProvider;
- }
-
- protected JavaPersistentTypeItemProvider javaPersistentTypeItemProvider;
-
- public Adapter createJavaPersistentTypeAdapter() {
- if (javaPersistentTypeItemProvider == null) {
- javaPersistentTypeItemProvider = new JavaPersistentTypeItemProvider(this);
- }
-
- return javaPersistentTypeItemProvider;
- }
-
- protected JavaPersistentAttributeItemProvider javaPersistentAttributeItemProvider;
-
- public Adapter createJavaPersistentAttributeAdapter() {
- if (javaPersistentAttributeItemProvider == null) {
- javaPersistentAttributeItemProvider = new JavaPersistentAttributeItemProvider(
- this);
- }
-
- return javaPersistentAttributeItemProvider;
- }
-
- /**
- * This returns the root adapter factory that contains this factory.
- */
- public ComposeableAdapterFactory getRootAdapterFactory() {
- return parentAdapterFactory == null ?
- this :
- parentAdapterFactory.getRootAdapterFactory();
- }
-
- /**
- * This sets the composed adapter factory that contains this factory.
- */
- public void setParentAdapterFactory(
- ComposedAdapterFactory parentAdapterFactory) {
- this.parentAdapterFactory = parentAdapterFactory;
- }
-
- public boolean isFactoryForType(Object type) {
- return supportedTypes.contains(type) || super.isFactoryForType(type);
- }
-
- /**
- * This implementation substitutes the factory itself as the key for the adapter.
- */
- public Adapter adapt(Notifier notifier, Object type) {
- return super.adapt(notifier, this);
- }
-
- public Object adapt(Object object, Object type) {
- if (isFactoryForType(type)) {
- Object adapter = super.adapt(object, type);
- if (!(type instanceof Class)
- || (((Class) type).isInstance(adapter))) {
- return adapter;
- }
- }
-
- return null;
- }
-
- /**
- * This adds a listener.
- */
- public void addListener(INotifyChangedListener notifyChangedListener) {
- changeNotifier.addListener(notifyChangedListener);
- }
-
- /**
- * This removes a listener.
- */
- public void removeListener(INotifyChangedListener notifyChangedListener) {
- changeNotifier.removeListener(notifyChangedListener);
- }
-
- /**
- * This delegates to {@link #changeNotifier} and to {@link #parentAdapterFactory}.
- */
- public void fireNotifyChanged(Notification notification) {
- changeNotifier.fireNotifyChanged(notification);
-
- if (parentAdapterFactory != null) {
- parentAdapterFactory.fireNotifyChanged(notification);
- }
- }
-
- /**
- * This disposes all of the item providers created by this factory.
- */
- public void dispose() {
- if (javaCompilationUnitItemProvider != null) {
- javaCompilationUnitItemProvider.dispose();
- }
- if (javaPersistentTypeItemProvider != null) {
- javaPersistentTypeItemProvider.dispose();
- }
- if (javaPersistentAttributeItemProvider != null) {
- javaPersistentAttributeItemProvider.dispose();
- }
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/NullLabelProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/NullLabelProvider.java
deleted file mode 100644
index 7fb66541d9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/NullLabelProvider.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.jface;
-
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.swt.graphics.Image;
-
-public class NullLabelProvider
- implements ILabelProvider
-{
- public static NullLabelProvider INSTANCE = new NullLabelProvider();
-
-
- private NullLabelProvider() {
- super();
- }
-
-
- public Image getImage(Object element) {
- return null;
- }
-
- public String getText(Object element) {
- return null;
- }
-
- public void addListener(ILabelProviderListener listener) {}
-
- public void dispose() {}
-
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- public void removeListener(ILabelProviderListener listener) {}
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/NullTreeContentProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/NullTreeContentProvider.java
deleted file mode 100644
index 864a29b08f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/NullTreeContentProvider.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.jface;
-
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-
-public class NullTreeContentProvider
- implements ITreeContentProvider
-{
- public static NullTreeContentProvider INSTANCE = new NullTreeContentProvider();
-
-
- private NullTreeContentProvider() {
- super();
- }
-
-
- public Object[] getChildren(Object parentElement) {
- return new Object[0];
- }
-
- public Object getParent(Object element) {
- return null;
- }
-
- public boolean hasChildren(Object element) {
- return false;
- }
-
- public Object[] getElements(Object inputElement) {
- return new Object[0];
- }
-
- public void dispose() {}
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/JptUiMappingsImages.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/JptUiMappingsImages.java
deleted file mode 100644
index 7acab93e34..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/JptUiMappingsImages.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.mappings;
-
-import org.eclipse.jpt.ui.internal.JptUiPlugin;
-import org.eclipse.swt.graphics.Image;
-
-public class JptUiMappingsImages
-{
- public final static String BASIC = "full/obj16/basic";
-
- public final static String EMBEDDABLE = "full/obj16/embeddable";
-
- public final static String EMBEDDED = "full/obj16/embedded";
-
- public final static String EMBEDDED_ID = "full/obj16/embedded-id";
-
- public final static String ENTITY = "full/obj16/entity";
-
- public final static String ENTITY_MAPPINGS = "full/obj16/entity-mappings";
-
- public final static String ID = "full/obj16/id";
-
- public final static String NULL_ATTRIBUTE_MAPPING = "full/obj16/null-attribute-mapping";
-
- public final static String MANY_TO_MANY = "full/obj16/many-to-many";
-
- public final static String MANY_TO_ONE = "full/obj16/many-to-one";
-
- public final static String MAPPED_SUPERCLASS = "full/obj16/mapped-superclass";
-
- public final static String NULL_TYPE_MAPPING = "full/obj16/null-type-mapping";
-
- public final static String ONE_TO_MANY = "full/obj16/one-to-many";
-
- public final static String ONE_TO_ONE = "full/obj16/one-to-one";
-
- public final static String TEMPORAL = "full/obj16/temporal";
-
- public final static String TRANSIENT = "full/obj16/transient";
-
- public final static String VERSION = "full/obj16/version";
-
-
- public static Image getImage(String imageLocator) {
- return JptUiPlugin.getPlugin().getImageDescriptor(imageLocator).createImage();
- }
-
-
- private JptUiMappingsImages() {
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/JptUiMappingsMessages.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/JptUiMappingsMessages.java
deleted file mode 100644
index 03380e75d7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/JptUiMappingsMessages.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.mappings;
-
-import org.eclipse.osgi.util.NLS;
-
-public class JptUiMappingsMessages extends NLS
-{
- private static final String BUNDLE_NAME = "jpt_ui_mappings"; //$NON-NLS-1$
-
- public static String PersistentTypePage_EntityLabel;
- public static String PersistentTypePage_EmbeddableLabel;
- public static String PersistentTypePage_MappedSuperclassLabel;
-
- public static String PersistentAttributePage_BasicLabel;
- public static String PersistentAttributePage_TransientLabel;
- public static String PersistentAttributePage_IdLabel;
- public static String PersistentAttributePage_OneToManyLabel;
- public static String PersistentAttributePage_ManyToOneLabel;
- public static String PersistentAttributePage_ManyToManyLabel;
- public static String PersistentAttributePage_VersionLabel;
- public static String PersistentAttributePage_EmbeddedLabel;
- public static String PersistentAttributePage_EmbeddedIdLabel;
- public static String PersistentAttributePage_OneToOneLabel;
-
-
- public static String EntityGeneralSection_nameDefaultWithOneParam;
- public static String EntityGeneralSection_nameDefaultEmpty;
- public static String EntityGeneralSection_name;
-
- public static String BasicGeneralSection_name;
- public static String BasicGeneralSection_nameDefault;
- public static String BasicGeneralSection_fetchLabel;
- public static String BasicGeneralSection_optionalLabel;
- public static String BasicGeneralSection_lobLabel;
- public static String BasicGeneralSection_temporalLabel;
- public static String BasicGeneralSection_enumeratedLabel;
-
- public static String EntityComposite_tableDefault;
- public static String EntityComposite_tableNoDefaultSpecified;
- public static String EntityComposite_inheritance;
- public static String TableComposite_tableSection;
- public static String TableComposite_defaultEmpty;
- public static String TableComposite_defaultWithOneParam;
-
- public static String TableChooser_label;
- public static String CatalogChooser_label;
- public static String SchemaChooser_label;
-
- public static String ColumnChooser_label;
- public static String ColumnTableChooser_label;
-
- public static String TargetEntityChooser_label;
- public static String TargetEntityChooser_defaultEmpty;
- public static String TargetEntityChooser_defaultWithOneParam;
- public static String TargetEntityChooser_browse;
-
- public static String NonOwningMapping_mappedByLabel;
-
- public static String JoinTableComposite_add;
- public static String JoinTableComposite_defaultEmpty;
- public static String JoinTableComposite_defaultWithOneParam;
- public static String JoinTableComposite_edit;
- public static String JoinTableComposite_inverseJoinColumn;
- public static String JoinTableComposite_joinColumn;
- public static String JoinTableComposite_mappingBetweenTwoParams;
- public static String JoinTableComposite_mappingBetweenTwoParamsDefault;
- public static String JoinTableComposite_mappingBetweenTwoParamsBothDefault;
- public static String JoinTableComposite_mappingBetweenTwoParamsFirstDefault;
- public static String JoinTableComposite_mappingBetweenTwoParamsSecDefault;
- public static String JoinTableComposite_name;
- public static String JoinTableComposite_remove;
- public static String JoinTableComposite_overrideDefaultJoinColumns;
- public static String JoinTableComposite_overrideDefaultInverseJoinColumns;
-
- public static String JoinColumnDialog_addJoinColumn;
- public static String JoinColumnDialog_editJoinColumn;
- public static String JoinColumnDialog_name;
- public static String JoinColumnDialog_insertable;
- public static String JoinColumnDialog_updatable;
- public static String JoinColumnDialog_defaultWithOneParam;
- public static String JoinColumnDialog_referencedColumnName;
- public static String JoinColumnDialog_table;
-
- public static String InverseJoinColumnDialog_defaultWithOneParam;
- public static String InverseJoinColumnDialog_editInverseJoinColumn;
-
-
- public static String MultiRelationshipMappingComposite_cascadeType;
- public static String MultiRelationshipMappingComposite_fetchType;
- public static String MultiRelationshipMappingComposite_general;
- public static String MultiRelationshipMappingComposite_joinTable;
- public static String MultiRelationshipMappingComposite_mappedBy;
- public static String MultiRelationshipMappingComposite_targetEntity;
-
- public static String ColumnComposite_columnSection;
- public static String ColumnComposite_defaultWithOneParam;
- public static String ColumnComposite_defaultEmpty;
- public static String ColumnComposite_insertable;
- public static String ColumnComposite_updatable;
-
- public static String JoinColumnComposite_defaultEmpty;
- public static String JoinColumnComposite_defaultWithOneParam;
- public static String JoinColumnComposite_joinColumn;
- public static String JoinColumnComposite_name;
- public static String JoinColumnComposite_add;
- public static String JoinColumnComposite_edit;
- public static String JoinColumnComposite_mappingBetweenTwoParams;
- public static String JoinColumnComposite_mappingBetweenTwoParamsDefault;
- public static String JoinColumnComposite_mappingBetweenTwoParamsBothDefault;
- public static String JoinColumnComposite_mappingBetweenTwoParamsFirstDefault;
- public static String JoinColumnComposite_mappingBetweenTwoParamsSecDefault;
- public static String JoinColumnComposite_remove;
- public static String JoinColumnComposite_overrideDefaultJoinColumns;
-
- public static String PrimaryKeyJoinColumnsComposite_overrideDefaultPrimaryKeyJoinColumns;
- public static String PrimaryKeyJoinColumnsComposite_add;
- public static String PrimaryKeyJoinColumnsComposite_edit;
- public static String PrimaryKeyJoinColumnsComposite_remove;
- public static String PrimaryKeyJoinColumnsComposite_defaultEmpty;
- public static String PrimaryKeyJoinColumnsComposite_defaultWithOneParam;
- public static String PrimaryKeyJoinColumnsComposite_primaryKeyJoinColumn;
- public static String PrimaryKeyJoinColumnsComposite_mappingBetweenTwoParams;
- public static String PrimaryKeyJoinColumnsComposite_mappingBetweenTwoParamsDefault;
- public static String PrimaryKeyJoinColumnsComposite_mappingBetweenTwoParamsBothDefault;
- public static String PrimaryKeyJoinColumnsComposite_mappingBetweenTwoParamsFirstDefault;
- public static String PrimaryKeyJoinColumnsComposite_mappingBetweenTwoParamsSecDefault;
-
- public static String AttributeOverridesComposite_attributeOverrides;
- public static String AttributeOverridesComposite_overridDefault;
- public static String OverridesComposite_joinColumn;
-
- public static String InheritanceComposite_default;
- public static String InheritanceComposite_strategy;
- public static String InheritanceComposite_discriminatorValue;
- public static String InheritanceComposite_discriminatorValueDefaultWithOneParam;
-
- public static String DiscriminatorColumnComposite_defaultEmpty;
- public static String DiscriminatorColumnComposite_column;
- public static String DiscriminatorColumnComposite_discriminatorType;
-
- public static String GeneratedValueComposite_generatedValue;
- public static String GeneratedValueComposite_generatorName;
- public static String GeneratedValueComposite_strategy;
-
- public static String TableGeneratorComposite_default;
- public static String TableGeneratorComposite_name;
- public static String TableGeneratorComposite_pkColumn;
- public static String TableGeneratorComposite_pkColumnValue;
- public static String TableGeneratorComposite_table;
- public static String TableGeneratorComposite_tableGenerator;
- public static String TableGeneratorComposite_valueColumn;
-
- public static String SequenceGeneratorComposite_sequenceGenerator;
- public static String SequenceGeneratorComposite_name;
- public static String SequenceGeneratorComposite_sequence;
- public static String SequenceGeneratorComposite_default;
-
- public static String IdMappingComposite_pk_generation;
- public static String IdMappingComposite_primaryKeyGeneration;
- public static String IdMappingComposite_tableGenerator;
- public static String IdMappingComposite_sequenceGenerator;
-
- public static String OrderByComposite_orderByGroup;
- public static String OrderByComposite_noOrdering;
- public static String OrderByComposite_primaryKeyOrdering;
- public static String OrderByComposite_customOrdering;
- public static String OrderByComposite_orderByLabel;
-
- public static String SecondaryTablesComposite_secondaryTables;
- public static String SecondaryTablesComposite_add;
- public static String SecondaryTablesComposite_edit;
- public static String SecondaryTablesComposite_remove;
-
- public static String SecondaryTableDialog_editSecondaryTable;
- public static String SecondaryTableDialog_name;
- public static String SecondaryTableDialog_catalog;
- public static String SecondaryTableDialog_schema;
- public static String SecondaryTableDialog_defaultSchema;
- public static String SecondaryTableDialog_defaultCatalog;
-
- public static String AccessTypeCombo_default;
- public static String EnumComboViewer_default;
- public static String MetaDataCompleteCombo_Default;
- public static String JoinColumnDialog_defaultTrue;
- public static String InheritanceComposite_defaultDiscriminatorType;
- public static String GeneratedValueComposite_default;
-
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, JptUiMappingsMessages.class);
- }
-
- private JptUiMappingsMessages() {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/AbstractJoinColumnDialog.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/AbstractJoinColumnDialog.java
deleted file mode 100644
index 2435c30c6f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/AbstractJoinColumnDialog.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.mappings.details;
-
-import java.util.Iterator;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jpt.core.internal.mappings.IAbstractJoinColumn;
-import org.eclipse.jpt.db.internal.Table;
-import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-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.ui.PlatformUI;
-
-//if there is only 1 joinColumn and the user is editing it, they should be
-//able to define defaults. otherwise, we probably shouldn't allow it.
-public abstract class AbstractJoinColumnDialog<E extends IAbstractJoinColumn> extends Dialog {
-
- //if creating a new JoinColumn, this will be null,
- //specify the JoinColumnOwner instead in the appropriate construtor
- private E joinColumn;
-
- private Combo nameCombo;
- private Combo referencedColumnNameCombo;
-
- private boolean defaultNameSelected;
- private String selectedName;
- private boolean defaultReferencedColumnNameSelected;
- private String selectedReferencedColumnName;
-
- AbstractJoinColumnDialog(Shell parent) {
- super(parent);
- }
-
- AbstractJoinColumnDialog(Shell parent, E joinColumn) {
- super(parent);
- this.joinColumn = joinColumn;
- }
-
- protected String getAddTitle() {
- return JptUiMappingsMessages.JoinColumnDialog_addJoinColumn;
- }
-
- protected String getEditTitle() {
- return JptUiMappingsMessages.JoinColumnDialog_editJoinColumn;
- }
-
- protected Control createDialogArea(Composite parent) {
- if (this.joinColumn == null) {
- getShell().setText(getAddTitle());
- }
- else {
- getShell().setText(getEditTitle());
- }
- Composite composite = (Composite) super.createDialogArea(parent);
- GridLayout gridLayout = (GridLayout) composite.getLayout();
- gridLayout.numColumns = 2;
-
- Label nameLabel = new Label(composite, SWT.LEFT);
- nameLabel.setText(JptUiMappingsMessages.JoinColumnDialog_name);
- GridData gridData = new GridData();
- nameLabel.setLayoutData(gridData);
-
- this.nameCombo = new Combo(composite, SWT.LEFT);
- gridData = new GridData();
- gridData.grabExcessHorizontalSpace = true;
- gridData.horizontalAlignment = SWT.FILL;
- this.nameCombo.setLayoutData(gridData);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this.nameCombo, IJpaHelpContextIds.MAPPING_JOIN_COLUMN_NAME);
- populateNameCombo();
-
- Label referencedColumnNameLabel = new Label(composite, SWT.LEFT);
- referencedColumnNameLabel.setText(JptUiMappingsMessages.JoinColumnDialog_referencedColumnName);
- gridData = new GridData();
- referencedColumnNameLabel.setLayoutData(gridData);
-
- this.referencedColumnNameCombo = new Combo(composite, SWT.LEFT);
- gridData = new GridData();
- gridData.grabExcessHorizontalSpace = true;
- gridData.horizontalAlignment = SWT.FILL;
- this.referencedColumnNameCombo.setLayoutData(gridData);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this.referencedColumnNameCombo, IJpaHelpContextIds.MAPPING_JOIN_REFERENCED_COLUMN);
- populateReferencedNameCombo();
-
- return composite;
- }
-
- protected void populateNameCombo() {
- this.nameCombo.removeAll();
- if (getJoinColumn() != null) {
- this.nameCombo.add(NLS.bind(JptUiMappingsMessages.JoinColumnDialog_defaultWithOneParam, getJoinColumn().getDefaultName()));
- }
- Table table = getNameTable();
- if (table != null) {
- for (Iterator i = table.columnNames(); i.hasNext(); ) {
- this.nameCombo.add((String) i.next());
- }
- }
- if (getJoinColumn() != null) {
- if (getJoinColumn().getSpecifiedName() != null) {
- this.nameCombo.setText(getJoinColumn().getSpecifiedName());
- }
- else {
- this.nameCombo.select(0);
- }
- }
- }
-
- protected Combo getNameCombo() {
- return this.nameCombo;
- }
-
- protected Combo getReferencedColumnNameCombo() {
- return this.referencedColumnNameCombo;
- }
-
- protected abstract Table getNameTable();
-
- protected abstract Table getReferencedNameTable();
-
- protected void populateReferencedNameCombo() {
- if (getJoinColumn() != null) {
- this.referencedColumnNameCombo.add(NLS.bind(JptUiMappingsMessages.JoinColumnDialog_defaultWithOneParam, getJoinColumn().getDefaultReferencedColumnName()));
- }
- Table referencedNameTable = getReferencedNameTable();
- if (referencedNameTable != null) {
- for (Iterator i = referencedNameTable.columnNames(); i.hasNext(); ) {
- this.referencedColumnNameCombo.add((String) i.next());
- }
- }
- if (getJoinColumn() != null) {
- if (getJoinColumn().getSpecifiedReferencedColumnName() != null) {
- this.referencedColumnNameCombo.setText(getJoinColumn().getSpecifiedReferencedColumnName());
- }
- else {
- this.referencedColumnNameCombo.select(0);
- }
- }
- }
-
- protected E getJoinColumn() {
- return this.joinColumn;
- }
-
- protected boolean isDefaultNameSelected() {
- return this.defaultNameSelected;
- }
-
- protected String getSelectedName() {
- return this.selectedName;
- }
-
- protected boolean isDefaultReferencedColumnNameSelected() {
- return this.defaultReferencedColumnNameSelected;
- }
-
- protected String getReferencedColumnName() {
- return this.selectedReferencedColumnName;
- }
-
- public boolean close() {
- this.defaultNameSelected = this.nameCombo.getSelectionIndex() == 0;
- this.selectedName = this.nameCombo.getText();
- this.defaultReferencedColumnNameSelected = this.referencedColumnNameCombo.getSelectionIndex() == 0;
- this.selectedReferencedColumnName = this.referencedColumnNameCombo.getText();
- return super.close();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/BasicComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/BasicComposite.java
deleted file mode 100644
index 1ba80cdb67..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/BasicComposite.java
+++ /dev/null
@@ -1,357 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.mappings.details;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.impl.EObjectImpl;
-import org.eclipse.jpt.core.internal.mappings.DefaultEagerFetchType;
-import org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean;
-import org.eclipse.jpt.core.internal.mappings.EnumType;
-import org.eclipse.jpt.core.internal.mappings.IBasic;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.core.internal.mappings.TemporalType;
-import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.details.BaseJpaComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.EnumComboViewer.EnumHolder;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.help.IWorkbenchHelpSystem;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class BasicComposite extends BaseJpaComposite
-{
- private IBasic basic;
-
- private ColumnComposite columnComposite;
-
- private EnumComboViewer fetchTypeComboViewer;
- private EnumComboViewer optionalComboViewer;
- private LobCheckBox lobCheckBox;
- private EnumComboViewer temporalTypeViewer;
- private EnumComboViewer enumeratedTypeViewer;
-
- public BasicComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, SWT.NULL, commandStack, widgetFactory);
- }
-
-
- @Override
- protected void initializeLayout(Composite composite) {
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- composite.setLayout(layout);
-
- Control generalControl = buildGeneralComposite(composite);
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- generalControl.setLayoutData(gridData);
-
- }
-
- private Control buildGeneralComposite(Composite composite) {
- IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
-
- Composite generalComposite = getWidgetFactory().createComposite(composite);
- GridLayout layout = new GridLayout(2, false);
- layout.marginWidth = 0;
- generalComposite.setLayout(layout);
-
- this.columnComposite = new ColumnComposite(generalComposite, this.commandStack, getWidgetFactory());
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.horizontalSpan = 2;
- this.columnComposite.getControl().setLayoutData(gridData);
-
- CommonWidgets.buildFetchLabel(generalComposite, getWidgetFactory());
- this.fetchTypeComboViewer = CommonWidgets.buildEnumComboViewer(generalComposite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.fetchTypeComboViewer.getControl().setLayoutData(gridData);
- helpSystem.setHelp(fetchTypeComboViewer.getControl(), IJpaHelpContextIds.MAPPING_FETCH_TYPE);
-
- CommonWidgets.buildOptionalLabel(generalComposite, getWidgetFactory());
- this.optionalComboViewer = CommonWidgets.buildEnumComboViewer(generalComposite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.optionalComboViewer.getControl().setLayoutData(gridData);
- helpSystem.setHelp(optionalComboViewer.getControl(), IJpaHelpContextIds.MAPPING_OPTIONAL);
-
- CommonWidgets.buildTemporalLabel(generalComposite, getWidgetFactory());
- this.temporalTypeViewer = CommonWidgets.buildEnumComboViewer(generalComposite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.temporalTypeViewer.getControl().setLayoutData(gridData);
- helpSystem.setHelp(temporalTypeViewer.getControl(), IJpaHelpContextIds.MAPPING_TEMPORAL);
-
- CommonWidgets.buildEnumeratedLabel(generalComposite, getWidgetFactory());
- this.enumeratedTypeViewer = CommonWidgets.buildEnumComboViewer(generalComposite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.enumeratedTypeViewer.getControl().setLayoutData(gridData);
- helpSystem.setHelp(enumeratedTypeViewer.getControl(), IJpaHelpContextIds.MAPPING_ENUMERATED);
-
- this.lobCheckBox = buildLobCheckBox(generalComposite);
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- gridData.horizontalSpan = 2;
- this.lobCheckBox.getControl().setLayoutData(gridData);
- helpSystem.setHelp(lobCheckBox.getControl(), IJpaHelpContextIds.MAPPING_LOB);
-
- return generalComposite;
- }
-
- private LobCheckBox buildLobCheckBox(Composite parent) {
- return new LobCheckBox(parent, this.commandStack, getWidgetFactory());
- }
-
- public void doPopulate(EObject obj) {
- this.basic = (IBasic) obj;
- if (this.basic != null) {
- this.columnComposite.populate(this.basic.getColumn());
- }
- else {
- this.columnComposite.populate(null);
- }
- this.fetchTypeComboViewer.populate(new FetchHolder(this.basic));
- this.optionalComboViewer.populate(new OptionalHolder(this.basic));
- this.lobCheckBox.populate(this.basic);
- this.temporalTypeViewer.populate(new TemporalTypeHolder(this.basic));
- this.enumeratedTypeViewer.populate(new EnumeratedTypeHolder(this.basic));
- }
-
- public void doPopulate() {
- this.columnComposite.populate();
- this.fetchTypeComboViewer.populate();
- this.optionalComboViewer.populate();
- this.lobCheckBox.populate();
- this.temporalTypeViewer.populate();
- this.enumeratedTypeViewer.populate();
- }
-
- protected void engageListeners() {
- }
-
- protected void disengageListeners() {
- }
-
- @Override
- public void dispose() {
- this.columnComposite.dispose();
- this.fetchTypeComboViewer.dispose();
- this.optionalComboViewer.dispose();
- this.lobCheckBox.dispose();
- this.temporalTypeViewer.dispose();
- this.enumeratedTypeViewer.dispose();
- super.dispose();
- }
-
- protected IBasic getBasic() {
- return this.basic;
- }
-
- private class FetchHolder extends EObjectImpl implements EnumHolder {
-
- private IBasic basic;
-
- FetchHolder(IBasic basic) {
- super();
- this.basic = basic;
- }
-
- public Object get() {
- return this.basic.getFetch();
- }
-
- public void set(Object enumSetting) {
- this.basic.setFetch((DefaultEagerFetchType) enumSetting);
-
- }
-
- public Class featureClass() {
- return IBasic.class;
- }
-
- public int featureId() {
- return JpaCoreMappingsPackage.IBASIC__FETCH;
- }
-
- public EObject wrappedObject() {
- return this.basic;
- }
-
- public Object[] enumValues() {
- return DefaultEagerFetchType.VALUES.toArray();
- }
-
- public Object defaultValue() {
- return DefaultEagerFetchType.DEFAULT;
- }
-
- public String defaultString() {
- //TODO move this out of the UI into the model
- return "Eager";
- }
- }
-
-
- private class OptionalHolder extends EObjectImpl implements EnumHolder {
-
- private IBasic basic;
-
- OptionalHolder(IBasic basic) {
- super();
- this.basic = basic;
- }
-
- public Object get() {
- return this.basic.getOptional();
- }
-
- public void set(Object enumSetting) {
- this.basic.setOptional((DefaultTrueBoolean) enumSetting);
- }
-
- public Class featureClass() {
- return IBasic.class;
- }
-
- public int featureId() {
- return JpaCoreMappingsPackage.IBASIC__OPTIONAL;
- }
-
- public EObject wrappedObject() {
- return this.basic;
- }
-
- public Object[] enumValues() {
- return DefaultTrueBoolean.VALUES.toArray();
- }
-
- public Object defaultValue() {
- return DefaultTrueBoolean.DEFAULT;
- }
-
- public String defaultString() {
- //TODO move this out of the UI into the model
- return "True";
- }
-
- }
-
-
- private class TemporalTypeHolder extends EObjectImpl implements EnumHolder {
-
- private IBasic basic;
-
- TemporalTypeHolder(IBasic basic) {
- super();
- this.basic = basic;
- }
-
- public Object get() {
- return this.basic.getTemporal();
- }
-
- public void set(Object enumSetting) {
- this.basic.setTemporal((TemporalType) enumSetting);
- }
-
- public Class featureClass() {
- return IBasic.class;
- }
-
- public int featureId() {
- return JpaCoreMappingsPackage.IBASIC__TEMPORAL;
- }
-
- public EObject wrappedObject() {
- return this.basic;
- }
-
- public Object[] enumValues() {
- return TemporalType.VALUES.toArray();
- }
-
- /**
- * TemporalType has no Default, return null
- */
- public Object defaultValue() {
- return null;
- }
-
- /**
- * TemporalType has no Default, return null
- */
- public String defaultString() {
- return null;
- }
- }
-
- private class EnumeratedTypeHolder extends EObjectImpl implements EnumHolder {
-
- private IBasic basic;
-
- EnumeratedTypeHolder(IBasic basic) {
- super();
- this.basic = basic;
- }
-
- public Object get() {
- return this.basic.getEnumerated();
- }
-
- public void set(Object enumSetting) {
- this.basic.setEnumerated((EnumType) enumSetting);
- }
-
- public Class featureClass() {
- return IBasic.class;
- }
-
- public int featureId() {
- return JpaCoreMappingsPackage.IBASIC__ENUMERATED;
- }
-
- public EObject wrappedObject() {
- return this.basic;
- }
-
- public Object[] enumValues() {
- return EnumType.VALUES.toArray();
- }
-
- public Object defaultValue() {
- return EnumType.DEFAULT;
- }
-
- public String defaultString() {
- //TODO move this out of the UI into the model
- return "Ordinal";
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/CascadeComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/CascadeComposite.java
deleted file mode 100644
index a2eb0eb160..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/CascadeComposite.java
+++ /dev/null
@@ -1,378 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.mappings.details;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.mappings.ICascade;
-import org.eclipse.jpt.core.internal.mappings.IRelationshipMapping;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.ui.internal.details.BaseJpaComposite;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class CascadeComposite extends BaseJpaComposite
-{
- private IRelationshipMapping relationshipMapping;
- private ICascade cascade;
-
- private Adapter relationshipMappingListener;
- private Adapter cascadeListener;
-
-
- private Button allCheckBox;
- private Button persistCheckBox;
- private Button mergeCheckBox;
- private Button removeCheckBox;
- private Button refreshCheckBox;
-
- public CascadeComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, SWT.NULL, commandStack, widgetFactory);
- this.relationshipMappingListener = buildRelationshipMappingListener();
- this.cascadeListener = buildCascadeListener();
- }
-
- private Adapter buildRelationshipMappingListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- relationshipMappingChanged(notification);
- }
- };
- }
-
- private Adapter buildCascadeListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- cascadeChanged(notification);
- }
- };
- }
-
- @Override
- protected void initializeLayout(Composite composite) {
- composite.setLayout(new FillLayout());
-
- Group cascadeGroup = getWidgetFactory().createGroup(composite, "Cascade");
- GridLayout layout = new GridLayout(5, false);
- cascadeGroup.setLayout(layout);
-
- GridData gridData;
-
- this.allCheckBox = createAllCheckBox(cascadeGroup);
- gridData = new GridData();
- this.allCheckBox.setLayoutData(gridData);
-
- this.persistCheckBox = createPersistCheckBox(cascadeGroup);
- gridData = new GridData();
- this.persistCheckBox.setLayoutData(gridData);
-
- this.mergeCheckBox = createMergeCheckBox(cascadeGroup);
- gridData = new GridData();
- this.mergeCheckBox.setLayoutData(gridData);
-
- this.removeCheckBox = createRemoveCheckBox(cascadeGroup);
- gridData = new GridData();
- this.removeCheckBox.setLayoutData(gridData);
-
- this.refreshCheckBox = createRefreshCheckBox(cascadeGroup);
- gridData = new GridData();
- this.refreshCheckBox.setLayoutData(gridData);
- }
-
- private Button createAllCheckBox(Composite composite) {
- Button button = getWidgetFactory().createButton(composite, "All", SWT.CHECK);
- button.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- CascadeComposite.this.allSelected(e);
- }
- public void widgetSelected(SelectionEvent e) {
- CascadeComposite.this.allSelected(e);
- }
- });
- return button;
- }
-
- protected void allSelected(SelectionEvent e) {
- boolean setSelection = initializeCascade();
- if (setSelection) {
- this.cascade.setAll(this.allCheckBox.getSelection());
- }
- }
-
- private boolean initializeCascade() {
- if (allCheckBoxesFalse() && this.cascade != null) {
- disengageCascadeListener();
- this.relationshipMapping.setCascade(null);
- return false;
- }
- if (this.cascade == null) {
- this.cascade = this.relationshipMapping.createCascade();
- this.relationshipMapping.setCascade(this.cascade);
- engageCascadeListener();
- }
- return true;
- }
-
- private Button createPersistCheckBox(Composite composite) {
- Button button = getWidgetFactory().createButton(composite, "Persist", SWT.CHECK);
- button.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- CascadeComposite.this.persistSelected(e);
- }
- public void widgetSelected(SelectionEvent e) {
- CascadeComposite.this.persistSelected(e);
- }
- });
- return button;
- }
-
- protected void persistSelected(SelectionEvent e) {
- boolean setSelection = initializeCascade();
- if (setSelection) {
- this.cascade.setPersist(this.persistCheckBox.getSelection());
- }
- }
-
- private Button createMergeCheckBox(Composite composite) {
- Button button = getWidgetFactory().createButton(composite, "Merge", SWT.CHECK);
- button.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- CascadeComposite.this.mergeSelected(e);
- }
- public void widgetSelected(SelectionEvent e) {
- CascadeComposite.this.mergeSelected(e);
- }
- });
- return button;
- }
-
- protected void mergeSelected(SelectionEvent e) {
- boolean setSelection = initializeCascade();
- if (setSelection) {
- this.cascade.setMerge(this.mergeCheckBox.getSelection());
- }
- }
-
- private Button createRemoveCheckBox(Composite composite) {
- Button button = getWidgetFactory().createButton(composite, "Remove", SWT.CHECK);
- button.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- CascadeComposite.this.removeSelected(e);
- }
- public void widgetSelected(SelectionEvent e) {
- CascadeComposite.this.removeSelected(e);
- }
- });
- return button;
- }
-
- protected void removeSelected(SelectionEvent e) {
- boolean setSelection = initializeCascade();
- if (setSelection) {
- this.cascade.setRemove(this.removeCheckBox.getSelection());
- }
- }
-
- private Button createRefreshCheckBox(Composite composite) {
- Button button = getWidgetFactory().createButton(composite, "Refresh", SWT.CHECK);
- button.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- CascadeComposite.this.refreshSelected(e);
- }
- public void widgetSelected(SelectionEvent e) {
- CascadeComposite.this.refreshSelected(e);
- }
- });
- return button;
- }
-
- protected void refreshSelected(SelectionEvent e) {
- boolean setSelection = initializeCascade();
- if (setSelection) {
- this.cascade.setRefresh(this.refreshCheckBox.getSelection());
- }
- }
-
- private boolean allCheckBoxesFalse() {
- return !(this.allCheckBox.getSelection()
- || this.persistCheckBox.getSelection()
- || this.mergeCheckBox.getSelection()
- || this.removeCheckBox.getSelection()
- || this.refreshCheckBox.getSelection());
-
-
- }
-
- private void relationshipMappingChanged(Notification notification) {
- if (notification.getFeatureID(IRelationshipMapping.class) ==
- JpaCoreMappingsPackage.IRELATIONSHIP_MAPPING__CASCADE) {
- Display.getDefault().asyncExec(
- new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- if (CascadeComposite.this.cascade != null) {
- disengageCascadeListener();
- }
- CascadeComposite.this.cascade = CascadeComposite.this.relationshipMapping.getCascade();
- populateCascade();
-
- if (CascadeComposite.this.cascade != null) {
- engageCascadeListener();
- }
- }
- });
- }
- }
-
- private void cascadeChanged(final Notification notification) {
- switch (notification.getFeatureID(ICascade.class)) {
- case JpaCoreMappingsPackage.ICASCADE__ALL :
- Display.getDefault().asyncExec(
- new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- CascadeComposite.this.allCheckBox.setSelection(notification.getNewBooleanValue());
- }
- });
- break;
- case JpaCoreMappingsPackage.ICASCADE__PERSIST :
- Display.getDefault().asyncExec(
- new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- CascadeComposite.this.persistCheckBox.setSelection(notification.getNewBooleanValue());
- }
- });
- break;
- case JpaCoreMappingsPackage.ICASCADE__MERGE :
- Display.getDefault().asyncExec(
- new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- CascadeComposite.this.mergeCheckBox.setSelection(notification.getNewBooleanValue());
- }
- });
- break;
- case JpaCoreMappingsPackage.ICASCADE__REMOVE :
- Display.getDefault().asyncExec(
- new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- CascadeComposite.this.removeCheckBox.setSelection(notification.getNewBooleanValue());
- }
- });
- break;
- case JpaCoreMappingsPackage.ICASCADE__REFRESH :
- Display.getDefault().asyncExec(
- new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- CascadeComposite.this.refreshCheckBox.setSelection(notification.getNewBooleanValue());
- }
- });
- break;
- default :
- break;
- }
- if (notification.getFeatureID(ICascade.class) ==
- JpaCoreMappingsPackage.ICASCADE__ALL) {
- Display.getDefault().asyncExec(
- new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- CascadeComposite.this.allCheckBox.setSelection(notification.getNewBooleanValue());
- }
- });
- }
-
- }
-
-
- public void doPopulate(EObject obj) {
- this.relationshipMapping = (IRelationshipMapping) obj;
-
- if (this.relationshipMapping != null) {
- this.cascade = this.relationshipMapping.getCascade();
- populateCascade();
- }
- }
-
- private void populateCascade() {
- if (this.cascade != null) {
- this.allCheckBox.setSelection(this.cascade.isAll());
- this.persistCheckBox.setSelection(this.cascade.isPersist());
- this.mergeCheckBox.setSelection(this.cascade.isMerge());
- this.removeCheckBox.setSelection(this.cascade.isRemove());
- this.refreshCheckBox.setSelection(this.cascade.isRefresh());
- }
- else {
- this.allCheckBox.setSelection(false);
- this.persistCheckBox.setSelection(false);
- this.mergeCheckBox.setSelection(false);
- this.removeCheckBox.setSelection(false);
- this.refreshCheckBox.setSelection(false);
- }
- }
-
- public void doPopulate() {
- }
-
- protected void engageListeners() {
- if (this.relationshipMapping != null) {
- this.relationshipMapping.eAdapters().add(this.relationshipMappingListener);
- if (this.cascade != null) {
- engageCascadeListener();
- }
- }
- }
-
- protected void engageCascadeListener() {
- this.cascade.eAdapters().add(this.cascadeListener);
- }
-
- protected void disengageCascadeListener() {
- this.cascade.eAdapters().remove(this.cascadeListener);
- }
-
- protected void disengageListeners() {
- if (this.relationshipMapping != null) {
- this.relationshipMapping.eAdapters().remove(this.relationshipMappingListener);
- if (this.cascade != null) {
- disengageCascadeListener();
- }
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/CatalogCombo.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/CatalogCombo.java
deleted file mode 100644
index 0544782356..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/CatalogCombo.java
+++ /dev/null
@@ -1,304 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.mappings.details;
-
-import java.util.Iterator;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.mappings.ITable;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.db.internal.ConnectionListener;
-import org.eclipse.jpt.db.internal.ConnectionProfile;
-import org.eclipse.jpt.db.internal.Database;
-import org.eclipse.jpt.db.internal.Schema;
-import org.eclipse.jpt.db.internal.Table;
-import org.eclipse.jpt.ui.internal.details.BaseJpaController;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class CatalogCombo extends BaseJpaController
-{
- private ITable table;
-
- private Adapter listener;
-
- /**
- * Caching the connectionProfile so we can remove the listener. If the
- * cached table object has been removed from the model then we no longer
- * have access to the parent and cannot find the connectionProfile
- */
- private ConnectionProfile connectionProfile;
-
- private ConnectionListener connectionListener;
-
- private CCombo combo;
-
- public CatalogCombo(Composite parent, CommandStack theCommandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, theCommandStack, widgetFactory);
- this.listener = this.buildTableListener();
- this.connectionListener = this.buildConnectionListener();
- }
-
- private Adapter buildTableListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- CatalogCombo.this.catalogChanged(notification);
- }
- };
- }
-
- private ConnectionListener buildConnectionListener() {
- return new ConnectionListener() {
- public void aboutToClose(ConnectionProfile profile) {
- // not interested to this event.
- }
-
- public void closed(ConnectionProfile profile) {
- getCombo().getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- CatalogCombo.this.populateCatalogCombo();
- }
- });
- }
-
- public void modified(ConnectionProfile profile) {
- getCombo().getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- CatalogCombo.this.populateCatalogCombo();
- }
- });
- }
-
- public boolean okToClose(ConnectionProfile profile) {
- // not interested to this event.
- return true;
- }
-
- public void opened(ConnectionProfile profile) {
- getCombo().getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- CatalogCombo.this.populateCatalogCombo();
- }
- });
- }
-
- public void databaseChanged(ConnectionProfile profile, final Database database) {
- getControl().getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (database == CatalogCombo.this.getDatabase()) {
- if (!getControl().isDisposed()) {
- CatalogCombo.this.populateCatalogCombo();
- }
- }
- }
- });
- }
-
- public void schemaChanged(ConnectionProfile profile, final Schema schema) {
- // not interested to this event.
- }
-
- public void tableChanged(ConnectionProfile profile, final Table table) {
- // not interested to this event.
- }
- };
- }
-
- @Override
- protected void buildWidget(Composite parent) {
- this.combo = getWidgetFactory().createCCombo(parent, SWT.FLAT | SWT.READ_ONLY);
- this.combo.add(JptUiMappingsMessages.TableComposite_defaultEmpty);
- this.combo.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- if (isPopulating()) {
- return;
- }
- String catalogText = ((CCombo) e.getSource()).getText();
- if (catalogText.equals("")) { //$NON-NLS-1$
- catalogText = null;
- if (CatalogCombo.this.table.getSpecifiedCatalog() == null || CatalogCombo.this.table.getSpecifiedCatalog().equals("")) { //$NON-NLS-1$
- return;
- }
- }
- if (catalogText != null && combo.getItemCount() > 0 && catalogText.equals(combo.getItem(0))) {
- catalogText = null;
- }
- if (CatalogCombo.this.table.getSpecifiedCatalog() == null && catalogText != null) {
- CatalogCombo.this.setSpecifiedCatalog(catalogText);
- }
- if (CatalogCombo.this.table.getSpecifiedCatalog() != null && !CatalogCombo.this.table.getSpecifiedCatalog().equals(catalogText)) {
- CatalogCombo.this.setSpecifiedCatalog(catalogText);
- }
- }
- });
- }
-
- private void setSpecifiedCatalog(String catalogName) {
- this.table.setSpecifiedCatalog(catalogName);
- this.getConnectionProfile().setCatalogName(catalogName);
- }
-
- protected void catalogChanged(Notification notification) {
- if (notification.getFeatureID(ITable.class) == JpaCoreMappingsPackage.ITABLE__SPECIFIED_CATALOG) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- CatalogCombo.this.populateCatalogName();
- }
- });
- }
- else if (notification.getFeatureID(ITable.class) == JpaCoreMappingsPackage.ITABLE__DEFAULT_CATALOG) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- CatalogCombo.this.populateDefaultCatalogName();
- }
- });
- }
- }
-
- public void doPopulate(EObject obj) {
- this.table = (ITable) obj;
- if (this.table != null) {
- this.populateCatalogCombo();
- }
- else {
- this.connectionProfile = null;
- }
- }
-
- public void doPopulate() {
- this.populateCatalogCombo();
- }
-
- protected Database getDatabase() {
- return this.getConnectionProfile().getDatabase();
- }
-
- private ConnectionProfile getConnectionProfile() {
- if (this.connectionProfile == null) {
- this.connectionProfile = this.table.getJpaProject().connectionProfile();
- }
- return this.connectionProfile;
- }
-
- private void populateCatalogCombo() {
- if (this.table == null) {
- return;
- }
- this.populateDefaultCatalogName();
- if (this.getConnectionProfile().isConnected()) {
- this.combo.remove(1, this.combo.getItemCount() - 1);
- Database database = this.getDatabase();
- if (database != null) {
- Iterator<String> catalogs = database.catalogNames();
- for (Iterator<String> stream = CollectionTools.sort(catalogs); stream.hasNext();) {
- this.combo.add(stream.next());
- }
- }
- }
- else {
- this.combo.remove(1, this.combo.getItemCount() - 1);
- }
- this.populateCatalogName();
- }
-
- protected void populateDefaultCatalogName() {
- // String defaultCatalogName = this.table.getDefaultCatalog(); //
- // DefaultCatalog cannot be initialized if DB not online
- String defaultCatalogName = this.getDatabase().getDefaultCatalogName(); // TOREVIEW
- int selectionIndex = combo.getSelectionIndex();
- combo.setItem(0, NLS.bind(JptUiMappingsMessages.TableComposite_defaultWithOneParam, defaultCatalogName));
- if (selectionIndex == 0) {
- combo.clearSelection();
- combo.select(0);
- }
- }
-
- protected void populateCatalogName() {
- if (this.table == null) {
- return;
- }
- String catalogName = this.table.getSpecifiedCatalog();
- // String defaultCatalogName = this.table.getDefaultCatalog(); //
- // DefaultCatalog cannot be initialized if DB not online
- String defaultCatalogName = this.getDatabase().getDefaultCatalogName(); // TOREVIEW
- if (!StringTools.stringIsEmpty(catalogName)) {
- if (!this.combo.getText().equals(catalogName)) {
- this.combo.setText(catalogName);
- }
- }
- else {
- if (!this.combo.getText().equals(NLS.bind(JptUiMappingsMessages.TableComposite_defaultWithOneParam, defaultCatalogName))) {
- this.combo.select(0);
- }
- }
- }
-
- public CCombo getCombo() {
- return this.combo;
- }
-
- @Override
- public Control getControl() {
- return getCombo();
- }
-
- @Override
- protected void disengageListeners() {
- if (this.table != null) {
- this.removeConnectionListener();
- this.table.eAdapters().remove(this.listener);
- }
- }
-
- @Override
- protected void engageListeners() {
- if (this.table != null) {
- this.table.eAdapters().add(this.listener);
- this.addConnectionListener();
- }
- }
-
- private void addConnectionListener() {
- this.getConnectionProfile().addConnectionListener(this.connectionListener);
- }
-
- private void removeConnectionListener() {
- this.getConnectionProfile().removeConnectionListener(this.connectionListener);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/ColumnComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/ColumnComposite.java
deleted file mode 100644
index 3c55a6524b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/ColumnComposite.java
+++ /dev/null
@@ -1,566 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.mappings.details;
-
-import java.util.Iterator;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.impl.EObjectImpl;
-import org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean;
-import org.eclipse.jpt.core.internal.mappings.IAbstractColumn;
-import org.eclipse.jpt.core.internal.mappings.IColumn;
-import org.eclipse.jpt.core.internal.mappings.INamedColumn;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.db.internal.ConnectionListener;
-import org.eclipse.jpt.db.internal.ConnectionProfile;
-import org.eclipse.jpt.db.internal.Database;
-import org.eclipse.jpt.db.internal.Schema;
-import org.eclipse.jpt.db.internal.Table;
-import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.details.BaseJpaComposite;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.mappings.details.EnumComboViewer.EnumHolder;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.help.IWorkbenchHelpSystem;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-//TODO repopulate this panel based on the Entity table changing
-public class ColumnComposite extends BaseJpaComposite
-{
-
- private IColumn column;
-
- private Adapter columnListener;
- private ConnectionListener connectionListener;
-
- protected CCombo columnCombo;
- protected CCombo tableCombo;
- protected EnumComboViewer insertableComboViewer;
- protected EnumComboViewer updatableComboViewer;
-
- private ConnectionProfile connectionProfile;
-
- public ColumnComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, SWT.NULL, commandStack, widgetFactory);
- this.columnListener = buildColumnListener();
- this.connectionListener = buildConnectionListener();
- }
-
- private Adapter buildColumnListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- columnChanged(notification);
- }
- };
- }
-
- private ConnectionListener buildConnectionListener() {
- return new ConnectionListener() {
-
- public void aboutToClose(ConnectionProfile profile) {
- // not interested to this event.
- }
-
- public void closed(ConnectionProfile profile) {
- getControl().getDisplay().asyncExec( new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- ColumnComposite.this.populateColumnCombo();
- }
- });
- }
-
- public void modified(ConnectionProfile profile) {
- getControl().getDisplay().asyncExec( new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- ColumnComposite.this.populateColumnCombo();
- }
- });
- }
-
- public boolean okToClose(ConnectionProfile profile) {
- // not interested to this event.
- return true;
- }
-
- public void opened(ConnectionProfile profile) {
- getControl().getDisplay().asyncExec( new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- ColumnComposite.this.populateColumnCombo();
- }
- });
- }
-
- public void databaseChanged(ConnectionProfile profile, final Database database) {
- return;
- }
-
- public void schemaChanged(ConnectionProfile profile, final Schema schema) {
- return;
- }
-
- public void tableChanged(ConnectionProfile profile, final Table table) {
- getControl().getDisplay().asyncExec( new Runnable() {
- public void run() {
- if(table == getDbTable()) {
- if (!getControl().isDisposed()) {
- ColumnComposite.this.populateColumnCombo();
- }
- }
- }
- });
- }
- };
- }
-
- @Override
- protected void initializeLayout(Composite composite) {
- IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- composite.setLayout(layout);
-
- Group columnGroup = getWidgetFactory().createGroup(composite, JptUiMappingsMessages.ColumnComposite_columnSection);
- layout = new GridLayout();
- layout.marginHeight = 0;
- columnGroup.setLayout(layout);
- GridData gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace= true;
- columnGroup.setLayoutData(gridData);
-
- //created this composite because combos as direct children of a Group do not have a border, no clue why
- Composite intermediaryComposite = getWidgetFactory().createComposite(columnGroup);
- layout = new GridLayout(2, false);
- layout.marginWidth = 0;
- intermediaryComposite.setLayout(layout);
-
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace= true;
- intermediaryComposite.setLayoutData(gridData);
-
-
- CommonWidgets.buildColumnLabel(intermediaryComposite, getWidgetFactory());
-
- this.columnCombo = buildColumnCombo(intermediaryComposite);
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.columnCombo.setLayoutData(gridData);
- helpSystem.setHelp(columnCombo, IJpaHelpContextIds.MAPPING_COLUMN);
-
-
- CommonWidgets.buildColumnTableLabel(intermediaryComposite, getWidgetFactory());
-
- this.tableCombo = buildTableCombo(intermediaryComposite);
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.tableCombo.setLayoutData(gridData);
- helpSystem.setHelp(tableCombo, IJpaHelpContextIds.MAPPING_COLUMN_TABLE);
-
- getWidgetFactory().createLabel(intermediaryComposite, JptUiMappingsMessages.ColumnComposite_insertable);
-
- this.insertableComboViewer = new EnumComboViewer(intermediaryComposite, this.commandStack, getWidgetFactory());
- this.insertableComboViewer.getControl().setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
- helpSystem.setHelp(this.insertableComboViewer.getControl(), IJpaHelpContextIds.MAPPING_COLUMN_INSERTABLE);
-
- getWidgetFactory().createLabel(intermediaryComposite, JptUiMappingsMessages.ColumnComposite_updatable);
-
- this.updatableComboViewer = new EnumComboViewer(intermediaryComposite, this.commandStack, getWidgetFactory());
- this.updatableComboViewer.getControl().setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
- helpSystem.setHelp(this.updatableComboViewer.getControl(), IJpaHelpContextIds.MAPPING_COLUMN_UPDATABLE);
- }
-
-
- private CCombo buildColumnCombo(Composite parent) {
- final CCombo combo = getWidgetFactory().createCCombo(parent, SWT.FLAT);
- combo.add(JptUiMappingsMessages.ColumnComposite_defaultEmpty);
- combo.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- if (isPopulating()) {
- return;
- }
- String columnText = ((CCombo) e.getSource()).getText();
- if (columnText.equals("")) { //$NON-NLS-1$
- columnText = null;
- if (column.getSpecifiedName() == null || column.getSpecifiedName().equals("")) { //$NON-NLS-1$
- return;
- }
- }
-
- if (columnText != null && combo.getItemCount() > 0 && columnText.equals(combo.getItem(0))) {
- columnText = null;
- }
-
- if (column.getSpecifiedName() == null && columnText != null) {
- column.setSpecifiedName(columnText);
- }
- if (column.getSpecifiedName() != null && !column.getSpecifiedName().equals(columnText)) {
- column.setSpecifiedName(columnText);
- }
- }
- });
- return combo;
- }
-
- private CCombo buildTableCombo(Composite parent) {
- final CCombo combo = getWidgetFactory().createCCombo(parent, SWT.FLAT);
- combo.add(JptUiMappingsMessages.ColumnComposite_defaultEmpty);
- combo.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- if (isPopulating()) {
- return;
- }
- String tableText = ((CCombo) e.getSource()).getText();
- if (tableText.equals("")) { //$NON-NLS-1$
- tableText = null;
- if (column.getSpecifiedTable() == null || column.getSpecifiedTable().equals("")) { //$NON-NLS-1$
- return;
- }
- }
-
- if (tableText != null && combo.getItemCount() > 0 && tableText.equals(combo.getItem(0))) {
- tableText = null;
- }
-
- if (column.getSpecifiedTable() == null && tableText != null) {
- column.setSpecifiedTable(tableText);
- }
- if (column.getSpecifiedTable() != null && !column.getSpecifiedTable().equals(tableText)) {
- column.setSpecifiedTable(tableText);
- }
- }
- });
- return combo;
-
- }
-
- protected void columnChanged(Notification notification) {
- if (notification.getFeatureID(INamedColumn.class) == JpaCoreMappingsPackage.INAMED_COLUMN__SPECIFIED_NAME) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed() || isPopulating()) {
- return;
- }
- populateColumnName();
- }
- });
- }
- else if (notification.getFeatureID(INamedColumn.class) == JpaCoreMappingsPackage.INAMED_COLUMN__DEFAULT_NAME) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- populateDefaultColumnName();
- }
- });
- }
- else if (notification.getFeatureID(IAbstractColumn.class) == JpaCoreMappingsPackage.IABSTRACT_COLUMN__DEFAULT_TABLE) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- populateDefaultColumnTable();
- populateColumnCombo();
- }
- });
- }
- else if (notification.getFeatureID(IAbstractColumn.class) == JpaCoreMappingsPackage.IABSTRACT_COLUMN__SPECIFIED_TABLE) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- populateColumnTable();
- populateColumnCombo();
- }
- });
- }
- }
-
- @Override
- protected void engageListeners() {
- if (this.column != null) {
- this.column.eAdapters().add(this.columnListener);
- this.addConnectionListener();
- }
- }
-
- @Override
- protected void disengageListeners() {
- if (this.column != null) {
- this.removeConnectionListener();
- this.column.eAdapters().remove(this.columnListener);
- }
- }
-
- private ConnectionProfile getConnectionProfile() {
- if (this.connectionProfile == null) {
- this.connectionProfile = this.column.getJpaProject().connectionProfile();
- }
- return this.connectionProfile;
- }
-
- private void addConnectionListener() {
- this.getConnectionProfile().addConnectionListener(this.connectionListener);
- }
-
- private void removeConnectionListener() {
- this.getConnectionProfile().removeConnectionListener(this.connectionListener);
- }
-
- private Table getDbTable() {
- return this.column.dbTable();
- }
-
- private void populateColumnCombo() {
- //TODO don't do instanceof check here - check on Table, or isRoot check on Entity
- //this.tableCombo.setEnabled(!(this.table instanceof SingleTableInheritanceChildTableImpl));
- populateDefaultColumnName();
-
- if (this.getConnectionProfile().isConnected()) {
- this.columnCombo.remove(1, this.columnCombo.getItemCount()-1);
- Table table = getDbTable();
- if (table != null) {
- for (Iterator i = CollectionTools.sort(CollectionTools.list(table.columnNames())).iterator(); i.hasNext();) {
- this.columnCombo.add((String) i.next());
- }
- }
- }
- else {
- this.columnCombo.remove(1, this.columnCombo.getItemCount()-1);
- }
- populateColumnName();
- }
-
- protected void populateDefaultColumnName() {
- String defaultTableName = column.getDefaultName();
- int selectionIndex = columnCombo.getSelectionIndex();
- columnCombo.setItem(0, NLS.bind(JptUiMappingsMessages.ColumnComposite_defaultWithOneParam, defaultTableName));
- if (selectionIndex == 0) {
- //combo text does not update when switching between 2 mappings of the same type
- //that both have a default column name. clear the selection and then set it again
- columnCombo.clearSelection();
- columnCombo.select(0);
- }
- }
-
- protected void populateColumnName() {
- String specifiedColumnName = this.column.getSpecifiedName();
- if (specifiedColumnName != null) {
- if (!this.columnCombo.getText().equals(specifiedColumnName)) {
- this.columnCombo.setText(specifiedColumnName);
- }
- }
- else {
- String defaultColumnName = this.column.getDefaultName();
- if (!this.columnCombo.getText().equals(NLS.bind(JptUiMappingsMessages.ColumnComposite_defaultWithOneParam, defaultColumnName))) {
- this.columnCombo.select(0);
- }
- }
- }
-
- private void populateTableCombo() {
- //TODO don't do instanceof check here - check on Table, or isRoot check on Entity
- //this.tableCombo.setEnabled(!(this.table instanceof SingleTableInheritanceChildTableImpl));
- populateDefaultColumnTable();
- this.tableCombo.remove(1, this.tableCombo.getItemCount()-1);
-
- if (this.column != null) {
- for (Iterator i = this.column.getOwner().getTypeMapping().associatedTableNamesIncludingInherited(); i.hasNext(); ) {
- this.tableCombo.add((String) i.next());
- }
- }
- populateColumnTable();
- }
-
- protected void populateDefaultColumnTable() {
- String defaultTableName = column.getDefaultTable();
- int selectionIndex = tableCombo.getSelectionIndex();
- tableCombo.setItem(0, NLS.bind(JptUiMappingsMessages.ColumnComposite_defaultWithOneParam, defaultTableName));
- if (selectionIndex == 0) {
- //combo text does not update when switching between 2 mappings of the same type
- //that both have a default column name. clear the selection and then set it again
- tableCombo.clearSelection();
- tableCombo.select(0);
- }
- }
-
- protected void populateColumnTable() {
- String tableName = this.column.getSpecifiedTable();
- String defaultTableName = this.column.getDefaultTable();
- if (tableName != null) {
- if (!this.tableCombo.getText().equals(tableName)) {
- this.tableCombo.setText(tableName);
- }
- }
- else {
- if (!this.tableCombo.getText().equals(NLS.bind(JptUiMappingsMessages.ColumnComposite_defaultWithOneParam, defaultTableName))) {
- this.tableCombo.select(0);
- }
- }
- }
-
- public void doPopulate(EObject obj) {
- this.column = (IColumn) obj;
- if (this.column != null) {
- populateColumnCombo();
- populateTableCombo();
- }
- this.insertableComboViewer.populate(new InsertableHolder(this.column));
- this.updatableComboViewer.populate(new UpdatableHolder(this.column));
- }
-
- public void doPopulate() {
- if (this.column != null) {
- populateColumnCombo();
- populateTableCombo();
- }
- else {
- this.connectionProfile = null;
- }
- this.insertableComboViewer.populate();
- this.updatableComboViewer.populate();
- }
-
- protected void enableWidgets(boolean enabled) {
- this.columnCombo.setEnabled(enabled);
- this.tableCombo.setEnabled(enabled);
- this.insertableComboViewer.getControl().setEnabled(enabled);
- this.updatableComboViewer.getControl().setEnabled(enabled);
- }
-
- @Override
- public void dispose() {
- this.insertableComboViewer.dispose();
- this.updatableComboViewer.dispose();
- super.dispose();
- }
-
- private class InsertableHolder extends EObjectImpl implements EnumHolder {
-
- private IAbstractColumn column;
-
- InsertableHolder(IAbstractColumn column) {
- super();
- this.column = column;
- }
-
- public Object get() {
- return this.column.getInsertable();
- }
-
- public void set(Object enumSetting) {
- this.column.setInsertable((DefaultTrueBoolean) enumSetting);
-
- }
-
- public Class featureClass() {
- return IAbstractColumn.class;
- }
-
- public int featureId() {
- return JpaCoreMappingsPackage.IABSTRACT_COLUMN__INSERTABLE;
- }
-
- public EObject wrappedObject() {
- return this.column;
- }
-
- public Object[] enumValues() {
- return DefaultTrueBoolean.VALUES.toArray();
- }
-
- public Object defaultValue() {
- return DefaultTrueBoolean.DEFAULT;
- }
-
- public String defaultString() {
- //TODO move this out of the UI into the model
- return "True";
- }
- }
-
- private class UpdatableHolder extends EObjectImpl implements EnumHolder {
-
- private IAbstractColumn column;
-
- UpdatableHolder(IAbstractColumn column) {
- super();
- this.column = column;
- }
-
- public Object get() {
- return this.column.getUpdatable();
- }
-
- public void set(Object enumSetting) {
- this.column.setUpdatable((DefaultTrueBoolean) enumSetting);
-
- }
-
- public Class featureClass() {
- return IAbstractColumn.class;
- }
-
- public int featureId() {
- return JpaCoreMappingsPackage.IABSTRACT_COLUMN__UPDATABLE;
- }
-
- public EObject wrappedObject() {
- return this.column;
- }
-
- public Object[] enumValues() {
- return DefaultTrueBoolean.VALUES.toArray();
- }
-
- public Object defaultValue() {
- return DefaultTrueBoolean.DEFAULT;
- }
-
- public String defaultString() {
- //TODO move this out of the UI into the model
- return "True";
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/CommonWidgets.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/CommonWidgets.java
deleted file mode 100644
index 14fd1119c0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/CommonWidgets.java
+++ /dev/null
@@ -1,304 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.mappings.details;
-
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.impl.EObjectImpl;
-import org.eclipse.jpt.core.internal.mappings.DefaultEagerFetchType;
-import org.eclipse.jpt.core.internal.mappings.DefaultLazyFetchType;
-import org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean;
-import org.eclipse.jpt.core.internal.mappings.IAbstractColumn;
-import org.eclipse.jpt.core.internal.mappings.IColumn;
-import org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping;
-import org.eclipse.jpt.core.internal.mappings.ISingleRelationshipMapping;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.mappings.details.EnumComboViewer.EnumHolder;
-import org.eclipse.jpt.ui.internal.mappings.details.StringWithDefaultChooser.StringHolder;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class CommonWidgets
-{
- public static Label buildEntityNameLabel(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory) {
- return widgetFactory.createLabel(parent, JptUiMappingsMessages.EntityGeneralSection_name);
- }
-
- public static EntityNameCombo buildEntityNameCombo(
- Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return new EntityNameCombo(parent, commandStack, widgetFactory);
- }
-
- public static Label buildTableLabel(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory) {
- return widgetFactory.createLabel(parent, JptUiMappingsMessages.TableChooser_label);
- }
-
- public static Label buildCatalogLabel(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory) {
- return widgetFactory.createLabel(parent, JptUiMappingsMessages.CatalogChooser_label);
- }
-
- public static Label buildSchemaLabel(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory) {
- return widgetFactory.createLabel(parent, JptUiMappingsMessages.SchemaChooser_label);
- }
-
- public static StringWithDefaultChooser buildStringWithDefaultChooser(
- Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return new StringWithDefaultChooser(parent, commandStack, widgetFactory);
- }
-
-
- public static Label buildFetchLabel(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory) {
- return widgetFactory.createLabel(parent, JptUiMappingsMessages.BasicGeneralSection_fetchLabel);
- }
-
- public static Label buildTargetEntityLabel(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory) {
- return widgetFactory.createLabel(parent, JptUiMappingsMessages.TargetEntityChooser_label);
- }
-
- public static Label buildOptionalLabel(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory) {
- return widgetFactory.createLabel(parent, JptUiMappingsMessages.BasicGeneralSection_optionalLabel);
- }
-
- public static Label buildTemporalLabel(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory) {
- return widgetFactory.createLabel(parent, JptUiMappingsMessages.BasicGeneralSection_temporalLabel);
- }
-
- public static Label buildEnumeratedLabel(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory) {
- return widgetFactory.createLabel(parent, JptUiMappingsMessages.BasicGeneralSection_enumeratedLabel);
- }
-
- public static Label buildMappedByLabel(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory) {
- return widgetFactory.createLabel(parent, JptUiMappingsMessages.NonOwningMapping_mappedByLabel);
- }
-
- public static EnumComboViewer buildEnumComboViewer(
- Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return new EnumComboViewer(parent, commandStack, widgetFactory);
- }
-
- public static EnumHolder buildMultiRelationshipMappingFetchEnumHolder(IMultiRelationshipMapping mapping) {
- return new FetchHolder(mapping);
- }
-
- public static EnumHolder buildSingleRelationshipMappingFetchEnumHolder(ISingleRelationshipMapping mapping) {
- return new SingleRelationshipMappingFetchHolder(mapping);
- }
-
- public static EnumHolder buildOptionalHolder(ISingleRelationshipMapping mapping) {
- return new OptionalHolder(mapping);
- }
-
- public static Label buildColumnLabel(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory) {
- return widgetFactory.createLabel(parent, JptUiMappingsMessages.ColumnChooser_label);
- }
-
- public static Label buildColumnTableLabel(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory) {
- return widgetFactory.createLabel(parent, JptUiMappingsMessages.ColumnTableChooser_label);
- }
-
- public static ColumnTableHolder buildColumnTableHolder(IColumn column) {
- return new ColumnTableHolder(column);
- }
-
- public static TargetEntityChooser buildTargetEntityChooser(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return new TargetEntityChooser(parent, commandStack, widgetFactory);
- }
- private static class FetchHolder extends EObjectImpl implements EnumHolder {
-
- private IMultiRelationshipMapping mapping;
-
- FetchHolder(IMultiRelationshipMapping mapping) {
- super();
- this.mapping = mapping;
- }
-
- public Object get() {
- return this.mapping.getFetch();
- }
-
- public void set(Object enumSetting) {
- this.mapping.setFetch((DefaultLazyFetchType) enumSetting);
-
- }
-
- public Class featureClass() {
- return IMultiRelationshipMapping.class;
- }
-
- public int featureId() {
- return JpaCoreMappingsPackage.IMULTI_RELATIONSHIP_MAPPING__FETCH;
- }
-
- public EObject wrappedObject() {
- return this.mapping;
- }
-
- public Object[] enumValues() {
- return DefaultLazyFetchType.VALUES.toArray();
- }
-
- public Object defaultValue() {
- return DefaultLazyFetchType.DEFAULT;
- }
-
- public String defaultString() {
- //TODO move this out of the UI into the model
- return "Lazy";
- }
- }
-
- private static class SingleRelationshipMappingFetchHolder extends EObjectImpl implements EnumHolder {
-
- private ISingleRelationshipMapping mapping;
-
- SingleRelationshipMappingFetchHolder(ISingleRelationshipMapping mapping) {
- super();
- this.mapping = mapping;
- }
-
- public Object get() {
- return this.mapping.getFetch();
- }
-
- public void set(Object enumSetting) {
- this.mapping.setFetch((DefaultEagerFetchType) enumSetting);
-
- }
-
- public Class featureClass() {
- return ISingleRelationshipMapping.class;
- }
-
- public int featureId() {
- return JpaCoreMappingsPackage.ISINGLE_RELATIONSHIP_MAPPING__FETCH;
- }
-
- public EObject wrappedObject() {
- return this.mapping;
- }
-
- public Object[] enumValues() {
- return DefaultEagerFetchType.VALUES.toArray();
- }
-
- public Object defaultValue() {
- return DefaultEagerFetchType.DEFAULT;
- }
-
- public String defaultString() {
- //TODO move this out of the UI into the model
- return "Eager";
- }
- }
- private static abstract class ColumnHolder extends EObjectImpl implements StringHolder {
- private IAbstractColumn column;
-
- ColumnHolder(IAbstractColumn column) {
- super();
- this.column = column;
- }
-
- public Class featureClass() {
- return IAbstractColumn.class;
- }
-
- public boolean supportsDefault() {
- return true;
- }
-
- public EObject wrappedObject() {
- return this.column;
- }
-
- protected IAbstractColumn getColumn() {
- return this.column;
- }
- }
-
- public static class ColumnTableHolder extends ColumnHolder implements StringHolder {
-
- ColumnTableHolder(IAbstractColumn column) {
- super(column);
- }
-
- public int featureId() {
- return JpaCoreMappingsPackage.IABSTRACT_COLUMN__SPECIFIED_TABLE;
- }
-
- public int defaultFeatureId() {
- return JpaCoreMappingsPackage.IABSTRACT_COLUMN__DEFAULT_TABLE;
- }
-
- public String defaultItem() {
- String defaultName = getColumn().getDefaultTable();
- if (defaultName != null) {
- return NLS.bind(JptUiMappingsMessages.ColumnComposite_defaultWithOneParam, defaultName);
- }
- return JptUiMappingsMessages.ColumnComposite_defaultEmpty;
- }
-
- public String getString() {
- return getColumn().getSpecifiedTable();
- }
-
- public void setString(String newName) {
- getColumn().setSpecifiedTable(newName);
- }
- }
-
- private static class OptionalHolder extends EObjectImpl implements EnumHolder {
-
- private ISingleRelationshipMapping mapping;
-
- OptionalHolder(ISingleRelationshipMapping mapping) {
- super();
- this.mapping = mapping;
- }
-
- public Object get() {
- return this.mapping.getOptional();
- }
-
- public void set(Object enumSetting) {
- this.mapping.setOptional((DefaultTrueBoolean) enumSetting);
- }
-
- public Class featureClass() {
- return ISingleRelationshipMapping.class;
- }
-
- public int featureId() {
- return JpaCoreMappingsPackage.ISINGLE_RELATIONSHIP_MAPPING__OPTIONAL;
- }
-
- public EObject wrappedObject() {
- return this.mapping;
- }
-
- public Object[] enumValues() {
- return DefaultTrueBoolean.VALUES.toArray();
- }
-
- public Object defaultValue() {
- return DefaultTrueBoolean.DEFAULT;
- }
-
- public String defaultString() {
- //TODO move this out of the UI into the model
- return "True";
- }
-
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EmbeddableComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EmbeddableComposite.java
deleted file mode 100644
index b7c98a5e16..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EmbeddableComposite.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.mappings.details;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.ui.internal.details.BaseJpaComposite;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class EmbeddableComposite extends BaseJpaComposite
-{
-// private IEmbeddable embeddable;
-// private Adapter mappedSuperclassListener;
-
- public EmbeddableComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, SWT.NULL, commandStack, widgetFactory);
- //this.mappedSuperclassListener = buildMappedSuperclassListener();
- }
-
-// private Adapter buildMappedSuperclassListener() {
-// return new AdapterImpl() {
-// @Override
-// public void notifyChanged(Notification notification) {
-// mappedSuperclassChanged(notification);
-// }
-// };
-// }
-
- @Override
- protected void initializeLayout(Composite composite) {
- composite.setLayout(new FillLayout(SWT.VERTICAL));
-
-// Label accessTypeLabel = new Label(composite, SWT.LEFT);
-// accessTypeLabel.setText(DaliUiMessages.MappedSuperclassComposite_accessType);
-// this.accessTypeComboViewer = buildAccessTypeCombo(composite);
-// //eventually this will be enabled if editing xml instead of java
-// this.accessTypeComboViewer.getCombo().setEnabled(false);
-// GridData gridData = new GridData();
-// gridData.horizontalAlignment = GridData.FILL;
-// gridData.grabExcessHorizontalSpace = true;
-// this.accessTypeComboViewer.getCombo().setLayoutData(gridData);
-// PlatformUI.getWorkbench().getHelpSystem().setHelp(this.accessTypeComboViewer.getCombo(), IDaliHelpContextIds.ENTITY_ACCESS_TYPE);
-
- }
-
-// private ComboViewer buildAccessTypeCombo(Composite parent) {
-// ComboViewer viewer = new ComboViewer(parent, SWT.READ_ONLY);
-// viewer.add(AccessType.VALUES.toArray());
-// viewer.addSelectionChangedListener(new ISelectionChangedListener() {
-// public void selectionChanged(SelectionChangedEvent event) {
-// if (populating) {
-// return;
-// }
-// if (event.getSelection() instanceof StructuredSelection) {
-// StructuredSelection selection = (StructuredSelection) event.getSelection();
-// editingDomain.getCommandStack().execute(SetCommand.create(editingDomain, persistentType, OrmPackage.eINSTANCE.getPersistentType_AccessType(), selection.getFirstElement()));
-// }
-// }
-// });
-// return viewer;
-// }
-
- @Override
- protected void doPopulate(EObject model) {
- //this.embeddable = (IEmbeddable) model;
- }
-
- @Override
- protected void doPopulate() {
-
- }
-
-
- protected void engageListeners() {
-// this.persistentTypeItemProvider.addListener(getPersistentTypeListener());
-// this.persistentType.eAdapters().add(this.persistentTypeItemProvider);
- }
-
- protected void disengageListeners() {
-// if (this.persistentType != null){
-// this.persistentType.eAdapters().remove(this.persistentTypeItemProvider);
-// this.persistentTypeItemProvider.removeListener(getPersistentTypeListener());
-// }
- }
-
-// private INotifyChangedListener getPersistentTypeListener() {
-// if (this.persistentTypeListener == null) {
-// this.persistentTypeListener = new INotifyChangedListener() {
-// public void notifyChanged(Notification notification) {
-// if (notification.getFeatureID(PersistentType.class) == OrmPackage.PERSISTENT_TYPE__ACCESS_TYPE) {
-// final AccessType accessType = (AccessType) notification.getNewValue();
-// Display.getDefault().syncExec(new Runnable() {
-// public void run() {
-// if (((StructuredSelection) accessTypeComboViewer.getSelection()).getFirstElement() != accessType) {
-// accessTypeComboViewer.setSelection(new StructuredSelection(accessType));
-// }
-// }
-// });
-// }
-// }
-// };
-// }
-// return this.persistentTypeListener;
-// }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EmbeddedAttributeOverridesComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EmbeddedAttributeOverridesComposite.java
deleted file mode 100644
index d0da0632d9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EmbeddedAttributeOverridesComposite.java
+++ /dev/null
@@ -1,338 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.mappings.details;
-
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jface.viewers.IContentProvider;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.ListViewer;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jpt.core.internal.mappings.IAttributeOverride;
-import org.eclipse.jpt.core.internal.mappings.IEmbedded;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.details.BaseJpaComposite;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class EmbeddedAttributeOverridesComposite extends BaseJpaComposite
-{
- private ListViewer listViewer;
-
- private IEmbedded embedded;
- private Adapter embeddedListener;
-
- private IAttributeOverride attributeOverride;
- private Adapter attributeOverrideListener;
-
- protected ColumnComposite columnComposite;
-
- private Button overrideDefaultButton;
-
- public EmbeddedAttributeOverridesComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, SWT.NULL, commandStack, widgetFactory);
- this.embeddedListener = buildEmbeddedListener();
- this.attributeOverrideListener = buildAttributeOverrideListener();
- }
-
- private Adapter buildEmbeddedListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- embeddedChanged(notification);
- }
- };
- }
-
- private Adapter buildAttributeOverrideListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- attributeOverrideChanged(notification);
- }
- };
- }
-
-
- @Override
- protected void initializeLayout(Composite composite) {
- GridLayout layout = new GridLayout(2, false);
- layout.marginWidth = 0;
- composite.setLayout(layout);
-
- Group attributeOverridesGroup = getWidgetFactory().createGroup(
- composite, JptUiMappingsMessages.AttributeOverridesComposite_attributeOverrides);
- attributeOverridesGroup.setLayout(new GridLayout(2, true));
- GridData gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace= true;
- attributeOverridesGroup.setLayoutData(gridData);
-
- this.listViewer = buildAttributeOverridesListViewer(attributeOverridesGroup);
- gridData = new GridData();
- gridData.verticalSpan = 2;
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace= true;
- this.listViewer.getList().setLayoutData(gridData);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this.listViewer.getList(), IJpaHelpContextIds.MAPPING_EMBEDDED_ATTRIBUTE_OVERRIDES);
-
- this.overrideDefaultButton = getWidgetFactory().createButton(attributeOverridesGroup, "Override Default", SWT.CHECK);
- this.overrideDefaultButton.addSelectionListener(buildOverrideDefaultSelectionListener());
- gridData = new GridData();
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- gridData.horizontalAlignment = SWT.FILL;
- this.overrideDefaultButton.setLayoutData(gridData);
-
-
- this.columnComposite = new ColumnComposite(attributeOverridesGroup, commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- gridData.horizontalAlignment = SWT.FILL;
- this.columnComposite.getControl().setLayoutData(gridData);
-
- }
-
- private SelectionListener buildOverrideDefaultSelectionListener() {
- return new SelectionListener(){
-
- public void widgetSelected(SelectionEvent e) {
- overrideDefaultButtonSelected(e);
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- overrideDefaultButtonSelected(e);
- }
- };
- }
-
- private void overrideDefaultButtonSelected(SelectionEvent e) {
- boolean selection = this.overrideDefaultButton.getSelection();
- if (selection) {
- int index = this.embedded.getSpecifiedAttributeOverrides().size();
- IAttributeOverride attributeOverride = this.embedded.createAttributeOverride(index);
- this.embedded.getSpecifiedAttributeOverrides().add(attributeOverride);
- attributeOverride.setName(this.attributeOverride.getName());
- attributeOverride.getColumn().setSpecifiedName(this.attributeOverride.getColumn().getName());
- }
- else {
- this.embedded.getSpecifiedAttributeOverrides().remove(this.attributeOverride);
- }
- }
-
-
- private ListViewer buildAttributeOverridesListViewer(Composite parent) {
- ListViewer listViewer = new ListViewer(parent, SWT.SINGLE | SWT.BORDER);
- listViewer.setLabelProvider(buildAttributeOverridesLabelProvider());
- listViewer.setContentProvider(buildAttributeOverridesContentProvider());
-
- listViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- attributeOverridesListSelectionChanged(event);
- }
- });
-
- return listViewer;
- }
-
- protected void attributeOverridesListSelectionChanged(SelectionChangedEvent event) {
- if (((StructuredSelection) event.getSelection()).isEmpty()) {
- this.columnComposite.populate(null);
- this.columnComposite.enableWidgets(false);
- this.overrideDefaultButton.setSelection(false);
- this.overrideDefaultButton.setEnabled(false);
- }
- else {
- this.attributeOverride = getSelectedAttributeOverride();
- boolean specifiedOverride = this.embedded.getSpecifiedAttributeOverrides().contains(this.attributeOverride);
- this.overrideDefaultButton.setSelection(specifiedOverride);
- this.columnComposite.populate(this.attributeOverride.getColumn());
- this.columnComposite.enableWidgets(specifiedOverride);
- this.overrideDefaultButton.setEnabled(true);
- }
- }
-
- private ILabelProvider buildAttributeOverridesLabelProvider() {
- return new LabelProvider() {
- public String getText(Object element) {
- //TODO also display column name somehow
- return ((IAttributeOverride) element).getName();
- }
- };
- }
-
-
- private IContentProvider buildAttributeOverridesContentProvider() {
- return new IStructuredContentProvider() {
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
-
- public void dispose() {
- }
-
- public Object[] getElements(Object inputElement) {
- return ((IEmbedded) inputElement).getAttributeOverrides().toArray();
- }
- };
- }
-
- private IAttributeOverride getSelectedAttributeOverride() {
- return (IAttributeOverride) ((StructuredSelection) this.listViewer.getSelection()).getFirstElement();
- }
-
-
- public void doPopulate(EObject obj) {
- this.embedded = (IEmbedded) obj;
- if (this.embedded == null) {
- this.attributeOverride = null;
- this.columnComposite.populate(null);
- this.listViewer.setInput(null);
- return;
- }
-
- if (this.listViewer.getInput() != this.embedded) {
- this.listViewer.setInput(this.embedded);
- }
- if (!this.embedded.getAttributeOverrides().isEmpty()) {
- if (this.listViewer.getSelection().isEmpty()) {
- IAttributeOverride attributeOverride = this.embedded.getAttributeOverrides().get(0);
- this.listViewer.setSelection(new StructuredSelection(attributeOverride));
- }
- else {
- this.columnComposite.enableWidgets(true);
- this.columnComposite.populate(((IAttributeOverride)((StructuredSelection) this.listViewer.getSelection()).getFirstElement()).getColumn());
- }
- }
- else {
- this.columnComposite.populate(null);
- this.columnComposite.enableWidgets(false);
- }
- }
-
- @Override
- protected void doPopulate() {
- this.columnComposite.doPopulate();
- }
-
- @Override
- protected void engageListeners() {
- if (this.embedded != null) {
- this.embedded.eAdapters().add(this.embeddedListener);
- for (IAttributeOverride attributeOverride : this.embedded.getAttributeOverrides()) {
- attributeOverride.eAdapters().add(this.attributeOverrideListener);
- }
- }
- }
-
- @Override
- protected void disengageListeners() {
- if (this.embedded != null) {
- this.embedded.eAdapters().remove(this.embeddedListener);
- for (IAttributeOverride attributeOverride : this.embedded.getAttributeOverrides()) {
- attributeOverride.eAdapters().remove(this.attributeOverrideListener);
- }
- }
- }
-
-
- protected void embeddedChanged(Notification notification) {
- switch (notification.getFeatureID(IEmbedded.class)) {
- case JpaCoreMappingsPackage.IEMBEDDED__SPECIFIED_ATTRIBUTE_OVERRIDES :
- case JpaCoreMappingsPackage.IEMBEDDED__DEFAULT_ATTRIBUTE_OVERRIDES :
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (listViewer.getList().isDisposed()) {
- return;
- }
- listViewer.refresh();
- columnComposite.enableWidgets(!listViewer.getSelection().isEmpty());
- if (listViewer.getSelection().isEmpty()) {
- columnComposite.populate(null);
- }
- }
- });
- if (notification.getEventType() == Notification.ADD) {
- ((IAttributeOverride) notification.getNewValue()).eAdapters().add(this.attributeOverrideListener);
- final Object newValue = notification.getNewValue();
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (listViewer.getList().isDisposed()) {
- return;
- }
- listViewer.setSelection(new StructuredSelection(newValue));
- }
- });
- }
- else if (notification.getEventType() == Notification.ADD_MANY) {
- List addedList = (List) notification.getNewValue();
- for (Iterator<IAttributeOverride> i = addedList.iterator(); i.hasNext(); ) {
- IAttributeOverride override = i.next();
- override.eAdapters().add(this.attributeOverrideListener);
- }
- }
- else if (notification.getEventType() == Notification.REMOVE) {
- ((IAttributeOverride) notification.getOldValue()).eAdapters().remove(this.attributeOverrideListener);
- }
- else if (notification.getEventType() == Notification.REMOVE_MANY) {
- List removedList = (List) notification.getOldValue();
- for (Iterator<IAttributeOverride> i = removedList.iterator(); i.hasNext(); ) {
- IAttributeOverride override = i.next();
- override.eAdapters().remove(this.attributeOverrideListener);
- }
- }
- break;
- default :
- break;
- }
- }
-
- protected void attributeOverrideChanged(Notification notification) {
- switch (notification.getFeatureID(IAttributeOverride.class)) {
- case JpaCoreMappingsPackage.IATTRIBUTE_OVERRIDE__NAME :
- final IAttributeOverride attributeOverride = (IAttributeOverride) notification.getNotifier();
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- listViewer.refresh(attributeOverride);
- }
- });
- break;
- default :
- break;
- }
- }
-
- public void dispose() {
- this.columnComposite.dispose();
- super.dispose();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EmbeddedComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EmbeddedComposite.java
deleted file mode 100644
index 3ad33eb5a1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EmbeddedComposite.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.mappings.details;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.ui.internal.details.BaseJpaComposite;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class EmbeddedComposite extends BaseJpaComposite
-{
- private EmbeddedAttributeOverridesComposite attributeOverridesComposite;
-
- public EmbeddedComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, SWT.NULL, commandStack, widgetFactory);
- }
-
- @Override
- protected void initializeLayout(Composite composite) {
- GridLayout layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- composite.setLayout(layout);
-
- GridData gridData;
-
- this.attributeOverridesComposite = new EmbeddedAttributeOverridesComposite(composite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- this.attributeOverridesComposite.getControl().setLayoutData(gridData);
- }
-
-
- public void doPopulate(EObject obj) {
- this.attributeOverridesComposite.populate(obj);
- }
-
- public void doPopulate() {
- this.attributeOverridesComposite.populate();
- }
-
- protected void engageListeners() {
- }
-
- protected void disengageListeners() {
- }
-
- @Override
- public void dispose() {
- this.attributeOverridesComposite.dispose();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EmbeddedIdComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EmbeddedIdComposite.java
deleted file mode 100644
index 13111065c2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EmbeddedIdComposite.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.mappings.details;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.ui.internal.details.BaseJpaComposite;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class EmbeddedIdComposite extends BaseJpaComposite
-{
- public EmbeddedIdComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, SWT.NULL, commandStack, widgetFactory);
- }
-
- @Override
- protected void initializeLayout(Composite composite) {
-
- }
-
-
- public void doPopulate(EObject obj) {
- }
-
- public void doPopulate() {
- }
-
- protected void engageListeners() {
- }
-
- protected void disengageListeners() {
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EntityComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EntityComposite.java
deleted file mode 100644
index e81b6f23a7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EntityComposite.java
+++ /dev/null
@@ -1,213 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.mappings.details;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.mappings.IEntity;
-import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.details.BaseJpaComposite;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.forms.widgets.ExpandableComposite;
-import org.eclipse.ui.forms.widgets.Section;
-import org.eclipse.ui.help.IWorkbenchHelpSystem;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class EntityComposite extends BaseJpaComposite
-{
- private IEntity entity;
-
- private EntityNameCombo entityNameCombo;
-
- private TableComposite tableComposite;
- private InheritanceComposite inheritanceComposite;
- private SecondaryTablesComposite secondaryTablesComposite;
- private OverridesComposite attributeOverridesComposite;
-
- public EntityComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, SWT.NULL, commandStack, widgetFactory);
- }
-
- @Override
- protected void initializeLayout(Composite composite) {
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- composite.setLayout(layout);
-
- Control generalControl = buildGeneralComposite(composite);
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- generalControl.setLayoutData(gridData);
-
- Control attributeOverridesControl = buildAttributeOverridesComposite(composite);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- attributeOverridesControl.setLayoutData(gridData);
-
- Control secondaryTablesControl = buildSecondaryTablesComposite(composite);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- secondaryTablesControl.setLayoutData(gridData);
-
- Control inheritanceControl = buildInheritanceComposite(composite);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- inheritanceControl.setLayoutData(gridData);
- }
-
- private Control buildGeneralComposite(Composite composite) {
- IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
-
- Composite generalComposite = getWidgetFactory().createComposite(composite);
- GridLayout layout = new GridLayout(2, false);
- layout.marginWidth = 0;
- generalComposite.setLayout(layout);
-
- CommonWidgets.buildEntityNameLabel(generalComposite, getWidgetFactory());
-
- this.entityNameCombo =
- CommonWidgets.buildEntityNameCombo(generalComposite, this.commandStack, getWidgetFactory());
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- this.entityNameCombo.getCombo().setLayoutData(gridData);
- helpSystem.setHelp(this.entityNameCombo.getCombo(), IJpaHelpContextIds.ENTITY_NAME);
-
-
- this.tableComposite = new TableComposite(generalComposite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.horizontalSpan = 2;
- this.tableComposite.getControl().setLayoutData(gridData);
-
- return generalComposite;
- }
-
- private Control buildSecondaryTablesComposite(Composite composite) {
- Section section = getWidgetFactory().createSection(composite, SWT.FLAT | ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR);
- section.setText(JptUiMappingsMessages.SecondaryTablesComposite_secondaryTables);
-
- Composite client = getWidgetFactory().createComposite(section);
- section.setClient(client);
-
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- client.setLayout(layout);
-
- this.secondaryTablesComposite = new SecondaryTablesComposite(client, this.commandStack, getWidgetFactory());
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- this.secondaryTablesComposite.getControl().setLayoutData(gridData);
-
- return section;
- }
-
- private Control buildInheritanceComposite(Composite composite) {
- Section section = getWidgetFactory().createSection(composite, SWT.FLAT | ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR);
- section.setText(JptUiMappingsMessages.EntityComposite_inheritance);
-
- Composite inheritanceClient = getWidgetFactory().createComposite(section);
- section.setClient(inheritanceClient);
-
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- inheritanceClient.setLayout(layout);
-
- this.inheritanceComposite = new InheritanceComposite(inheritanceClient, this.commandStack, getWidgetFactory());
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- this.inheritanceComposite.getControl().setLayoutData(gridData);
-
- return section;
- }
-
- private Control buildAttributeOverridesComposite(Composite composite) {
- Section section = getWidgetFactory().createSection(composite, SWT.FLAT | ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR);
- section.setText(JptUiMappingsMessages.AttributeOverridesComposite_attributeOverrides);
- //section.setExpanded(true); //not going to expand this for now, it causes the scroll bar not to appear
- Composite client = getWidgetFactory().createComposite(section);
- section.setClient(client);
-
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- client.setLayout(layout);
-
- this.attributeOverridesComposite = new OverridesComposite(client, this.commandStack, getWidgetFactory());
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- this.attributeOverridesComposite.getControl().setLayoutData(gridData);
-
- return section;
- }
-
- //TODO talk to JavaEditor people about what we can do to hook in TabbedProperties for the JavaEditor
-
- public void doPopulate(EObject obj) {
- this.entity = (IEntity) obj;
- this.entityNameCombo.populate(obj);
- this.attributeOverridesComposite.populate(obj);
- this.secondaryTablesComposite.populate(obj);
- this.inheritanceComposite.populate(obj);
- if (this.entity != null) {
- this.tableComposite.populate(this.entity.getTable());
- }
- else {
- this.tableComposite.populate(null);
- }
- }
-
- public void doPopulate() {
- this.entityNameCombo.populate();
- this.tableComposite.populate();
- this.attributeOverridesComposite.populate();
- this.secondaryTablesComposite.populate();
- this.inheritanceComposite.populate();
- }
-
- protected void engageListeners() {
- }
-
- protected void disengageListeners() {
- }
-
- @Override
- public void dispose() {
- this.entityNameCombo.dispose();
- this.tableComposite.dispose();
- this.attributeOverridesComposite.dispose();
- this.secondaryTablesComposite.dispose();
- this.inheritanceComposite.dispose();
- super.dispose();
- }
-
- protected IEntity getEntity() {
- return this.entity;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EntityNameCombo.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EntityNameCombo.java
deleted file mode 100644
index 8fe0ffcf4c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EntityNameCombo.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.mappings.details;
-
-import java.util.Arrays;
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.mappings.IEntity;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.ui.internal.details.BaseJpaController;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-// TODO get Default updating appropriately based on Entity name default
-
-public class EntityNameCombo extends BaseJpaController
-{
- private IEntity entity;
- private Adapter entityListener;
-
- private CCombo combo;
-
-
- public EntityNameCombo(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, commandStack, widgetFactory);
- buildEntityListener();
- }
-
-
- private void buildEntityListener() {
- entityListener = new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- entityChanged(notification);
- }
- };
- }
-
- @Override
- protected void buildWidget(Composite parent) {
- combo = this.widgetFactory.createCCombo(parent, SWT.FLAT);
- combo.addModifyListener(
- new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- comboModified(e);
- }
- });
- }
-
- private void comboModified(ModifyEvent e) {
- if (isPopulating()) {
- return;
- }
-
- String text = ((CCombo) e.getSource()).getText();
- if (text.equals(combo.getItem(0))) {
- text = null;
- }
-
- entity.setSpecifiedName(text);
-
- // TODO Does this need to be done?
- //this.editingDomain.getCommandStack().execute(SetCommand.create(this.editingDomain, this.entity, MappingsPackage.eINSTANCE.getEntity_SpecifiedName(), text));
- }
-
- private void entityChanged(Notification notification) {
- switch (notification.getFeatureID(IEntity.class)) {
- case JpaCoreMappingsPackage.IENTITY__SPECIFIED_NAME :
- Display.getDefault().asyncExec(
- new Runnable() {
- public void run() {
- populate();
- }
- });
- break;
- case JpaCoreMappingsPackage.IENTITY__DEFAULT_NAME :
- Display.getDefault().asyncExec(
- new Runnable() {
- public void run() {
- populate();
- }
- });
- break;
- }
- }
-
- @Override
- protected void engageListeners() {
- if (entity != null) {
- entity.eAdapters().add(entityListener);
- }
- }
-
- @Override
- protected void disengageListeners() {
- if (entity != null) {
- entity.eAdapters().remove(entityListener);
- }
- }
-
- @Override
- public void doPopulate(EObject obj) {
- entity = (IEntity) obj;
- populateCombo();
- }
-
- @Override
- protected void doPopulate() {
- populateCombo();
- }
-
- private void populateCombo() {
- if (entity == null) {
- combo.clearSelection();
- combo.setItems(new String[] {});
- return;
- }
-
- String defaultItem = NLS.bind(JptUiMappingsMessages.EntityGeneralSection_nameDefaultWithOneParam, entity.getDefaultName());
- String specifiedName = entity.getSpecifiedName();
-
- if (specifiedName == null) {
- setComboData(defaultItem, new String[] {defaultItem});
- }
- else {
- setComboData(specifiedName, new String[] {defaultItem});
- }
- }
-
- private void setComboData(String text, String[] items) {
- if (! Arrays.equals(items, combo.getItems())) {
- combo.setItems(items);
- }
-
- if (! text.equals(combo.getText())) {
- combo.setText(text);
- }
- }
-
- public CCombo getCombo() {
- return combo;
- }
-
- @Override
- public Control getControl() {
- return getCombo();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EnumComboViewer.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EnumComboViewer.java
deleted file mode 100644
index 70f368bdab..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EnumComboViewer.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.mappings.details;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jface.viewers.IBaseLabelProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jpt.ui.internal.details.BaseJpaController;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.widgets.CComboViewer;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class EnumComboViewer extends BaseJpaController
-{
- private EnumHolder enumHolder;
- private Adapter enumListener;
-
- private CComboViewer comboViewer;
-
-
- public EnumComboViewer(Composite parent, CommandStack theCommandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, theCommandStack, widgetFactory);
- buildListener();
- }
-
-
- private void buildListener() {
- this.enumListener = new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- modelChanged(notification);
- }
- };
- }
-
- @Override
- protected void buildWidget(Composite parent) {
- CCombo combo = getWidgetFactory().createCCombo(parent);
- this.comboViewer = new CComboViewer(combo);
- this.comboViewer.setLabelProvider(buildLabelProvider());
- this.comboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- EnumComboViewer.this.selectionChanged(event.getSelection());
- }
- });
- }
- protected IBaseLabelProvider buildLabelProvider() {
- return new LabelProvider() {
- @Override
- public String getText(Object element) {
- if (element == enumHolder.defaultValue()) {
- return NLS.bind(JptUiMappingsMessages.EnumComboViewer_default, enumHolder.defaultString());
- }
- return super.getText(element);
- }
- };
- }
-
- void selectionChanged(ISelection sel) {
- if (sel instanceof IStructuredSelection) {
- Object selection = ((IStructuredSelection) sel).getFirstElement();
- if ( ! this.enumHolder.get().equals(selection)) {
- this.enumHolder.set(selection);
-// this.editingDomain.getCommandStack().execute(
-// SetCommand.create(
-// this.editingDomain,
-// this.basicMapping,
-// OrmPackage.eINSTANCE.getBasicMapping_Optional(),
-// optional
-// )
-// );
- }
- }
- }
-
- private void modelChanged(Notification notification) {
- if (notification.getFeatureID(this.enumHolder.featureClass()) ==
- this.enumHolder.featureId()) {
- Display.getDefault().asyncExec(
- new Runnable() {
- public void run() {
- populate();
- }
- });
- }
- }
-
- @Override
- protected void engageListeners() {
- if (this.enumHolder != null && this.enumHolder.wrappedObject() != null) {
- this.enumHolder.wrappedObject().eAdapters().add(this.enumListener);
- }
- }
-
- @Override
- protected void disengageListeners() {
- if (this.enumHolder != null && this.enumHolder.wrappedObject() != null) {
- this.enumHolder.wrappedObject().eAdapters().remove(this.enumListener);
- }
- }
-
- public final void populate(EnumHolder enumHolder) {
- super.populate(enumHolder);
- }
-
- @Override
- public void doPopulate(EObject obj) {
- this.enumHolder = (EnumHolder) obj;
- populateCombo();
- }
-
- @Override
- protected void doPopulate() {
- populateCombo();
- }
-
- private void populateCombo() {
- this.comboViewer.getCombo().removeAll();
- if (this.enumHolder.wrappedObject() == null) {
- return;
- }
-
- this.comboViewer.add(this.enumHolder.enumValues());
-
- Object modelSetting = this.enumHolder.get();
-
- if (((IStructuredSelection) this.comboViewer.getSelection()).getFirstElement() != modelSetting) {
- this.comboViewer.setSelection(new StructuredSelection(modelSetting));
- }
- }
-
-
- @Override
- public Control getControl() {
- return this.comboViewer.getCombo();
- }
-
-
- /**
- * An interface to wrap an object that supports accessType
- * An object of this type must be passed in to populate(EObject)
- */
- public static interface EnumHolder extends EObject {
- /**
- * Return the num setting from the wrapped object
- * @return
- */
- Object get();
-
- /**
- * Set the enum setting on the wrapped object
- * @param fetch
- */
- void set(Object enumSetting);
-
- /**
- * Return the Class of the wrapped object
- * @return
- */
- Class featureClass();
-
- /**
- * Return the feature id of enum setting on the wrapped object
- * @return
- */
- int featureId();
-
- /**
- * The wrapped EObject that the enum setting is stored on
- * @return
- */
- EObject wrappedObject();
-
- Object[] enumValues();
-
- /**
- * Return the Default Enumerator object
- */
- Object defaultValue();
-
- /**
- * Return the String to be displayed to the user
- * Deafult ([defaultString()])
- */
- String defaultString();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/GeneratedValueComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/GeneratedValueComposite.java
deleted file mode 100644
index b010a89033..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/GeneratedValueComposite.java
+++ /dev/null
@@ -1,287 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.mappings.details;
-
-import java.util.Iterator;
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jface.viewers.IBaseLabelProvider;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jpt.core.internal.mappings.GenerationType;
-import org.eclipse.jpt.core.internal.mappings.IGeneratedValue;
-import org.eclipse.jpt.core.internal.mappings.IId;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.core.internal.platform.IGeneratorRepository;
-import org.eclipse.jpt.core.internal.platform.NullGeneratorRepository;
-import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.details.BaseJpaComposite;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.widgets.CComboViewer;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.help.IWorkbenchHelpSystem;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class GeneratedValueComposite extends BaseJpaComposite
-{
- private IId id;
- private IGeneratedValue generatedValue;
- private Adapter generatedValueListener;
-
- private CComboViewer strategyComboViewer;
-
- private CCombo generatorNameCombo;
-
- protected boolean populating;
-
- public GeneratedValueComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, SWT.NULL, commandStack, widgetFactory);
- this.generatedValueListener = buildGeneratedValueListener();
- }
-
- private Adapter buildGeneratedValueListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- generatedValueChanged(notification);
- }
- };
- }
-
- @Override
- protected void initializeLayout(Composite composite) {
- GridLayout layout = new GridLayout(2, false);
- composite.setLayout(layout);
-
- IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
-
- getWidgetFactory().createLabel(composite, JptUiMappingsMessages.GeneratedValueComposite_strategy);
-
- this.strategyComboViewer = buildStrategyComboViewer(composite);
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- this.strategyComboViewer.getCombo().setLayoutData(gridData);
- helpSystem.setHelp(this.strategyComboViewer.getCombo(), IJpaHelpContextIds.MAPPING_GENERATED_VALUE_STRATEGY);
-
- getWidgetFactory().createLabel(composite, JptUiMappingsMessages.GeneratedValueComposite_generatorName);
-
- this.generatorNameCombo = buildGeneratorNameCombo(composite);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- this.generatorNameCombo.setLayoutData(gridData);
- helpSystem.setHelp(this.generatorNameCombo, IJpaHelpContextIds.MAPPING_GENERATED_VALUE_GENERATOR_NAME);
-
- // TODO
- // buildGeneratorNameSelectionButton( this);
- }
-
- private CComboViewer buildStrategyComboViewer(Composite parent) {
- CCombo combo = getWidgetFactory().createCCombo(parent);
- CComboViewer viewer = new CComboViewer(combo);
- viewer.setLabelProvider(buildStrategyLabelProvider());
- viewer.add(GenerationType.VALUES.toArray());
- viewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- if (populating) {
- return;
- }
- if (event.getSelection() instanceof StructuredSelection) {
- StructuredSelection selection = (StructuredSelection) event.getSelection();
- GenerationType selectedType = (GenerationType) selection.getFirstElement();
- if (generatedValue == null) {
- createGeneratedValue();
- }
- if (!generatedValue.getStrategy().equals(selectedType)) {
- generatedValue.setStrategy(selectedType);
- }
- }
- }
- });
- return viewer;
- }
-
- private IBaseLabelProvider buildStrategyLabelProvider() {
- return new LabelProvider() {
- @Override
- public String getText(Object element) {
- if (element == GenerationType.DEFAULT) {
- //TODO need to move this to the model, don't want hardcoded String
- return NLS.bind(JptUiMappingsMessages.GeneratedValueComposite_default, "Auto");
- }
- return super.getText(element);
- }
- };
- }
-
-
- protected CCombo buildGeneratorNameCombo(Composite parent) {
- CCombo combo = getWidgetFactory().createCCombo(parent, SWT.FLAT);
- combo.add(JptUiMappingsMessages.TableComposite_defaultEmpty);
- combo.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- if (isPopulating()) {
- return;
- }
- String generatorName = ((CCombo) e.getSource()).getText();
-
- if (generatorName.equals("")) { //$NON-NLS-1$
- if (generatedValue.getGenerator() == null || generatedValue.getGenerator().equals("")) {
- return;
- }
- generatorName = null;
- }
- if (generatedValue == null) {
- createGeneratedValue();
- }
- generatedValue.setGenerator(generatorName);
- }
- });
- return combo;
- }
-
- private void createGeneratedValue() {
- this.generatedValue = this.id.createGeneratedValue();
- this.id.setGeneratedValue(this.generatedValue);
- }
-
-
- protected void generatedValueChanged(Notification notification) {
- if (notification.getFeatureID(IGeneratedValue.class) == JpaCoreMappingsPackage.IGENERATED_VALUE__STRATEGY) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- if (selectedStrategy() != generatedValue.getStrategy()) {
- strategyComboViewer.setSelection(new StructuredSelection(generatedValue.getStrategy()));
- }
- }
- });
- }
- else if (notification.getFeatureID(IGeneratedValue.class) == JpaCoreMappingsPackage.IGENERATED_VALUE__GENERATOR) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- populateGeneratorName();
- }
- });
- }
- }
-
- @Override
- protected void doPopulate(EObject obj) {
- this.id = (IId) obj;
- if (this.id == null) {
- this.generatedValue= null;
- }
- else {
- this.generatedValue = this.id.getGeneratedValue();
- }
- if (this.generatedValue == null) {
- this.strategyComboViewer.getCombo().setText("");
- this.generatorNameCombo.setText("");
- this.populating = false;
- return;
- }
- populateStrategyCombo();
- populateGeneratorNameCombo();
- }
-
- @Override
- protected void doPopulate() {
-
- }
-
- protected void engageListeners() {
- if (this.generatedValue != null) {
- this.generatedValue.eAdapters().add(this.generatedValueListener);
- }
- }
-
- protected void disengageListeners() {
- if (this.generatedValue != null) {
- this.generatedValue.eAdapters().remove(this.generatedValueListener);
- }
- }
-
- private IGeneratorRepository getGeneratorRepository() {
- return NullGeneratorRepository.instance(); //this.id.getJpaProject().getPlatform().generatorRepository(this.id.typeMapping().getPersistentType());
- }
-
- private void populateGeneratorNameCombo() {
- this.generatorNameCombo.removeAll();
- for (Iterator<String> i = getGeneratorRepository().generatorNames(); i.hasNext(); ){
- this.generatorNameCombo.add(i.next());
- }
-
- populateGeneratorName();
- }
- private void populateGeneratorName() {
- String generatorName = this.generatedValue.getGenerator();
- if (generatorName == null || generatorName.equals("")) {
- this.generatorNameCombo.setText("");
- }
- else if (!this.generatorNameCombo.getText().equals(generatorName)) {
- this.generatorNameCombo.setText(generatorName);
- }
- }
-
- private void populateStrategyCombo() {
- GenerationType selectedType = selectedStrategy();
- GenerationType strategy = this.generatedValue.getStrategy();
- if (strategy == GenerationType.AUTO) {
- if (selectedType != GenerationType.AUTO) {
- this.strategyComboViewer.setSelection(new StructuredSelection(GenerationType.AUTO));
- }
- }
- else if (strategy == GenerationType.SEQUENCE) {
- if (selectedType != GenerationType.SEQUENCE) {
- this.strategyComboViewer.setSelection(new StructuredSelection(GenerationType.SEQUENCE));
- }
- }
- else if (strategy == GenerationType.IDENTITY) {
- if (selectedType != GenerationType.IDENTITY) {
- this.strategyComboViewer.setSelection(new StructuredSelection(GenerationType.IDENTITY));
- }
- }
- else if (strategy == GenerationType.TABLE) {
- if (selectedType != GenerationType.TABLE) {
- this.strategyComboViewer.setSelection(new StructuredSelection(GenerationType.TABLE));
- }
- }
- else {
- if (selectedType != GenerationType.DEFAULT) {
- this.strategyComboViewer.setSelection(new StructuredSelection(GenerationType.DEFAULT));
- }
- }
- // TODO first initialization
- }
-
- private GenerationType selectedStrategy() {
- return (GenerationType) ((StructuredSelection) this.strategyComboViewer.getSelection()).getFirstElement();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/GeneratorComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/GeneratorComposite.java
deleted file mode 100644
index a9f0227daf..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/GeneratorComposite.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.mappings.details;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.mappings.IGenerator;
-import org.eclipse.jpt.core.internal.mappings.IId;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.ui.internal.details.BaseJpaComposite;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-/**
- * GeneratorComposite
- */
-public abstract class GeneratorComposite<E extends IGenerator> extends BaseJpaComposite
-{
- private IId id;
- private E generator;
- private Adapter generatorListener;
-
- protected Text nameTextWidget;
-
- public GeneratorComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, SWT.NULL, commandStack, widgetFactory);
- this.generatorListener = buildGeneratorListner();
- }
-
- private Adapter buildGeneratorListner() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- generatorChanged(notification);
- }
- };
- }
-
- /**
- * Builds the Generator specifiedName viewer.
- *
- * @param parent
- * @return
- */
- protected Text buildNameText(Composite parent) {
- final Text text = getWidgetFactory().createText(parent, null);
- text.addModifyListener(new ModifyListener() {
- public void modifyText(org.eclipse.swt.events.ModifyEvent e) {
- if (isPopulating()) {
- return;
- }
-
- String name = text.getText();
- if (name.equals("")) { //$NON-NLS-1$
- if (getGenerator().getName() == null) {
- return;
- }
- name = null;
- }
- IGenerator generator = getGenerator();
- if (generator == null) {
- generator = createGenerator();
- }
- generator.setName(name);
- }
- });
- return text;
- }
-
- protected abstract E createGenerator();
-
- @Override
- protected void doPopulate(EObject obj) {
- this.id = (IId) obj;
- if (this.id == null) {
- this.generator = null;
- return;
- }
- this.generator = generator(this.id);
- if (this.generator == null) {
- clear();
- return;
- }
- populateNameViewer();
- return;
- }
-
- @Override
- protected void doPopulate() {
- populateNameViewer();
- }
-
- protected void engageListeners() {
- if (this.generator != null) {
- this.generator.eAdapters().add(this.generatorListener);
- }
- }
-
- protected void disengageListeners() {
- if (this.generator != null) {
- this.generator.eAdapters().remove(this.generatorListener);
- }
- }
-
- protected abstract E generator(IId id);
-
- protected IId idMapping() {
- return this.id;
- }
-
- protected void generatorChanged(Notification notification) {
- if (notification.getFeatureID(IGenerator.class) == JpaCoreMappingsPackage.IGENERATOR__NAME) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- if (nameTextWidget.getText() == null || !nameTextWidget.getText().equals(getGenerator().getName())) {
- if (getGenerator().getName() == null) {
- clearNameViewer();
- }
- else {
- nameTextWidget.setText(getGenerator().getName());
- }
- }
- }
- });
- }
- }
-
- private void populateNameViewer() {
- String name = this.getGenerator().getName();
- if (name != null) {
- if (!this.nameTextWidget.getText().equals(name)) {
- this.nameTextWidget.setText(name);
- }
- }
- else {
- this.clearNameViewer();
- }
- }
-
- protected E getGenerator() {
- return this.generator;
- }
-
- protected void clear() {
- this.clearNameViewer();
- }
-
- protected void clearNameViewer() {
- this.nameTextWidget.setText(""); //$NON-NLS-1$
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/IdComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/IdComposite.java
deleted file mode 100644
index b71d4cfffe..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/IdComposite.java
+++ /dev/null
@@ -1,459 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.mappings.details;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.impl.EObjectImpl;
-import org.eclipse.jpt.core.internal.mappings.IGeneratedValue;
-import org.eclipse.jpt.core.internal.mappings.IId;
-import org.eclipse.jpt.core.internal.mappings.ISequenceGenerator;
-import org.eclipse.jpt.core.internal.mappings.ITableGenerator;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.core.internal.mappings.TemporalType;
-import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.details.BaseJpaComposite;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.mappings.details.EnumComboViewer.EnumHolder;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-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.ui.PlatformUI;
-import org.eclipse.ui.forms.widgets.ExpandableComposite;
-import org.eclipse.ui.forms.widgets.Section;
-import org.eclipse.ui.help.IWorkbenchHelpSystem;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class IdComposite extends BaseJpaComposite
-{
- private IId id;
- private Adapter idListener;
-
- private ColumnComposite columnComposite;
-
- private EnumComboViewer temporalTypeViewer;
-
- private Section pkGenerationSection;
- private Button primaryKeyGenerationCheckBox;
- private GeneratedValueComposite generatedValueComposite;
-
- private Section tableGenSection;
- private Button tableGeneratorCheckBox;
- private TableGeneratorComposite tableGeneratorComposite;
-
- private Section sequenceGenSection;
- private Button sequenceGeneratorCheckBox;
- private SequenceGeneratorComposite sequenceGeneratorComposite;
-
-
- public IdComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, SWT.NULL, commandStack, widgetFactory);
- this.idListener = buildIdListener();
- }
-
- private Adapter buildIdListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- idMappingChanged(notification);
- }
- };
- }
- void idMappingChanged(Notification notification) {
- switch (notification.getFeatureID(IId.class)) {
- case JpaCoreMappingsPackage.IID__TABLE_GENERATOR :
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- IdComposite.this.populateTableGeneratorComposite();
- }
- });
- break;
- case JpaCoreMappingsPackage.IID__SEQUENCE_GENERATOR :
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- IdComposite.this.populateSequenceGeneratorComposite();
- }
- });
- break;
- case JpaCoreMappingsPackage.IID__GENERATED_VALUE :
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- IdComposite.this.populateGeneratedValueComposite();
- }
- });
- break;
- }
- }
-
- @Override
- protected void initializeLayout(Composite composite) {
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- composite.setLayout(layout);
-
- Control generalControl = buildGeneralComposite(composite);
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- generalControl.setLayoutData(gridData);
-
- Control generationControl = buildGenerationComposite(composite);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- generationControl.setLayoutData(gridData);
- }
-
- private Control buildGeneralComposite(Composite composite) {
- Composite generalComposite = getWidgetFactory().createComposite(composite);
- GridLayout layout = new GridLayout(2, false);
- layout.marginWidth = 0;
- generalComposite.setLayout(layout);
-
- this.columnComposite = new ColumnComposite(generalComposite, this.commandStack, getWidgetFactory());
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.horizontalSpan = 2;
- this.columnComposite.getControl().setLayoutData(gridData);
-
- CommonWidgets.buildTemporalLabel(generalComposite, getWidgetFactory());
- this.temporalTypeViewer = CommonWidgets.buildEnumComboViewer(generalComposite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.temporalTypeViewer.getControl().setLayoutData(gridData);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(temporalTypeViewer.getControl(), IJpaHelpContextIds.MAPPING_TEMPORAL);
-
- return generalComposite;
- }
-
- private Control buildGenerationComposite(Composite composite) {
- IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
-
- this.pkGenerationSection = getWidgetFactory().createSection(composite, SWT.FLAT | ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR);
- this.pkGenerationSection.setText(JptUiMappingsMessages.IdMappingComposite_primaryKeyGeneration);
-
- Composite generationClient = getWidgetFactory().createComposite(this.pkGenerationSection);
- this.pkGenerationSection.setClient(generationClient);
-
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- generationClient.setLayout(layout);
-
- this.primaryKeyGenerationCheckBox = buildPrimaryKeyGenerationCheckBox(generationClient);
- GridData gridData = new GridData();
- this.primaryKeyGenerationCheckBox.setLayoutData(gridData);
- helpSystem.setHelp(primaryKeyGenerationCheckBox, IJpaHelpContextIds.MAPPING_PRIMARY_KEY_GENERATION);
-
- this.generatedValueComposite = new GeneratedValueComposite(generationClient, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.horizontalIndent = 20;
- this.generatedValueComposite.getControl().setLayoutData(gridData);
-
- this.tableGenSection = getWidgetFactory().createSection(generationClient, SWT.FLAT | ExpandableComposite.TWISTIE);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- this.tableGenSection.setLayoutData(gridData);
-
- this.tableGenSection.setText(JptUiMappingsMessages.IdMappingComposite_tableGenerator);
-
- Composite tableGenClient = getWidgetFactory().createComposite(this.tableGenSection);
- this.tableGenSection.setClient(tableGenClient);
-
- layout = new GridLayout();
- layout.marginWidth = 0;
- tableGenClient.setLayout(layout);
-
- this.tableGeneratorCheckBox = buildTableGeneratorCheckBox(tableGenClient);
- gridData = new GridData();
- this.tableGeneratorCheckBox.setLayoutData(gridData);
- helpSystem.setHelp(tableGeneratorCheckBox, IJpaHelpContextIds.MAPPING_TABLE_GENERATOR);
-
- this.tableGeneratorComposite = new TableGeneratorComposite(tableGenClient, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.horizontalIndent = 20;
- this.tableGeneratorComposite.getControl().setLayoutData(gridData);
-
-
-
- this.sequenceGenSection = getWidgetFactory().createSection(generationClient, SWT.FLAT | ExpandableComposite.TWISTIE);
- this.sequenceGenSection.setText(JptUiMappingsMessages.IdMappingComposite_sequenceGenerator);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- this.sequenceGenSection.setLayoutData(gridData);
-
- Composite sequenceGenClient = getWidgetFactory().createComposite(this.sequenceGenSection);
- this.sequenceGenSection.setClient(sequenceGenClient);
-
- layout = new GridLayout();
- layout.marginWidth = 0;
- sequenceGenClient.setLayout(layout);
-
- this.sequenceGeneratorCheckBox = buildSequenceGeneratorCheckBox(sequenceGenClient);
- gridData = new GridData();
- this.sequenceGeneratorCheckBox.setLayoutData(gridData);
- helpSystem.setHelp(sequenceGeneratorCheckBox, IJpaHelpContextIds.MAPPING_SEQUENCE_GENERATOR);
-
- this.sequenceGeneratorComposite = new SequenceGeneratorComposite(sequenceGenClient, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.horizontalIndent = 20;
- this.sequenceGeneratorComposite.getControl().setLayoutData(gridData);
-
- return this.pkGenerationSection;
- }
-
- private Button buildPrimaryKeyGenerationCheckBox(Composite parent) {
- Button button = getWidgetFactory().createButton(parent,JptUiMappingsMessages.IdMappingComposite_primaryKeyGeneration, SWT.CHECK);
- button.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- // ignore
- }
-
- public void widgetSelected(SelectionEvent e) {
- IdComposite.this.primaryKeyGenerationCheckBoxClicked(e);
- }
- });
- return button;
- }
-
- void primaryKeyGenerationCheckBoxClicked(SelectionEvent e) {
- boolean mappingHasGeneratedValue = this.id.getGeneratedValue() != null;
- boolean checked = this.primaryKeyGenerationCheckBox.getSelection();
- if (checked == mappingHasGeneratedValue) {
- return;
- }
- IGeneratedValue generatedValue = null;
- if (checked) {
- generatedValue = this.id.createGeneratedValue();
- }
- this.id.setGeneratedValue(generatedValue);
- }
-
- private Button buildTableGeneratorCheckBox(Composite parent) {
- Button button = getWidgetFactory().createButton(parent,JptUiMappingsMessages.IdMappingComposite_tableGenerator, SWT.CHECK);
- button.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- // ignore
- }
-
- public void widgetSelected(SelectionEvent e) {
- IdComposite.this.tableGeneratorCheckBoxClicked(e);
- }
- });
- return button;
- }
-
- void tableGeneratorCheckBoxClicked(SelectionEvent e) {
- boolean mappingHasTableGenerator = this.id.getTableGenerator() != null;
- boolean checked = this.tableGeneratorCheckBox.getSelection();
- if (checked == mappingHasTableGenerator) {
- return;
- }
- ITableGenerator tableGenerator = null;
- if (checked) {
- tableGenerator = this.id.createTableGenerator();
- }
- this.id.setTableGenerator(tableGenerator);
- if (checked) {
- IGeneratedValue generatedValue = this.id.getGeneratedValue();
- if (generatedValue != null && generatedValue.getGenerator() != null) {
- tableGenerator.setName(generatedValue.getGenerator());
- }
- }
- }
-
- private Button buildSequenceGeneratorCheckBox(Composite parent) {
- Button button = getWidgetFactory().createButton(parent,JptUiMappingsMessages.IdMappingComposite_sequenceGenerator, SWT.CHECK);
- button.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- // ignore
- }
-
- public void widgetSelected(SelectionEvent e) {
- IdComposite.this.sequenceGeneratorCheckBoxClicked(e);
- }
- });
- return button;
- }
-
- void sequenceGeneratorCheckBoxClicked(SelectionEvent e) {
- boolean mappingHasSequenceGenerator = this.id.getSequenceGenerator() != null;
- boolean checked = this.sequenceGeneratorCheckBox.getSelection();
- if (checked == mappingHasSequenceGenerator) {
- return;
- }
- ISequenceGenerator sequenceGenerator = null;
- if (checked) {
- sequenceGenerator = this.id.createSequenceGenerator();
- }
- this.id.setSequenceGenerator(sequenceGenerator);
- if (checked) {
- IGeneratedValue generatedValue = this.id.getGeneratedValue();
- if (generatedValue != null && generatedValue.getGenerator() != null) {
- sequenceGenerator.setName(generatedValue.getGenerator());
- }
- }
- }
-
-
-
- public void doPopulate(EObject obj) {
- this.id = (IId) obj;
- if (this.id != null) {
- this.columnComposite.populate(this.id.getColumn());
- }
- else {
- this.columnComposite.populate(null);
- this.generatedValueComposite.populate(null);
- this.tableGeneratorComposite.populate(null);
- this.sequenceGeneratorComposite.populate(null);
- return;
- }
- this.pkGenerationSection.setExpanded(true);
- this.temporalTypeViewer.populate(new TemporalTypeHolder(this.id));
- populateGeneratedValueComposite();
- populateSequenceGeneratorComposite();
- populateTableGeneratorComposite();
- }
-
- public void doPopulate() {
- this.columnComposite.populate();
- this.temporalTypeViewer.populate();
- this.generatedValueComposite.populate();
- this.tableGeneratorComposite.populate();
- this.sequenceGeneratorComposite.populate();
- }
-
- private void populateTableGeneratorComposite() {
- this.tableGeneratorComposite.populate(this.id);
- boolean tableGeneratorExists = this.id.getTableGenerator() != null;
- this.tableGeneratorCheckBox.setSelection(tableGeneratorExists);
- if (tableGeneratorExists) {
- this.tableGenSection.setExpanded(true);
- }
- }
-
- private void populateSequenceGeneratorComposite() {
- this.sequenceGeneratorComposite.populate(this.id);
- boolean sequenceGeneratorExists = this.id.getSequenceGenerator() != null;
- this.sequenceGeneratorCheckBox.setSelection(sequenceGeneratorExists);
- if (sequenceGeneratorExists) {
- this.sequenceGenSection.setExpanded(true);
- }
- }
-
- private void populateGeneratedValueComposite() {
- this.generatedValueComposite.populate(this.id);
- this.primaryKeyGenerationCheckBox.setSelection(this.id.getGeneratedValue() != null);
- }
-
-
- protected void engageListeners() {
- if (this.id !=null) {
- this.id.eAdapters().add(this.idListener);
- }
- }
-
- protected void disengageListeners() {
- if (this.id !=null) {
- this.id.eAdapters().remove(this.idListener);
- }
- }
-
- @Override
- public void dispose() {
- this.columnComposite.dispose();
- this.temporalTypeViewer.dispose();
- this.generatedValueComposite.dispose();
- this.tableGeneratorComposite.dispose();
- this.sequenceGeneratorComposite.dispose();
- super.dispose();
- }
-
- protected IId getId() {
- return this.id;
- }
-
- private class TemporalTypeHolder extends EObjectImpl implements EnumHolder {
-
- private IId id;
-
- TemporalTypeHolder(IId id) {
- super();
- this.id = id;
- }
-
- public Object get() {
- return this.id.getTemporal();
- }
-
- public void set(Object enumSetting) {
- this.id.setTemporal((TemporalType) enumSetting);
- }
-
- public Class featureClass() {
- return IId.class;
- }
-
- public int featureId() {
- return JpaCoreMappingsPackage.IID__TEMPORAL;
- }
-
- public EObject wrappedObject() {
- return this.id;
- }
-
- public Object[] enumValues() {
- return TemporalType.VALUES.toArray();
- }
-
- /**
- * TemporalType has no Default, return null
- */
- public Object defaultValue() {
- return null;
- }
-
- /**
- * TemporalType has no Default, return null
- */
- public String defaultString() {
- return null;
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/InheritanceComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/InheritanceComposite.java
deleted file mode 100644
index d0dc29203e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/InheritanceComposite.java
+++ /dev/null
@@ -1,620 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.mappings.details;
-
-import java.util.Iterator;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jface.viewers.IBaseLabelProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jpt.core.internal.mappings.DiscriminatorType;
-import org.eclipse.jpt.core.internal.mappings.IDiscriminatorColumn;
-import org.eclipse.jpt.core.internal.mappings.IEntity;
-import org.eclipse.jpt.core.internal.mappings.INamedColumn;
-import org.eclipse.jpt.core.internal.mappings.InheritanceType;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.db.internal.ConnectionListener;
-import org.eclipse.jpt.db.internal.ConnectionProfile;
-import org.eclipse.jpt.db.internal.Database;
-import org.eclipse.jpt.db.internal.Schema;
-import org.eclipse.jpt.db.internal.Table;
-import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.details.BaseJpaComposite;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.widgets.CComboViewer;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class InheritanceComposite extends BaseJpaComposite {
-
- private IEntity entity;
- private IDiscriminatorColumn discriminatorColumn;
- private final Adapter entityListener;
- private final Adapter discriminatorColumnListener;
-
- private CComboViewer strategyViewer;
- private CCombo columnCombo;
- private CComboViewer discriminatorTypeViewer;
- private CCombo discriminatorValueCombo;
-
- private ConnectionListener connectionListener;
-
- private ConnectionProfile connectionProfile;
-
-
- private PrimaryKeyJoinColumnsComposite pkJoinColumnsComposite;
-
- public InheritanceComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, SWT.NULL, commandStack, widgetFactory);
- this.entityListener = buildEntityListener();
- this.discriminatorColumnListener = buildDiscriminatorColumnListener();
- this.connectionListener = buildConnectionListener();
- }
-
- private Adapter buildEntityListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- entityChanged(notification);
- }
- };
- }
-
- private Adapter buildDiscriminatorColumnListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- discriminatorColumnChanged(notification);
- }
- };
- }
-
- private ConnectionListener buildConnectionListener() {
- return new ConnectionListener() {
-
- public void aboutToClose(ConnectionProfile profile) {
- // not interested to this event.
- }
-
- public void closed(ConnectionProfile profile) {
- getControl().getDisplay().asyncExec( new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- InheritanceComposite.this.populateColumnCombo();
- }
- });
- }
-
- public void modified(ConnectionProfile profile) {
- getControl().getDisplay().asyncExec( new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- InheritanceComposite.this.populateColumnCombo();
- }
- });
- }
-
- public boolean okToClose(ConnectionProfile profile) {
- // not interested to this event.
- return true;
- }
-
- public void opened(ConnectionProfile profile) {
- getControl().getDisplay().asyncExec( new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- InheritanceComposite.this.populateColumnCombo();
- }
- });
- }
-
- public void databaseChanged(ConnectionProfile profile, final Database database) {
- return;
- }
-
- public void schemaChanged(ConnectionProfile profile, final Schema schema) {
- return;
- }
-
- public void tableChanged(ConnectionProfile profile, final Table table) {
- getControl().getDisplay().asyncExec( new Runnable() {
- public void run() {
- if(table == getDbTable()) {
- if (!getControl().isDisposed()) {
- InheritanceComposite.this.populateColumnCombo();
- }
- }
- }
- });
- }
- };
- }
-
- @Override
- protected void initializeLayout(Composite composite) {
- GridLayout layout = new GridLayout(2, false);
- layout.marginWidth = 0;
- composite.setLayout(layout);
-
- GridData gridData;
-
- getWidgetFactory().createLabel(composite, JptUiMappingsMessages.InheritanceComposite_strategy);
-
- this.strategyViewer = buildStrategyCombo(composite);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- this.strategyViewer.getCombo().setLayoutData(gridData);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this.strategyViewer.getCombo(), IJpaHelpContextIds.ENTITY_INHERITANCE_STRATEGY);
-
- getWidgetFactory().createLabel(composite, JptUiMappingsMessages.DiscriminatorColumnComposite_column);
-
- this.columnCombo = buildColumnCombo(composite);
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- this.columnCombo.setLayoutData(gridData);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this.columnCombo, IJpaHelpContextIds.ENTITY_INHERITANCE_DISCRIMINATOR_COLUMN);
-
- getWidgetFactory().createLabel(composite, JptUiMappingsMessages.DiscriminatorColumnComposite_discriminatorType);
-
- this.discriminatorTypeViewer = buildDiscriminatorTypeCombo(composite);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- this.discriminatorTypeViewer.getCombo().setLayoutData(gridData);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this.discriminatorTypeViewer.getCombo(), IJpaHelpContextIds.ENTITY_INHERITANCE_DISCRIMINATOR_TYPE);
-
-
- getWidgetFactory().createLabel(composite, JptUiMappingsMessages.InheritanceComposite_discriminatorValue);
-
- this.discriminatorValueCombo = buildDiscriminatorValueCombo(composite);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- this.discriminatorValueCombo.setLayoutData(gridData);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this.discriminatorValueCombo, IJpaHelpContextIds.ENTITY_INHERITANCE_DISCRIMINATOR_VALUE);
-
- this.pkJoinColumnsComposite = new PrimaryKeyJoinColumnsComposite(composite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalSpan = 2;
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.verticalAlignment = GridData.FILL;
- gridData.grabExcessVerticalSpace = true;
- this.pkJoinColumnsComposite.getControl().setLayoutData(gridData);
- }
-
- private CComboViewer buildStrategyCombo(Composite parent) {
- CCombo combo = getWidgetFactory().createCCombo(parent);
- CComboViewer strategyViewer = new CComboViewer(combo);
- strategyViewer.setLabelProvider(buildStrategyLabelProvider());
- strategyViewer.add(InheritanceType.VALUES.toArray());
- strategyViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- InheritanceComposite.this.strategySelectionChanged(event.getSelection());
- }
- });
-
- return strategyViewer;
- }
-
- private IBaseLabelProvider buildStrategyLabelProvider() {
- return new LabelProvider() {
- @Override
- public String getText(Object element) {
- if (element == InheritanceType.DEFAULT) {
- //TODO need to move this to the model, don't want hardcoded String
- return NLS.bind(JptUiMappingsMessages.InheritanceComposite_default, "Single Table");
- }
- return super.getText(element);
- }
- };
- }
-
- void strategySelectionChanged(ISelection selection) {
- if (selection instanceof IStructuredSelection) {
- InheritanceType inheritanceType = (InheritanceType) ((IStructuredSelection) selection).getFirstElement();
- if ( ! this.entity.getInheritanceStrategy().equals(inheritanceType)) {
- this.entity.setInheritanceStrategy(inheritanceType);
- }
- }
- }
-
- private CCombo buildColumnCombo(Composite parent) {
- final CCombo combo = getWidgetFactory().createCCombo(parent, SWT.FLAT);
- combo.add(JptUiMappingsMessages.ColumnComposite_defaultEmpty);
- combo.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- if (isPopulating()) {
- return;
- }
- String tableText = ((CCombo) e.getSource()).getText();
- if (tableText.equals("")) { //$NON-NLS-1$
- tableText = null;
- if (discriminatorColumn.getSpecifiedName() == null || discriminatorColumn.getSpecifiedName().equals("")) { //$NON-NLS-1$
- return;
- }
- }
-
- if (tableText != null && combo.getItemCount() > 0 && tableText.equals(combo.getItem(0))) {
- tableText = null;
- }
-
- if (discriminatorColumn.getSpecifiedName() == null && tableText != null) {
- discriminatorColumn.setSpecifiedName(tableText);
- }
- if (discriminatorColumn.getSpecifiedName() != null && !discriminatorColumn.getSpecifiedName().equals(tableText)) {
- discriminatorColumn.setSpecifiedName(tableText);
- }
- }
- });
- return combo;
-
- }
-
- private CComboViewer buildDiscriminatorTypeCombo(Composite parent) {
- CCombo combo = getWidgetFactory().createCCombo(parent);
- CComboViewer discriminatorTypeViewer = new CComboViewer(combo);
- discriminatorTypeViewer.setLabelProvider(buildDiscriminatorTypeLabelProvider());
- discriminatorTypeViewer.add(DiscriminatorType.VALUES.toArray());
-
- discriminatorTypeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- InheritanceComposite.this.discriminatorTypeSelectionChanged(event.getSelection());
- }
- });
-
- return discriminatorTypeViewer;
- }
-
- private IBaseLabelProvider buildDiscriminatorTypeLabelProvider() {
- return new LabelProvider() {
- @Override
- public String getText(Object element) {
- if (element == DiscriminatorType.DEFAULT) {
- //TODO need to move this to the model, don't want hardcoded String
- return NLS.bind(JptUiMappingsMessages.InheritanceComposite_defaultDiscriminatorType, "String");
- }
- return super.getText(element);
- }
- };
- }
-
- void discriminatorTypeSelectionChanged(ISelection selection) {
- if (selection instanceof IStructuredSelection) {
- DiscriminatorType discriminatorType = (DiscriminatorType) ((IStructuredSelection) selection).getFirstElement();
- if ( ! this.discriminatorColumn.getDiscriminatorType().equals(discriminatorType)) {
- this.discriminatorColumn.setDiscriminatorType(discriminatorType);
- }
- }
- }
-
- private CCombo buildDiscriminatorValueCombo(Composite parent) {
- final CCombo combo = getWidgetFactory().createCCombo(parent, SWT.FLAT);
- combo.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- if (isPopulating()) {
- return;
- }
- String discriminatorValue = entity.getSpecifiedDiscriminatorValue();
- String value = ((CCombo) e.getSource()).getText();
- if (value.equals("")) { //$NON-NLS-1$
- value = null;
- if (discriminatorValue == null || discriminatorValue.equals("")) { //$NON-NLS-1$
- return;
- }
- }
-
- if (value != null && combo.getItemCount() > 0 && value.equals(combo.getItem(0))) {
- value = null;
- }
-
- if (discriminatorValue == null || !discriminatorValue.equals(value)) {
- entity.setSpecifiedDiscriminatorValue(value);
- }
- }
- });
- return combo;
- }
-
- public void doPopulate(EObject obj) {
- this.entity = (IEntity) obj;
- if (this.entity != null) {
- this.discriminatorColumn = this.entity.getDiscriminatorColumn();
- populateColumnCombo();
- popuplateDiscriminatorTypeComboViewer();
- populateStrategyComboViewer();
- populateDiscriminatorValueCombo();
- this.pkJoinColumnsComposite.populate(this.entity);
- }
- else {
- this.discriminatorColumn = null;
- this.connectionProfile = null;
- }
- }
-
- public void doPopulate() {
- if (this.entity != null) {
- populateColumnCombo();
-// popuplateStrategyComboViewer();
-// popuplateDiscriminatorValueCombo();
- }
- }
-
- @Override
- protected void engageListeners() {
- if (this.entity != null) {
- this.entity.eAdapters().add(this.entityListener);
- this.discriminatorColumn.eAdapters().add(this.discriminatorColumnListener);
- this.addConnectionListener();
- }
- }
-
- @Override
- protected void disengageListeners() {
- if (this.entity != null) {
- this.entity.eAdapters().remove(this.entityListener);
- this.removeConnectionListener();
- this.discriminatorColumn.eAdapters().remove(this.discriminatorColumnListener);
- }
- }
-
- private ConnectionProfile getConnectionProfile() {
- if(this.connectionProfile == null) {
- this.connectionProfile = this.entity.getJpaProject().connectionProfile();
- }
- return this.connectionProfile;
- }
-
- private void addConnectionListener() {
- this.getConnectionProfile().addConnectionListener(this.connectionListener);
- }
-
- private void removeConnectionListener() {
- this.getConnectionProfile().removeConnectionListener(this.connectionListener);
- }
-
- private Table getDbTable() {
- return this.entity.primaryDbTable();
- }
-
- private void populateColumnCombo() {
- //TODO don't do instanceof check here - check on Table, or isRoot check on Entity
- //this.tableCombo.setEnabled(!(this.table instanceof SingleTableInheritanceChildTableImpl));
- populateDefaultColumnName();
-
- if (this.getConnectionProfile().isConnected()) {
- this.columnCombo.remove(1, this.columnCombo.getItemCount()-1);
- Table table = getDbTable();
- if (table != null) {
- for (Iterator i = CollectionTools.sort(CollectionTools.list(table.columnNames())).iterator(); i.hasNext();) {
- this.columnCombo.add((String) i.next());
- }
- }
- }
- else {
- this.columnCombo.remove(1, this.columnCombo.getItemCount()-1);
- }
- populateColumnName();
- }
-
- protected void populateDefaultColumnName() {
- String defaultTableName = discriminatorColumn.getDefaultName();
- int selectionIndex = columnCombo.getSelectionIndex();
- columnCombo.setItem(0, NLS.bind(JptUiMappingsMessages.ColumnComposite_defaultWithOneParam, defaultTableName));
- if (selectionIndex == 0) {
- //combo text does not update when switching between 2 mappings of the same type
- //that both have a default column name. clear the selection and then set it again
- columnCombo.clearSelection();
- columnCombo.select(0);
- }
- }
-
- protected void populateColumnName() {
- String tableName = this.discriminatorColumn.getSpecifiedName();
- String defaultName = this.discriminatorColumn.getDefaultName();
- if (tableName != null) {
- if (!this.columnCombo.getText().equals(tableName)) {
- this.columnCombo.setText(tableName);
- }
- }
- else {
- if (!this.columnCombo.getText().equals(NLS.bind(JptUiMappingsMessages.ColumnComposite_defaultWithOneParam, defaultName))) {
- this.columnCombo.select(0);
- }
- }
- }
-
- private void popuplateDiscriminatorTypeComboViewer() {
- if (this.discriminatorColumn.getDiscriminatorType() == DiscriminatorType.DEFAULT) {
- if (((StructuredSelection) this.discriminatorTypeViewer.getSelection()).getFirstElement() != DiscriminatorType.DEFAULT) {
- this.discriminatorTypeViewer.setSelection(new StructuredSelection(DiscriminatorType.DEFAULT));
- }
- }
- else if (this.discriminatorColumn.getDiscriminatorType() == DiscriminatorType.CHAR) {
- if (((StructuredSelection) this.discriminatorTypeViewer.getSelection()).getFirstElement() != DiscriminatorType.CHAR) {
- this.discriminatorTypeViewer.setSelection(new StructuredSelection(DiscriminatorType.CHAR));
- }
- }
- else if (this.discriminatorColumn.getDiscriminatorType() == DiscriminatorType.INTEGER) {
- if (((StructuredSelection) this.discriminatorTypeViewer.getSelection()).getFirstElement() != DiscriminatorType.INTEGER) {
- this.discriminatorTypeViewer.setSelection(new StructuredSelection(DiscriminatorType.INTEGER));
- }
- }
- else {
- if (((StructuredSelection) this.discriminatorTypeViewer.getSelection()).getFirstElement() != DiscriminatorType.STRING) {
- this.discriminatorTypeViewer.setSelection(new StructuredSelection(DiscriminatorType.STRING));
- }
- }
- }
-
- private void populateStrategyComboViewer() {
- if (this.entity.getInheritanceStrategy() == InheritanceType.DEFAULT) {
- if (((StructuredSelection) this.strategyViewer.getSelection()).getFirstElement() != InheritanceType.DEFAULT) {
- this.strategyViewer.setSelection(new StructuredSelection(InheritanceType.DEFAULT));
- }
- }
- else if (this.entity.getInheritanceStrategy() == InheritanceType.JOINED) {
- if (((StructuredSelection) this.strategyViewer.getSelection()).getFirstElement() != InheritanceType.JOINED) {
- this.strategyViewer.setSelection(new StructuredSelection(InheritanceType.JOINED));
- }
- }
- else if (this.entity.getInheritanceStrategy() == InheritanceType.SINGLE_TABLE) {
- if (((StructuredSelection) this.strategyViewer.getSelection()).getFirstElement() != InheritanceType.SINGLE_TABLE) {
- this.strategyViewer.setSelection(new StructuredSelection(InheritanceType.SINGLE_TABLE));
- }
- }
- else {
- if (((StructuredSelection) this.strategyViewer.getSelection()).getFirstElement() != InheritanceType.TABLE_PER_CLASS) {
- this.strategyViewer.setSelection(new StructuredSelection(InheritanceType.TABLE_PER_CLASS));
- }
- }
- }
-
- private void populateDiscriminatorValueCombo() {
- String specifiedValue = this.entity.getSpecifiedDiscriminatorValue();
- String defaultValue = this.entity.getDefaultDiscriminatorValue();
-
- if (this.entity.discriminatorValueIsAllowed()) {
- this.discriminatorValueCombo.setEnabled(true);
- if (this.discriminatorValueCombo.getItemCount() == 0) {
- this.discriminatorValueCombo.add(JptUiMappingsMessages.DiscriminatorColumnComposite_defaultEmpty);
- }
- if (defaultValue != null) {
- this.discriminatorValueCombo.setItem(0, NLS.bind(JptUiMappingsMessages.ColumnComposite_defaultWithOneParam, defaultValue));
- }
- else {
- this.discriminatorValueCombo.setItem(0, JptUiMappingsMessages.DiscriminatorColumnComposite_defaultEmpty);
- }
- }
- else {
- this.discriminatorValueCombo.setEnabled(false);
- if (this.discriminatorValueCombo.getItemCount() == 1) {
- this.discriminatorValueCombo.setText("");
- this.discriminatorValueCombo.removeAll();
- }
- }
-
- if (specifiedValue != null) {
- if (!this.discriminatorValueCombo.getText().equals(specifiedValue)) {
- this.discriminatorValueCombo.setText(specifiedValue);
- }
- }
- else {
- //combo text does not update when switching between 2 entities that both have a default discriminator value.
- //clear the selection and then set it again
- this.discriminatorValueCombo.clearSelection();
- this.discriminatorValueCombo.select(0);
- }
- }
-
- private void entityChanged(Notification notification) {
- if (notification.getFeatureID(IEntity.class) == JpaCoreMappingsPackage.IENTITY__INHERITANCE_STRATEGY) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- InheritanceType inheritanceType = entity.getInheritanceStrategy();
- if (((StructuredSelection) strategyViewer.getSelection()).getFirstElement() != inheritanceType) {
- strategyViewer.setSelection(new StructuredSelection(inheritanceType));
- }
- }
- });
- }
- else if (notification.getFeatureID(IEntity.class) == JpaCoreMappingsPackage.IENTITY__SPECIFIED_DISCRIMINATOR_VALUE) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- String discriminatorValue = entity.getSpecifiedDiscriminatorValue();
- if (discriminatorValueCombo.getText() == null || !discriminatorValueCombo.getText().equals(discriminatorValue)) {
- if (discriminatorValue == null) {
- discriminatorValueCombo.select(0);
- }
- else {
- discriminatorValueCombo.setText(discriminatorValue);
- }
- }
- }
- });
- }
- else if (notification.getFeatureID(IEntity.class) == JpaCoreMappingsPackage.IENTITY__DEFAULT_DISCRIMINATOR_VALUE) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- populateDiscriminatorValueCombo();
- }
- });
- }
- }
-
- protected void discriminatorColumnChanged(Notification notification) {
- if (notification.getFeatureID(INamedColumn.class) == JpaCoreMappingsPackage.INAMED_COLUMN__SPECIFIED_NAME) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- populateColumnName();
- }
- });
- }
- else if (notification.getFeatureID(INamedColumn.class) == JpaCoreMappingsPackage.INAMED_COLUMN__DEFAULT_NAME) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- populateDefaultColumnName();
- }
- });
- }
-
- else if (notification.getFeatureID(IDiscriminatorColumn.class) == JpaCoreMappingsPackage.IDISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- DiscriminatorType discriminatorType = discriminatorColumn.getDiscriminatorType();
- if (((StructuredSelection) discriminatorTypeViewer.getSelection()).getFirstElement() != discriminatorType) {
- discriminatorTypeViewer.setSelection(new StructuredSelection(discriminatorType));
- }
- }
- });
- }
- }
-
- public void dispose() {
- this.pkJoinColumnsComposite.dispose();
- super.dispose();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/InverseJoinColumnDialog.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/InverseJoinColumnDialog.java
deleted file mode 100644
index 4d45d3732b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/InverseJoinColumnDialog.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.mappings.details;
-
-import java.util.Iterator;
-import org.eclipse.jpt.core.internal.mappings.IEntity;
-import org.eclipse.jpt.core.internal.mappings.IJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.IJoinTable;
-import org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping;
-import org.eclipse.jpt.db.internal.Table;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Shell;
-
-public class InverseJoinColumnDialog extends JoinColumnInJoinTableDialog {
-
- InverseJoinColumnDialog(Shell parent, IJoinTable joinTable) {
- super(parent, joinTable);
- }
-
- InverseJoinColumnDialog(Shell parent, IJoinColumn joinColumn) {
- super(parent, joinColumn);
- }
-
- protected String getTitle() {
- return JptUiMappingsMessages.InverseJoinColumnDialog_editInverseJoinColumn;
- }
-
- protected void populateNameCombo() {
- if (getJoinTable() == null) {
- return;
- }
- if (getJoinColumn() != null) {
- getNameCombo().add(NLS.bind(JptUiMappingsMessages.InverseJoinColumnDialog_defaultWithOneParam, getJoinColumn().getDefaultName()));
- }
- Table joinDBTable = getJoinTable().dbTable();
- if (joinDBTable != null) {
- for (Iterator i = joinDBTable.columnNames(); i.hasNext(); ) {
- getNameCombo().add((String) i.next());
- }
- }
- if (getJoinColumn() != null && getJoinColumn().getSpecifiedName() != null) {
- getNameCombo().setText(getJoinColumn().getSpecifiedName());
- }
- else {
- getNameCombo().select(0);
- }
- }
-
- protected void populateReferencedNameCombo() {
- if (getJoinTable() == null) {
- return;
- }
- if (getJoinColumn() != null) {
- getReferencedColumnNameCombo().add(NLS.bind(JptUiMappingsMessages.InverseJoinColumnDialog_defaultWithOneParam, getJoinColumn().getDefaultReferencedColumnName()));
- }
- IMultiRelationshipMapping multiRelationshipMapping = (IMultiRelationshipMapping) getJoinTable().eContainer();
- IEntity targetEntity = multiRelationshipMapping.getResolvedTargetEntity();
- if (targetEntity != null) {
- Table referencedDbTable = targetEntity.primaryDbTable();
- if (referencedDbTable != null) {
- for (Iterator i = referencedDbTable.columnNames(); i.hasNext(); ) {
- getReferencedColumnNameCombo().add((String) i.next());
- }
- }
- }
- if (getJoinColumn() != null && getJoinColumn().getSpecifiedReferencedColumnName() != null) {
- getReferencedColumnNameCombo().setText(getJoinColumn().getSpecifiedReferencedColumnName());
- }
- else {
- getReferencedColumnNameCombo().select(0);
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnComposite.java
deleted file mode 100644
index 98b52e4fc1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnComposite.java
+++ /dev/null
@@ -1,428 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.mappings.details;
-
-import java.util.Iterator;
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jface.viewers.IContentProvider;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.ListViewer;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean;
-import org.eclipse.jpt.core.internal.mappings.IAbstractColumn;
-import org.eclipse.jpt.core.internal.mappings.IAbstractJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.IJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.INamedColumn;
-import org.eclipse.jpt.core.internal.mappings.ISingleRelationshipMapping;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.details.BaseJpaComposite;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class JoinColumnComposite
- extends BaseJpaComposite
-{
- private ISingleRelationshipMapping singleRelationshipMapping;
- private final Adapter singleRelationshipMappingListener;
- private final Adapter joinColumnListener;
-
-
- private Group joinColumnsGroup;
- Button overrideDefaultJoinColumnsCheckBox;
- ListViewer joinColumnsListViewer;
- private Button joinColumnsRemoveButton;
- private Button joinColumnsEditButton;
-
-
-
- public JoinColumnComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, SWT.NULL, commandStack, widgetFactory);
- this.singleRelationshipMappingListener = buildSingleRelationshipMappingListener();
- this.joinColumnListener = buildJoinColumnListener();
- }
-
-
- private Adapter buildSingleRelationshipMappingListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- singleRelationshipMappingChanged(notification);
- }
- };
- }
-
- private Adapter buildJoinColumnListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- joinColumnChanged(notification);
- }
- };
- }
-
- @Override
- protected void initializeLayout(Composite composite) {
- GridLayout layout = new GridLayout(2, false);
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- composite.setLayout(layout);
-
- this.overrideDefaultJoinColumnsCheckBox =
- getWidgetFactory().createButton(
- composite,
- JptUiMappingsMessages.JoinColumnComposite_overrideDefaultJoinColumns,
- SWT.CHECK);
- this.overrideDefaultJoinColumnsCheckBox.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- // do nothing
- }
-
- public void widgetSelected(SelectionEvent e) {
- if (JoinColumnComposite.this.overrideDefaultJoinColumnsCheckBox.getSelection()) {
- IJoinColumn defaultJoinColumn = JoinColumnComposite.this.singleRelationshipMapping.getDefaultJoinColumns().get(0);
- String columnName = defaultJoinColumn.getDefaultName();
- String referencedColumnName = defaultJoinColumn.getDefaultReferencedColumnName();
-
- IJoinColumn joinColumn = JoinColumnComposite.this.singleRelationshipMapping.createJoinColumn(0);
- JoinColumnComposite.this.singleRelationshipMapping.getSpecifiedJoinColumns().add(joinColumn);
- joinColumn.setSpecifiedName(columnName);
- joinColumn.setSpecifiedReferencedColumnName(referencedColumnName);
- } else {
- JoinColumnComposite.this.singleRelationshipMapping.getSpecifiedJoinColumns().clear();
- }
- }
- });
-
- this.joinColumnsGroup =
- getWidgetFactory().createGroup(
- composite,
- JptUiMappingsMessages.JoinColumnComposite_joinColumn);
- this.joinColumnsGroup.setLayout(new GridLayout(2, false));
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- gridData.horizontalSpan = 2;
- this.joinColumnsGroup.setLayoutData(gridData);
-
- this.joinColumnsListViewer = new ListViewer(this.joinColumnsGroup, SWT.BORDER | SWT.MULTI);
- this.joinColumnsListViewer.setContentProvider(buildJoinColumnsListContentProvider());
- this.joinColumnsListViewer.setLabelProvider(buildJoinColumnsListLabelProvider());
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- gridData.verticalSpan = 3;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- this.joinColumnsListViewer.getList().setLayoutData(gridData);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this.joinColumnsListViewer.getList(), IJpaHelpContextIds.MAPPING_JOIN_TABLE_COLUMNS);
-
- Button addJoinColumnButton = getWidgetFactory().createButton(this.joinColumnsGroup, JptUiMappingsMessages.JoinColumnComposite_add, SWT.NONE);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- addJoinColumnButton.setLayoutData(gridData);
- addJoinColumnButton.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- }
-
- public void widgetSelected(SelectionEvent e) {
- addJoinColumn();
- }
- });
-
- this.joinColumnsEditButton = getWidgetFactory().createButton(this.joinColumnsGroup, JptUiMappingsMessages.JoinColumnComposite_edit, SWT.NONE);
- this.joinColumnsEditButton.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- }
-
- public void widgetSelected(SelectionEvent e) {
- editJoinColumn();
- }
- });
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- this.joinColumnsEditButton.setLayoutData(gridData);
-
- this.joinColumnsRemoveButton = getWidgetFactory().createButton(this.joinColumnsGroup, JptUiMappingsMessages.JoinColumnComposite_remove, SWT.NONE);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.BEGINNING;
- this.joinColumnsRemoveButton.setLayoutData(gridData);
- this.joinColumnsRemoveButton.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- }
-
- public void widgetSelected(SelectionEvent e) {
- removeJoinColumn();
- }
- });
-
- this.joinColumnsListViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- updateEnablement();
- }
- });
-
- }
- private IContentProvider buildJoinColumnsListContentProvider() {
- return new IStructuredContentProvider(){
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- // do nothing
- }
- public void dispose() {
- // do nothing
- }
- public Object[] getElements(Object inputElement) {
- return ((ISingleRelationshipMapping) inputElement).getJoinColumns().toArray();
- }
- };
- }
-
- private ILabelProvider buildJoinColumnsListLabelProvider() {
- return new LabelProvider() {
- public String getText(Object element) {
- IJoinColumn joinColumn = (IJoinColumn) element;
- return (JoinColumnComposite.this.singleRelationshipMapping.getSpecifiedJoinColumns().size() == 0) ?
- buildDefaultJoinColumnLabel(joinColumn)
- :
- buildJoinColumnLabel(joinColumn);
- }
- };
- }
-
- String buildDefaultJoinColumnLabel(IJoinColumn joinColumn) {
- return NLS.bind(JptUiMappingsMessages.JoinColumnComposite_mappingBetweenTwoParamsDefault, joinColumn.getName(), joinColumn.getReferencedColumnName());
- }
-
- String buildJoinColumnLabel(IJoinColumn joinColumn) {
- if (joinColumn.getSpecifiedName() == null) {
- if (joinColumn.getSpecifiedReferencedColumnName() == null) {
- return NLS.bind(JptUiMappingsMessages.JoinColumnComposite_mappingBetweenTwoParamsBothDefault, joinColumn.getName(),joinColumn.getReferencedColumnName());
- }
- return NLS.bind(JptUiMappingsMessages.JoinColumnComposite_mappingBetweenTwoParamsFirstDefault, joinColumn.getName(), joinColumn.getReferencedColumnName());
- }
- else if (joinColumn.getSpecifiedReferencedColumnName() == null) {
- return NLS.bind(JptUiMappingsMessages.JoinColumnComposite_mappingBetweenTwoParamsSecDefault, joinColumn.getName(), joinColumn.getReferencedColumnName());
- }
- else {
- return NLS.bind(JptUiMappingsMessages.JoinColumnComposite_mappingBetweenTwoParams, joinColumn.getName(), joinColumn.getReferencedColumnName());
- }
- }
-
- protected void joinColumnChanged(Notification notification) {
- if (notification.getFeatureID(INamedColumn.class) == JpaCoreMappingsPackage.INAMED_COLUMN__SPECIFIED_NAME
- || notification.getFeatureID(INamedColumn.class) == JpaCoreMappingsPackage.INAMED_COLUMN__DEFAULT_NAME
- || notification.getFeatureID(IAbstractColumn.class) == JpaCoreMappingsPackage.IABSTRACT_COLUMN__SPECIFIED_TABLE
- || notification.getFeatureID(IAbstractColumn.class) == JpaCoreMappingsPackage.IABSTRACT_COLUMN__DEFAULT_TABLE
- || notification.getFeatureID(IAbstractJoinColumn.class) == JpaCoreMappingsPackage.IABSTRACT_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME
- || notification.getFeatureID(IAbstractJoinColumn.class) == JpaCoreMappingsPackage.IABSTRACT_JOIN_COLUMN__DEFAULT_REFERENCED_COLUMN_NAME) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- joinColumnsListViewer.refresh();
- }
- });
- }
- }
-
- void addJoinColumn() {
- JoinColumnDialog dialog = new JoinColumnInRelationshipMappingDialog(this.getControl().getShell(), this.singleRelationshipMapping);
- this.addJoinColumnFromDialog(dialog);
- }
-
- private void addJoinColumnFromDialog(JoinColumnDialog dialog) {
- if (dialog.open() != Window.OK) {
- return;
- }
- int index = this.singleRelationshipMapping.getJoinColumns().size();
- IJoinColumn joinColumn = this.singleRelationshipMapping.createJoinColumn(index);
- this.singleRelationshipMapping.getSpecifiedJoinColumns().add(joinColumn);
- joinColumn.setSpecifiedName(dialog.getSelectedName());
- joinColumn.setSpecifiedReferencedColumnName(dialog.getReferencedColumnName());
- if (!dialog.isDefaultTableSelected()) {
- //not checking this for name and referenced column name because there is no
- //default option when you are adding a second join column. There is always
- //at least 1 join column (the default)
- joinColumn.setSpecifiedTable(dialog.getSelectedTable());
- }
- }
-
- void editJoinColumn() {
- IJoinColumn joinColumn = getSelectedJoinColumn();
- JoinColumnDialog dialog = new JoinColumnInRelationshipMappingDialog(this.getControl().getShell(), joinColumn);
- editJoinColumnFromDialog(dialog, joinColumn);
- }
-
- private IJoinColumn getSelectedJoinColumn() {
- return (IJoinColumn) ((StructuredSelection) this.joinColumnsListViewer.getSelection()).getFirstElement();
- }
-
- private void editJoinColumnFromDialog(JoinColumnDialog dialog, IJoinColumn joinColumn) {
- if (dialog.open() == Window.OK) {
- editJoinColumnDialogOkd(dialog, joinColumn);
- }
- }
-
- private void editJoinColumnDialogOkd(JoinColumnDialog dialog, IJoinColumn joinColumn) {
- String name = dialog.getSelectedName();
- String referencedColumnName = dialog.getReferencedColumnName();
- String table = dialog.getSelectedTable();
-
- if (dialog.isDefaultNameSelected()) {
- if (joinColumn.getSpecifiedName() != null) {
- joinColumn.setSpecifiedName(null);
- }
- }
- else if (joinColumn.getSpecifiedName() == null || !joinColumn.getSpecifiedName().equals(name)){
- joinColumn.setSpecifiedName(name);
- }
- if (dialog.isDefaultReferencedColumnNameSelected()) {
- if (joinColumn.getSpecifiedReferencedColumnName() != null) {
- joinColumn.setSpecifiedReferencedColumnName(null);
- }
- }
- else if (joinColumn.getSpecifiedReferencedColumnName() == null || !joinColumn.getSpecifiedReferencedColumnName().equals(referencedColumnName)){
- joinColumn.setSpecifiedReferencedColumnName(referencedColumnName);
- }
-
- if (dialog.isDefaultTableSelected()) {
- if (joinColumn.getSpecifiedTable() != null) {
- joinColumn.setSpecifiedTable(null);
- }
- }
- else if (joinColumn.getSpecifiedTable() == null || !joinColumn.getSpecifiedTable().equals(table)){
- joinColumn.setSpecifiedTable(table);
- }
-
- DefaultTrueBoolean insertable = dialog.getInsertable();
- if (joinColumn.getInsertable() != insertable) {
- joinColumn.setInsertable(insertable);
- }
-
- DefaultTrueBoolean updatable = dialog.getUpdatable();
- if (joinColumn.getUpdatable() != updatable) {
- joinColumn.setUpdatable(updatable);
- }
- }
-
- void removeJoinColumn() {
- ISelection selection = this.joinColumnsListViewer.getSelection();
- if (selection instanceof StructuredSelection) {
- for (Iterator stream = ((StructuredSelection) selection).iterator(); stream.hasNext(); ) {
- this.singleRelationshipMapping.getJoinColumns().remove(stream.next());
- }
- }
- }
-
- protected void singleRelationshipMappingChanged(Notification notification) {
- if (notification.getFeatureID(ISingleRelationshipMapping.class) == JpaCoreMappingsPackage.ISINGLE_RELATIONSHIP_MAPPING__SPECIFIED_JOIN_COLUMNS) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- JoinColumnComposite.this.joinColumnsListViewer.refresh();
- JoinColumnComposite.this.overrideDefaultJoinColumnsCheckBox.setSelection(singleRelationshipMapping.containsSpecifiedJoinColumns());
- JoinColumnComposite.this.updateEnablement();
- }
- });
- if (notification.getEventType() == Notification.ADD) {
- ((IJoinColumn) notification.getNewValue()).eAdapters().add(this.joinColumnListener);
- }
- else if (notification.getEventType() == Notification.REMOVE) {
- ((IJoinColumn) notification.getOldValue()).eAdapters().remove(this.joinColumnListener);
- }
- }
- }
-
- private void enableGroup(Group group, boolean enabled) {
- group.setEnabled(enabled);
- for (int i = 0; i < group.getChildren().length; i++) {
- group.getChildren()[i].setEnabled(enabled);
- }
- }
-
-
-
- protected void engageListeners() {
- if (this.singleRelationshipMapping != null) {
- this.singleRelationshipMapping.eAdapters().add(this.singleRelationshipMappingListener);
- for (Iterator i = this.singleRelationshipMapping.getJoinColumns().iterator(); i.hasNext(); ) {
- ((IJoinColumn) i.next()).eAdapters().add(this.joinColumnListener);
- }
- }
- }
-
- protected void disengageListeners() {
- if (this.singleRelationshipMapping != null) {
- for (Iterator i = this.singleRelationshipMapping.getJoinColumns().iterator(); i.hasNext(); ) {
- ((IJoinColumn) i.next()).eAdapters().remove(this.joinColumnListener);
- }
- this.singleRelationshipMapping.eAdapters().remove(this.singleRelationshipMappingListener);
- }
- }
-
- public void doPopulate(EObject obj) {
- this.singleRelationshipMapping = (ISingleRelationshipMapping) obj;
- if (this.singleRelationshipMapping == null) {
- this.joinColumnsListViewer.setInput(null);
- return;
- }
-
- this.joinColumnsListViewer.setInput(this.singleRelationshipMapping);
-
-
- updateEnablement();
- this.overrideDefaultJoinColumnsCheckBox.setSelection(this.singleRelationshipMapping.containsSpecifiedJoinColumns());
- }
-
- @Override
- protected void doPopulate() {
- this.joinColumnsListViewer.setInput(this.singleRelationshipMapping);
- }
-
- void updateEnablement() {
- boolean groupEnabledState = this.singleRelationshipMapping.containsSpecifiedJoinColumns();
- enableGroup(this.joinColumnsGroup, groupEnabledState);
-
- this.joinColumnsRemoveButton.setEnabled(groupEnabledState && !((StructuredSelection) this.joinColumnsListViewer.getSelection()).isEmpty());
- this.joinColumnsEditButton.setEnabled(groupEnabledState && ((StructuredSelection) this.joinColumnsListViewer.getSelection()).size() == 1);
- }
-
- public void dispose() {
- disengageListeners();
- super.dispose();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnDialog.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnDialog.java
deleted file mode 100644
index ff716ce124..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnDialog.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.mappings.details;
-
-import java.util.Iterator;
-import org.eclipse.jface.viewers.ComboViewer;
-import org.eclipse.jface.viewers.IBaseLabelProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean;
-import org.eclipse.jpt.core.internal.mappings.IJoinColumn;
-import org.eclipse.jpt.db.internal.Schema;
-import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-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.ui.PlatformUI;
-import org.eclipse.ui.help.IWorkbenchHelpSystem;
-
-public abstract class JoinColumnDialog extends AbstractJoinColumnDialog<IJoinColumn> {
-
- private Combo tableCombo;
- private ComboViewer insertableComboViewer;
- private ComboViewer updatableComboViewer;
-
- private boolean defaultTableSelected;
- private String selectedTable;
- private DefaultTrueBoolean insertable;
- private DefaultTrueBoolean updatable;
-
- JoinColumnDialog(Shell parent) {
- super(parent);
- }
-
- JoinColumnDialog(Shell parent, IJoinColumn joinColumn) {
- super(parent, joinColumn);
- }
-
- protected Control createDialogArea(Composite parent) {
- IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
- Composite composite = (Composite) super.createDialogArea(parent);
-
- Label tableLabel = new Label(composite, SWT.LEFT);
- tableLabel.setText(JptUiMappingsMessages.JoinColumnDialog_table);
- GridData gridData = new GridData();
- tableLabel.setLayoutData(gridData);
-
- this.tableCombo = new Combo(composite, SWT.LEFT);
- this.tableCombo.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- populateNameCombo();
- }
- public void widgetDefaultSelected(SelectionEvent e) {
- populateNameCombo();
- }
- });
- gridData = new GridData();
- gridData.grabExcessHorizontalSpace = true;
- gridData.horizontalAlignment = SWT.FILL;
- this.tableCombo.setLayoutData(gridData);
- //PlatformUI.getWorkbench().getHelpSystem().setHelp(this.tableCombo, IJpaHelpContextIds.MAPPING_JOIN_REFERENCED_COLUMN);
- populateTableCombo();
-
- Label insertableLabel = new Label(composite, SWT.LEFT);
- insertableLabel.setText(JptUiMappingsMessages.JoinColumnDialog_insertable);
- insertableLabel.setLayoutData(new GridData());
-
- this.insertableComboViewer = this.buildInsertableComboViewer(composite);
- this.insertableComboViewer.getCombo().setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
- helpSystem.setHelp(this.insertableComboViewer.getCombo(), IJpaHelpContextIds.MAPPING_COLUMN_INSERTABLE);
-
- Label updatableLabel = new Label(composite, SWT.LEFT);
- updatableLabel.setText(JptUiMappingsMessages.JoinColumnDialog_updatable);
- updatableLabel.setLayoutData(new GridData());
-
- this.updatableComboViewer = this.buildUpdatableComboViewer(composite);
- this.updatableComboViewer.getCombo().setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
- helpSystem.setHelp(this.updatableComboViewer.getCombo(), IJpaHelpContextIds.MAPPING_COLUMN_UPDATABLE);
-
- return composite;
- }
-
- private ComboViewer buildInsertableComboViewer(Composite parent) {
- ComboViewer viewer = new ComboViewer(parent, SWT.READ_ONLY);
- viewer.setLabelProvider(buildDefaultTrueLabelProvider());
- viewer.add(DefaultTrueBoolean.VALUES.toArray());
-
- DefaultTrueBoolean sel = (this.joinColumn() == null) ? DefaultTrueBoolean.DEFAULT : this.joinColumn().getInsertable();
- viewer.setSelection(new StructuredSelection(sel));
- return viewer;
- }
-
- private IBaseLabelProvider buildDefaultTrueLabelProvider() {
- return new LabelProvider() {
- @Override
- public String getText(Object element) {
- if (element == DefaultTrueBoolean.DEFAULT) {
- //TODO need to move this to the model, don't want hardcoded String
- return NLS.bind(JptUiMappingsMessages.JoinColumnDialog_defaultTrue, "True");
- }
- return super.getText(element);
- }
- };
- }
-
- private ComboViewer buildUpdatableComboViewer(Composite parent) {
- ComboViewer viewer = new ComboViewer(parent, SWT.READ_ONLY);
- viewer.setLabelProvider(buildDefaultTrueLabelProvider());
- viewer.add(DefaultTrueBoolean.VALUES.toArray());
- DefaultTrueBoolean sel = (this.joinColumn() == null) ? DefaultTrueBoolean.DEFAULT : this.joinColumn().getUpdatable();
- viewer.setSelection(new StructuredSelection(sel));
- return viewer;
- }
-
- protected void populateTableCombo() {
- this.tableCombo.add(NLS.bind(JptUiMappingsMessages.JoinColumnDialog_defaultWithOneParam, defaultTableName()));
- Schema schema = this.getSchema();
- if (schema != null) {
- Iterator<String> tables = schema.tableNames();
- for (Iterator<String> stream = CollectionTools.sort( tables); stream.hasNext(); ) {
- this.tableCombo.add(stream.next());
- }
- }
- if (specifiedTableName() != null) {
- this.tableCombo.setText(specifiedTableName());
- }
- else {
- this.tableCombo.select(0);
- }
- }
-
- protected abstract String defaultTableName();
-
- protected String specifiedTableName() {
- if (getJoinColumn() != null) {
- return getJoinColumn().getSpecifiedTable();
- }
- return null;
- }
-
- protected String tableName() {
- if (this.tableCombo != null) {
- if (this.tableCombo.getSelectionIndex() == 0) {
- return defaultTableName();
- }
- return this.tableCombo.getText();
- }
- return (this.specifiedTableName() == null) ? defaultTableName() : this.specifiedTableName();
- }
-
- protected abstract Schema getSchema();
-
- private IJoinColumn joinColumn() {
- return this.getJoinColumn();
- }
-
- protected boolean isDefaultTableSelected() {
- return this.defaultTableSelected;
- }
-
- public String getSelectedTable() {
- return this.selectedTable;
- }
-
- public DefaultTrueBoolean getInsertable() {
- return this.insertable;
- }
-
- public DefaultTrueBoolean getUpdatable() {
- return this.updatable;
- }
-
- public boolean close() {
- this.defaultTableSelected = this.tableCombo.getSelectionIndex() == 0;
- this.selectedTable = this.tableCombo.getText();
-
- ISelection selection = this.insertableComboViewer.getSelection();
- if (selection instanceof IStructuredSelection) {
- this.insertable = (DefaultTrueBoolean) ((IStructuredSelection) selection).getFirstElement();
- }
-
- selection = this.updatableComboViewer.getSelection();
- if (selection instanceof IStructuredSelection) {
- this.updatable = (DefaultTrueBoolean) ((IStructuredSelection) selection).getFirstElement();
- }
-
- return super.close();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnInAssociationOverrideDialog.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnInAssociationOverrideDialog.java
deleted file mode 100644
index c324a95b34..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnInAssociationOverrideDialog.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.mappings.details;
-
-import org.eclipse.jpt.core.internal.IAttributeMapping;
-import org.eclipse.jpt.core.internal.mappings.IAssociationOverride;
-import org.eclipse.jpt.core.internal.mappings.IEntity;
-import org.eclipse.jpt.core.internal.mappings.IJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.IRelationshipMapping;
-import org.eclipse.jpt.db.internal.Schema;
-import org.eclipse.jpt.db.internal.Table;
-import org.eclipse.swt.widgets.Shell;
-
-public class JoinColumnInAssociationOverrideDialog extends JoinColumnDialog {
-
- private IAssociationOverride associationOverride;
-
- JoinColumnInAssociationOverrideDialog(Shell parent, IAssociationOverride associationOverride) {
- super(parent);
- this.associationOverride = associationOverride;
- }
-
- JoinColumnInAssociationOverrideDialog(Shell parent, IJoinColumn joinColumn) {
- super(parent, joinColumn);
- this.associationOverride = (IAssociationOverride) joinColumn.eContainer();
- }
-
- protected Schema getSchema() {
- return this.associationOverride.typeMapping().dbSchema();
- }
-
- protected String defaultTableName() {
- if (getJoinColumn() != null) {
- return getJoinColumn().getDefaultTable();
- }
- return this.associationOverride.typeMapping().getTableName();
- }
-
- protected Table getNameTable() {
- return this.associationOverride.typeMapping().primaryDbTable();
- }
-
- protected Table getReferencedNameTable() {
- IAttributeMapping attributeMapping = this.associationOverride.getOwner().attributeMapping(this.associationOverride.getName());
- if (attributeMapping == null || !(attributeMapping instanceof IRelationshipMapping)) {
- return null;
- }
- IEntity targetEntity = ((IRelationshipMapping) attributeMapping).getResolvedTargetEntity();
- if (targetEntity != null) {
- return targetEntity.primaryDbTable();
- }
- return null;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnInJoinTableDialog.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnInJoinTableDialog.java
deleted file mode 100644
index 5a8a7479c2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnInJoinTableDialog.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.mappings.details;
-
-import org.eclipse.jpt.core.internal.mappings.IJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.IJoinTable;
-import org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping;
-import org.eclipse.jpt.db.internal.Table;
-import org.eclipse.swt.widgets.Shell;
-
-//if there is only 1 joinColumn and the user is editing it, they should be
-//able to define defaults. otherwise, we probably shouldn't allow it.
-public class JoinColumnInJoinTableDialog extends AbstractJoinColumnDialog<IJoinColumn> {
-
- private IJoinTable joinTable;
-
- JoinColumnInJoinTableDialog(Shell parent, IJoinTable joinTable) {
- super(parent);
- this.joinTable = joinTable;
- }
-
- JoinColumnInJoinTableDialog(Shell parent, IJoinColumn joinColumn) {
- super(parent, joinColumn);
- this.joinTable = (IJoinTable) joinColumn.eContainer();
- }
- protected IJoinTable getJoinTable() {
- return this.joinTable;
- }
-
- protected Table getNameTable() {
- return getJoinTable().dbTable();
- }
-
- protected Table getReferencedNameTable() {
- IMultiRelationshipMapping multiRelationshipMapping = (IMultiRelationshipMapping) getJoinTable().eContainer();
- return multiRelationshipMapping.typeMapping().primaryDbTable();
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnInRelationshipMappingDialog.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnInRelationshipMappingDialog.java
deleted file mode 100644
index e60a047663..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnInRelationshipMappingDialog.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.mappings.details;
-
-import org.eclipse.jpt.core.internal.mappings.IEntity;
-import org.eclipse.jpt.core.internal.mappings.IJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.ISingleRelationshipMapping;
-import org.eclipse.jpt.db.internal.Schema;
-import org.eclipse.jpt.db.internal.Table;
-import org.eclipse.swt.widgets.Shell;
-
-public class JoinColumnInRelationshipMappingDialog extends JoinColumnDialog {
-
- private ISingleRelationshipMapping singleRelationshipMapping;
-
- JoinColumnInRelationshipMappingDialog(Shell parent, ISingleRelationshipMapping singleRelationshipMapping) {
- super(parent);
- this.singleRelationshipMapping = singleRelationshipMapping;
- }
-
- JoinColumnInRelationshipMappingDialog(Shell parent, IJoinColumn joinColumn) {
- super(parent, joinColumn);
- this.singleRelationshipMapping = (ISingleRelationshipMapping) joinColumn.eContainer();
- }
-
- protected String defaultTableName() {
- if (getJoinColumn() != null) {
- return getJoinColumn().getDefaultTable();
- }
- return this.singleRelationshipMapping.typeMapping().getTableName();
- }
-
- protected Schema getSchema() {
- return this.singleRelationshipMapping.typeMapping().dbSchema();
- }
-
- protected Table getNameTable() {
- Schema schema = this.getSchema();
- return (schema == null) ? null : schema.tableNamed(tableName());
- }
-
- protected Table getReferencedNameTable() {
- IEntity targetEntity = this.singleRelationshipMapping.getResolvedTargetEntity();
- if (targetEntity != null) {
- return targetEntity.primaryDbTable();
- }
- return null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnsComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnsComposite.java
deleted file mode 100644
index 886e200383..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnsComposite.java
+++ /dev/null
@@ -1,348 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.mappings.details;
-
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jface.viewers.IContentProvider;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.ListViewer;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jpt.core.internal.mappings.IAbstractColumn;
-import org.eclipse.jpt.core.internal.mappings.IAbstractJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.IJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.INamedColumn;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.details.BaseJpaComposite;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class JoinColumnsComposite extends BaseJpaComposite
-{
-
- private Owner owner;
- private final Adapter joinColumnsOwnerListener;
-
- private ListViewer joinColumnsListViewer;
-
- private final Adapter joinColumnListener;
-
- private Group joinColumnsGroup;
- private Button joinColumnsAddButton;
- private Button joinColumnsRemoveButton;
- private Button joinColumnsEditButton;
-
-
- public JoinColumnsComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory, String groupTitle) {
- super(parent, SWT.NULL, commandStack, widgetFactory);
- this.joinColumnsOwnerListener = buildJoinColumnsOwnerListener();
- this.joinColumnListener = buildJoinColumnListener();
- this.joinColumnsGroup.setText(groupTitle);
- }
-
- private Adapter buildJoinColumnsOwnerListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- joinColumnsOwnerChanged(notification);
- }
- };
- }
-
- private Adapter buildJoinColumnListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- joinColumnChanged(notification, joinColumnsListViewer);
- }
- };
- }
-
- @Override
- protected void initializeLayout(Composite composite) {
- GridLayout layout = new GridLayout(2, false);
- layout.marginWidth = 0;
- composite.setLayout(layout);
-
- this.joinColumnsGroup =
- getWidgetFactory().createGroup(
- composite,
- "");
- this.joinColumnsGroup.setLayout(new GridLayout(2, false));
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- gridData.horizontalSpan = 2;
- this.joinColumnsGroup.setLayoutData(gridData);
-
- this.joinColumnsListViewer = new ListViewer(this.joinColumnsGroup, SWT.BORDER | SWT.MULTI);
- this.joinColumnsListViewer.setContentProvider(buildJoinColumnsListContentProvider());
- this.joinColumnsListViewer.setLabelProvider(buildJoinColumnsListLabelProvider());
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- gridData.verticalSpan = 3;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- this.joinColumnsListViewer.getList().setLayoutData(gridData);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this.joinColumnsListViewer.getList(), IJpaHelpContextIds.MAPPING_JOIN_TABLE_COLUMNS);
-
- this.joinColumnsAddButton = getWidgetFactory().createButton(this.joinColumnsGroup, JptUiMappingsMessages.JoinTableComposite_add, SWT.NONE);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- this.joinColumnsAddButton.setLayoutData(gridData);
- this.joinColumnsAddButton.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- }
-
- public void widgetSelected(SelectionEvent e) {
- owner.addJoinColumn();
- }
- });
-
- this.joinColumnsEditButton = getWidgetFactory().createButton(this.joinColumnsGroup, JptUiMappingsMessages.JoinTableComposite_edit, SWT.NONE);
- this.joinColumnsEditButton.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- }
-
- public void widgetSelected(SelectionEvent e) {
- editJoinColumn();
- }
- });
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- this.joinColumnsEditButton.setLayoutData(gridData);
-
- this.joinColumnsRemoveButton = getWidgetFactory().createButton(this.joinColumnsGroup, JptUiMappingsMessages.JoinTableComposite_remove, SWT.NONE);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.BEGINNING;
- this.joinColumnsRemoveButton.setLayoutData(gridData);
- this.joinColumnsRemoveButton.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- }
-
- public void widgetSelected(SelectionEvent e) {
- removeJoinColumn();
- }
- });
-
- this.joinColumnsListViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- updateJoinColumnsEnablement();
- }
- });
- }
-
- private IContentProvider buildJoinColumnsListContentProvider() {
- return new IStructuredContentProvider(){
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
-
- public void dispose() {
-
- }
-
- public Object[] getElements(Object inputElement) {
- return ((Owner) inputElement).getJoinColumns().toArray();
- }
- };
- }
-
- private ILabelProvider buildJoinColumnsListLabelProvider() {
- return new LabelProvider() {
- public String getText(Object element) {
- IJoinColumn joinColumn = (IJoinColumn) element;
- return (JoinColumnsComposite.this.owner.containsSpecifiedJoinColumns()) ?
- buildJoinColumnLabel(joinColumn)
- :
- buildDefaultJoinColumnLabel(joinColumn);
- }
- };
- }
-
- private String buildDefaultJoinColumnLabel(IJoinColumn joinColumn) {
- return NLS.bind(JptUiMappingsMessages.JoinTableComposite_mappingBetweenTwoParamsDefault, joinColumn.getName(), joinColumn.getReferencedColumnName());
- }
-
- private String buildJoinColumnLabel(IJoinColumn joinColumn) {
- if (joinColumn.getSpecifiedName() == null) {
- if (joinColumn.getSpecifiedReferencedColumnName() == null) {
- return NLS.bind(JptUiMappingsMessages.JoinTableComposite_mappingBetweenTwoParamsBothDefault, joinColumn.getName(),joinColumn.getReferencedColumnName());
- }
- return NLS.bind(JptUiMappingsMessages.JoinTableComposite_mappingBetweenTwoParamsFirstDefault, joinColumn.getName(), joinColumn.getReferencedColumnName());
- }
- else if (joinColumn.getSpecifiedReferencedColumnName() == null) {
- return NLS.bind(JptUiMappingsMessages.JoinTableComposite_mappingBetweenTwoParamsSecDefault, joinColumn.getName(), joinColumn.getReferencedColumnName());
- }
- else {
- return NLS.bind(JptUiMappingsMessages.JoinTableComposite_mappingBetweenTwoParams, joinColumn.getName(), joinColumn.getReferencedColumnName());
- }
- }
-
- void editJoinColumn() {
- this.owner.editJoinColumn(getSelectedJoinColumn());
- }
-
- void removeJoinColumn() {
- ISelection selection = this.joinColumnsListViewer.getSelection();
- if (selection instanceof StructuredSelection) {
- for (Iterator stream = ((StructuredSelection) selection).iterator(); stream.hasNext(); ) {
- this.owner.getJoinColumns().remove(stream.next());
- }
- }
- }
-
- private IJoinColumn getSelectedJoinColumn() {
- return (IJoinColumn) ((StructuredSelection) this.joinColumnsListViewer.getSelection()).getFirstElement();
- }
-
- protected void joinColumnsOwnerChanged(Notification notification) {
- if (notification.getFeatureID(owner.owningFeatureClass()) == owner.specifiedJoinColumnsFeatureId()) {
- if (notification.getEventType() == Notification.ADD) {
- ((IJoinColumn) notification.getNewValue()).eAdapters().add(this.joinColumnListener);
- }
- else if (notification.getEventType() == Notification.REMOVE) {
- ((IJoinColumn) notification.getOldValue()).eAdapters().remove(this.joinColumnListener);
- }
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- joinColumnsListViewer.refresh();
- updateJoinColumnsEnablement();
- }
- });
- }
- }
-
- private void enableGroup(Group group, boolean enabled) {
- group.setEnabled(enabled);
- for (int i = 0; i < group.getChildren().length; i++) {
- group.getChildren()[i].setEnabled(enabled);
- }
- }
- protected void joinColumnChanged(Notification notification, final ListViewer listViewer) {
- if (notification.getFeatureID(INamedColumn.class) == JpaCoreMappingsPackage.INAMED_COLUMN__SPECIFIED_NAME
- || notification.getFeatureID(INamedColumn.class) == JpaCoreMappingsPackage.INAMED_COLUMN__DEFAULT_NAME
- || notification.getFeatureID(IAbstractColumn.class) == JpaCoreMappingsPackage.IABSTRACT_COLUMN__SPECIFIED_TABLE
- || notification.getFeatureID(IAbstractColumn.class) == JpaCoreMappingsPackage.IABSTRACT_COLUMN__DEFAULT_TABLE
- || notification.getFeatureID(IAbstractJoinColumn.class) == JpaCoreMappingsPackage.IABSTRACT_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME
- || notification.getFeatureID(IAbstractJoinColumn.class) == JpaCoreMappingsPackage.IABSTRACT_JOIN_COLUMN__DEFAULT_REFERENCED_COLUMN_NAME) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- listViewer.refresh();
- }
- });
- }
- }
-
- protected void engageListeners() {
- if (this.owner != null) {
- this.owner.getEObject().eAdapters().add(this.joinColumnsOwnerListener);
- for (IJoinColumn joinColumn : this.owner.getJoinColumns()) {
- joinColumn.eAdapters().add(this.joinColumnListener);
- }
- }
- }
-
- protected void disengageListeners() {
- if (this.owner != null) {
- for (IJoinColumn joinColumn : this.owner.getJoinColumns()) {
- joinColumn.eAdapters().remove(this.joinColumnListener);
- }
- this.owner.getEObject().eAdapters().remove(this.joinColumnsOwnerListener);
- }
- }
-
- public void doPopulate(EObject obj) {
- this.owner = (Owner) obj;
- if (this.owner == null) {
- this.joinColumnsListViewer.setInput(null);
- return;
- }
-
- this.joinColumnsListViewer.setInput(this.owner);
-
- updateEnablement();
- }
-
- @Override
- protected void doPopulate() {
- }
-
- private void updateEnablement() {
- updateJoinColumnsEnablement();
- }
-
- void updateJoinColumnsEnablement() {
- boolean groupEnabledState = this.owner.containsSpecifiedJoinColumns();
- enableGroup(this.joinColumnsGroup, groupEnabledState);
-
- this.joinColumnsRemoveButton.setEnabled(groupEnabledState && !((StructuredSelection) this.joinColumnsListViewer.getSelection()).isEmpty());
- this.joinColumnsEditButton.setEnabled(groupEnabledState && ((StructuredSelection) this.joinColumnsListViewer.getSelection()).size() == 1);
- }
-
- protected void enableWidgets(boolean enabled) {
- enableGroup(this.joinColumnsGroup, enabled);
- this.joinColumnsAddButton.setEnabled(enabled);
- this.joinColumnsEditButton.setEnabled(enabled);
- this.joinColumnsRemoveButton.setEnabled(enabled);
- this.joinColumnsListViewer.getList().setEnabled(enabled);
- }
-
- public interface Owner {
- int specifiedJoinColumnsFeatureId();
-
- Class owningFeatureClass();
-
- EObject getEObject();
-
- boolean containsSpecifiedJoinColumns();
-
- List<IJoinColumn> getJoinColumns();
-
- List<IJoinColumn> getSpecifiedJoinColumns();
-
- IJoinColumn createJoinColumn(int index);
-
- void addJoinColumn();
-
- void editJoinColumn(IJoinColumn joinColumn);
- }
-
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinTableComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinTableComposite.java
deleted file mode 100644
index 1f2f436c05..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinTableComposite.java
+++ /dev/null
@@ -1,472 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.mappings.details;
-
-import java.util.List;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jpt.core.internal.IJpaProject;
-import org.eclipse.jpt.core.internal.JpaEObject;
-import org.eclipse.jpt.core.internal.mappings.IJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.IJoinTable;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.db.internal.ConnectionListener;
-import org.eclipse.jpt.db.internal.ConnectionProfile;
-import org.eclipse.jpt.db.internal.Database;
-import org.eclipse.jpt.db.internal.Schema;
-import org.eclipse.jpt.db.internal.Table;
-import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.details.BaseJpaComposite;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.mappings.details.JoinColumnsComposite.Owner;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class JoinTableComposite extends BaseJpaComposite
-{
-
- private IJoinTable joinTable;
- private final Adapter joinTableListener;
-
- protected TableCombo tableCombo;
-
- private ConnectionProfile connectionProfile;
- private ConnectionListener connectionListener;
-
- private Button overrideDefaultJoinColumnsCheckBox;
- private JoinColumnsComposite joinColumnsComposite;
-
- private Button overrideDefaultInverseJoinColumnsCheckBox;
- private JoinColumnsComposite inverseJoinColumnsComposite;
-
- public JoinTableComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, SWT.NULL, commandStack, widgetFactory);
- this.joinTableListener = buildJoinTableListener();
- this.connectionListener = buildConnectionListener();
- }
-
- private Adapter buildJoinTableListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- joinTableChanged(notification);
- }
- };
- }
-
- private ConnectionListener buildConnectionListener() {
- return new ConnectionListener() {
-
- public void aboutToClose(ConnectionProfile profile) {
- // not interested to this event.
- }
-
- public void closed(ConnectionProfile profile) {
- getControl().getDisplay().asyncExec( new Runnable() {
- public void run() {
- JoinTableComposite.this.tableCombo.populate();
- }
- });
- }
-
- public void modified(ConnectionProfile profile) {
- getControl().getDisplay().asyncExec( new Runnable() {
- public void run() {
- JoinTableComposite.this.tableCombo.populate();
- }
- });
- }
-
- public boolean okToClose(ConnectionProfile profile) {
- // not interested to this event.
- return true;
- }
-
- public void opened(ConnectionProfile profile) {
- getControl().getDisplay().asyncExec( new Runnable() {
- public void run() {
- JoinTableComposite.this.tableCombo.populate();
- }
- });
- }
-
- public void databaseChanged(ConnectionProfile profile, final Database database) {
- getControl().getDisplay().asyncExec( new Runnable() {
- public void run() {
- if(database == JoinTableComposite.this.tableCombo.getDatabase()) {
- if (!getControl().isDisposed()) {
- JoinTableComposite.this.tableCombo.populate();
- }
- }
- }
- });
- }
-
- public void schemaChanged(ConnectionProfile profile, final Schema schema) {
- getControl().getDisplay().asyncExec( new Runnable() {
- public void run() {
- if(schema == JoinTableComposite.this.tableCombo.getTableSchema()) {
- if (!getControl().isDisposed()) {
- JoinTableComposite.this.tableCombo.populate();
- }
- }
- }
- });
- }
-
- public void tableChanged(ConnectionProfile profile, final Table table) {
- // not interested to this event.
- }
- };
- }
-
- private ConnectionProfile getConnectionProfile() {
- if(this.connectionProfile == null) {
- IJpaProject jpaProject = this.joinTable.getJpaProject();
- this.connectionProfile = jpaProject.connectionProfile();
- }
- return this.connectionProfile;
- }
-
- private void addConnectionListener() {
- this.getConnectionProfile().addConnectionListener(this.connectionListener);
- }
-
- private void removeConnectionListener() {
- this.getConnectionProfile().removeConnectionListener(this.connectionListener);
- }
-
- @Override
- protected void initializeLayout(Composite composite) {
- GridLayout layout = new GridLayout(2, false);
- layout.marginWidth = 0;
- composite.setLayout(layout);
-
- getWidgetFactory().createLabel(composite, JptUiMappingsMessages.JoinTableComposite_name);
-
- this.tableCombo = new TableCombo(composite, this.commandStack, getWidgetFactory());
- GridData gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.tableCombo.getCombo().setLayoutData(gridData);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this.tableCombo.getCombo(), IJpaHelpContextIds.MAPPING_JOIN_TABLE_NAME);
-
- this.overrideDefaultJoinColumnsCheckBox =
- getWidgetFactory().createButton(
- composite,
- JptUiMappingsMessages.JoinTableComposite_overrideDefaultJoinColumns,
- SWT.CHECK);
- this.overrideDefaultJoinColumnsCheckBox.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- // do nothing
- }
-
- public void widgetSelected(SelectionEvent e) {
- if (JoinTableComposite.this.overrideDefaultJoinColumnsCheckBox.getSelection()) {
- IJoinColumn defaultJoinColumn = JoinTableComposite.this.joinTable.getDefaultJoinColumns().get(0);
- String columnName = defaultJoinColumn.getDefaultName();
- String referencedColumnName = defaultJoinColumn.getDefaultReferencedColumnName();
- IJoinColumn joinColumn = JoinTableComposite.this.joinTable.createJoinColumn(0);
- JoinTableComposite.this.joinTable.getSpecifiedJoinColumns().add(joinColumn);
- joinColumn.setSpecifiedName(columnName);
- joinColumn.setSpecifiedReferencedColumnName(referencedColumnName);
- } else {
- JoinTableComposite.this.joinTable.getSpecifiedJoinColumns().clear();
- }
- }
- });
-
- this.joinColumnsComposite = new JoinColumnsComposite(composite, this.commandStack, getWidgetFactory(), JptUiMappingsMessages.JoinTableComposite_joinColumn);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- gridData.horizontalSpan = 2;
- this.joinColumnsComposite.getControl().setLayoutData(gridData);
-
- this.overrideDefaultInverseJoinColumnsCheckBox = getWidgetFactory().createButton(composite, JptUiMappingsMessages.JoinTableComposite_overrideDefaultInverseJoinColumns, SWT.CHECK);
- this.overrideDefaultInverseJoinColumnsCheckBox.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- // do nothing
- }
-
- public void widgetSelected(SelectionEvent e) {
- if (JoinTableComposite.this.overrideDefaultInverseJoinColumnsCheckBox.getSelection()) {
- IJoinColumn defaultJoinColumn = JoinTableComposite.this.joinTable.getDefaultInverseJoinColumns().get(0);
- String columnName = defaultJoinColumn.getDefaultName();
- String referencedColumnName = defaultJoinColumn.getDefaultReferencedColumnName();
- IJoinColumn joinColumn = JoinTableComposite.this.joinTable.createInverseJoinColumn(0);
- JoinTableComposite.this.joinTable.getSpecifiedInverseJoinColumns().add(joinColumn);
- joinColumn.setSpecifiedName(columnName);
- joinColumn.setSpecifiedReferencedColumnName(referencedColumnName);
- } else {
- JoinTableComposite.this.joinTable.getSpecifiedInverseJoinColumns().clear();
- }
- }
- });
- this.inverseJoinColumnsComposite = new JoinColumnsComposite(composite, this.commandStack, getWidgetFactory(), JptUiMappingsMessages.JoinTableComposite_inverseJoinColumn);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- gridData.horizontalSpan = 2;
- this.inverseJoinColumnsComposite.getControl().setLayoutData(gridData);
- }
-
- void addJoinColumn() {
- JoinColumnInJoinTableDialog dialog = new JoinColumnInJoinTableDialog(this.getControl().getShell(), this.joinTable);
- this.addJoinColumnFromDialog(dialog);
- }
-
- private void addJoinColumnFromDialog(JoinColumnInJoinTableDialog dialog) {
- if (dialog.open() != Window.OK) {
- return;
- }
- int index = this.joinTable.getJoinColumns().size();
- IJoinColumn joinColumn = this.joinTable.createJoinColumn(index);
- this.joinTable.getSpecifiedJoinColumns().add(joinColumn);
- joinColumn.setSpecifiedName(dialog.getSelectedName());
- joinColumn.setSpecifiedReferencedColumnName(dialog.getReferencedColumnName());
- }
-
- void addInverseJoinColumn() {
- InverseJoinColumnDialog dialog = new InverseJoinColumnDialog(this.getControl().getShell(), this.joinTable);
- this.addInverseJoinColumnFromDialog(dialog);
- }
-
- private void addInverseJoinColumnFromDialog(InverseJoinColumnDialog dialog) {
- if (dialog.open() != Window.OK) {
- return;
- }
- int index = this.joinTable.getInverseJoinColumns().size();
- IJoinColumn joinColumn = this.joinTable.createInverseJoinColumn(index);
- this.joinTable.getSpecifiedInverseJoinColumns().add(joinColumn);
- joinColumn.setSpecifiedName(dialog.getSelectedName());
- joinColumn.setSpecifiedReferencedColumnName(dialog.getReferencedColumnName());
- }
-
- void editJoinColumn(IJoinColumn joinColumn) {
- JoinColumnInJoinTableDialog dialog = new JoinColumnInJoinTableDialog(this.getControl().getShell(), joinColumn);
- editJoinColumnFromDialog(dialog, joinColumn);
- }
-
- private void editJoinColumnFromDialog(JoinColumnInJoinTableDialog dialog, IJoinColumn joinColumn) {
- if (dialog.open() == Window.OK) {
- editJoinColumnDialogOkd(dialog, joinColumn);
- }
- }
-
- private void editJoinColumnDialogOkd(JoinColumnInJoinTableDialog dialog, IJoinColumn joinColumn) {
- String name = dialog.getSelectedName();
- String referencedColumnName = dialog.getReferencedColumnName();
-
- if (dialog.isDefaultNameSelected()) {
- if (joinColumn.getSpecifiedName() != null) {
- joinColumn.setSpecifiedName(null);
- }
- }
- else if (joinColumn.getSpecifiedName() == null || !joinColumn.getSpecifiedName().equals(name)){
- joinColumn.setSpecifiedName(name);
- }
-
- if (dialog.isDefaultReferencedColumnNameSelected()) {
- if (joinColumn.getSpecifiedReferencedColumnName() != null) {
- joinColumn.setSpecifiedReferencedColumnName(null);
- }
- }
- else if (joinColumn.getSpecifiedReferencedColumnName() == null || !joinColumn.getSpecifiedReferencedColumnName().equals(referencedColumnName)){
- joinColumn.setSpecifiedReferencedColumnName(referencedColumnName);
- }
- }
-
-
- void editInverseJoinColumn(IJoinColumn joinColumn) {
- InverseJoinColumnDialog dialog = new InverseJoinColumnDialog(getControl().getShell(), joinColumn);
- editJoinColumnFromDialog(dialog, joinColumn);
- }
-
- protected void joinTableChanged(Notification notification) {
- if (notification.getFeatureID(IJoinTable.class) == JpaCoreMappingsPackage.IJOIN_TABLE__SPECIFIED_JOIN_COLUMNS) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- overrideDefaultJoinColumnsCheckBox.setSelection(joinTable.containsSpecifiedJoinColumns());
- }
- });
- }
- else if (notification.getFeatureID(IJoinTable.class) == JpaCoreMappingsPackage.IJOIN_TABLE__SPECIFIED_INVERSE_JOIN_COLUMNS) {
-
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- overrideDefaultInverseJoinColumnsCheckBox.setSelection(joinTable.containsSpecifiedInverseJoinColumns());
- }
- });
- }
- }
-
- protected void engageListeners() {
- if (this.joinTable != null) {
- this.joinTable.eAdapters().add(this.joinTableListener);
- this.addConnectionListener();
- }
- }
-
- protected void disengageListeners() {
- if (this.joinTable != null) {
- this.joinTable.eAdapters().remove(this.joinTableListener);
- this.removeConnectionListener();
- }
- }
-
- public void doPopulate(EObject obj) {
- this.joinTable = (IJoinTable) obj;
- if (this.joinTable == null) {
- this.joinColumnsComposite.populate(null);
- this.inverseJoinColumnsComposite.populate(null);
- this.connectionProfile = null;
- return;
- }
-
- this.tableCombo.populate(this.joinTable);
- this.joinColumnsComposite.populate(new JoinColumnsOwner(this.joinTable));
- this.inverseJoinColumnsComposite.populate(new InverseJoinColumnsOwner(this.joinTable));
-
- this.overrideDefaultJoinColumnsCheckBox.setSelection(this.joinTable.containsSpecifiedJoinColumns());
- this.overrideDefaultInverseJoinColumnsCheckBox.setSelection(this.joinTable.containsSpecifiedInverseJoinColumns());
- }
-
- @Override
- protected void doPopulate() {
- this.tableCombo.populate();
- this.joinColumnsComposite.populate();
- this.inverseJoinColumnsComposite.populate();
- }
-
- @Override
- public void dispose() {
- this.tableCombo.dispose();
- this.joinColumnsComposite.dispose();
- this.inverseJoinColumnsComposite.dispose();
- super.dispose();
- }
-
- private class JoinColumnsOwner extends JpaEObject implements Owner {
-
- private IJoinTable joinTable;
-
- public JoinColumnsOwner(IJoinTable joinTable) {
- super();
- this.joinTable = joinTable;
- }
-
- public void addJoinColumn() {
- JoinTableComposite.this.addJoinColumn();
- }
-
- public boolean containsSpecifiedJoinColumns() {
- return this.joinTable.containsSpecifiedJoinColumns();
- }
-
- public IJoinColumn createJoinColumn(int index) {
- return this.joinTable.createJoinColumn(index);
- }
-
- public List<IJoinColumn> getJoinColumns() {
- return this.joinTable.getJoinColumns();
- }
-
- public List<IJoinColumn> getSpecifiedJoinColumns() {
- return this.joinTable.getSpecifiedJoinColumns();
- }
-
- public int specifiedJoinColumnsFeatureId() {
- return JpaCoreMappingsPackage.IJOIN_TABLE__SPECIFIED_JOIN_COLUMNS;
- }
-
- public Class owningFeatureClass() {
- return IJoinTable.class;
- }
-
- public void editJoinColumn(IJoinColumn joinColumn) {
- JoinTableComposite.this.editJoinColumn(joinColumn);
- }
-
- public EObject getEObject() {
- return this.joinTable;
- }
- }
-
- private class InverseJoinColumnsOwner extends JpaEObject implements Owner {
-
- private IJoinTable joinTable;
-
- public InverseJoinColumnsOwner(IJoinTable joinTable) {
- super();
- this.joinTable = joinTable;
- }
-
- public void addJoinColumn() {
- JoinTableComposite.this.addInverseJoinColumn();
- }
-
- public boolean containsSpecifiedJoinColumns() {
- return this.joinTable.containsSpecifiedInverseJoinColumns();
- }
-
- public IJoinColumn createJoinColumn(int index) {
- return this.joinTable.createJoinColumn(index);
- }
-
- public List<IJoinColumn> getJoinColumns() {
- return this.joinTable.getInverseJoinColumns();
- }
-
- public List<IJoinColumn> getSpecifiedJoinColumns() {
- return this.joinTable.getSpecifiedInverseJoinColumns();
- }
-
- public int specifiedJoinColumnsFeatureId() {
- return JpaCoreMappingsPackage.IJOIN_TABLE__SPECIFIED_INVERSE_JOIN_COLUMNS;
- }
-
- public Class owningFeatureClass() {
- return IJoinTable.class;
- }
-
- public void editJoinColumn(IJoinColumn joinColumn) {
- JoinTableComposite.this.editInverseJoinColumn(joinColumn);
- }
-
- public EObject getEObject() {
- return this.joinTable;
- }
- }
-
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/LobCheckBox.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/LobCheckBox.java
deleted file mode 100644
index ab6f383ac9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/LobCheckBox.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.mappings.details;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.mappings.IBasic;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.ui.internal.details.BaseJpaController;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-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.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class LobCheckBox extends BaseJpaController
-{
- private IBasic basicMapping;
- private Adapter basicMappingListener;
-
- private Button button;
-
-
- public LobCheckBox(Composite parent, CommandStack theCommandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, theCommandStack, widgetFactory);
- buildBasicMappingListener();
- }
-
- private void buildBasicMappingListener() {
- this.basicMappingListener = new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- basicMappingChanged(notification);
- }
- };
- }
-
- @Override
- protected void buildWidget(Composite parent) {
- this.button = getWidgetFactory().createButton(
- parent,
- JptUiMappingsMessages.BasicGeneralSection_lobLabel,
- SWT.CHECK);
-
- this.button.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent event) {
- LobCheckBox.this.lobSelectionChanged();
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- LobCheckBox.this.lobSelectionChanged();
- }
- });
- }
-
- void lobSelectionChanged() {
- boolean lob = this.button.getSelection();
- if (this.basicMapping.isLob() != lob) {
- this.basicMapping.setLob(lob);
- }
- }
-
- private void basicMappingChanged(Notification notification) {
- // ui thread
- if (notification.getFeatureID(IBasic.class) ==
- JpaCoreMappingsPackage.IBASIC__LOB) {
- Display.getDefault().asyncExec(
- new Runnable() {
- public void run() {
- populate();
- }
- });
- }
- }
-
- @Override
- protected void engageListeners() {
- if (this.basicMapping != null) {
- this.basicMapping.eAdapters().add(this.basicMappingListener);
- }
- }
-
- @Override
- protected void disengageListeners() {
- if (this.basicMapping != null) {
- this.basicMapping.eAdapters().remove(this.basicMappingListener);
- }
- }
-
- @Override
- public void doPopulate(EObject obj) {
- this.basicMapping = (IBasic) obj;
- populateButton();
- }
-
- @Override
- protected void doPopulate() {
- populateButton();
- }
-
- private void populateButton() {
- boolean lob = false;
- if (this.basicMapping != null) {
- lob = this.basicMapping.isLob();
- }
-
- if (this.button.getSelection() != lob) {
- this.button.setSelection(lob);
- }
- }
-
-
- @Override
- public Control getControl() {
- return this.button;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/ManyToManyComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/ManyToManyComposite.java
deleted file mode 100644
index eafd64e845..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/ManyToManyComposite.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.mappings.details;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.mappings.IManyToMany;
-import org.eclipse.jpt.ui.internal.details.BaseJpaComposite;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.forms.widgets.ExpandableComposite;
-import org.eclipse.ui.forms.widgets.Section;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class ManyToManyComposite extends BaseJpaComposite
-{
- private IManyToMany manyToMany;
-
- private TargetEntityChooser targetEntityChooser;
-
- private EnumComboViewer fetchTypeComboViewer;
-
- private MappedByCombo mappedByCombo;
-
- private CascadeComposite cascadeComposite;
-
- private OrderingComposite orderingComposite;
-
- private JoinTableComposite joinTableComposite;
-
-
- public ManyToManyComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, SWT.NULL, commandStack, widgetFactory);
- }
-
-
- @Override
- protected void initializeLayout(Composite composite) {
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- composite.setLayout(layout);
-
- Control generalControl = buildGeneralComposite(composite);
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- generalControl.setLayoutData(gridData);
-
- Control joinTableControl = buildJoinTableControl(composite);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- joinTableControl.setLayoutData(gridData);
- }
-
- private Control buildGeneralComposite(Composite composite) {
-// IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
-
- Composite generalComposite = getWidgetFactory().createComposite(composite);
- GridLayout layout = new GridLayout(2, false);
- layout.marginWidth = 0;
- generalComposite.setLayout(layout);
-
- this.targetEntityChooser = CommonWidgets.buildTargetEntityChooser(generalComposite, this.commandStack, getWidgetFactory());
- GridData gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- gridData.horizontalSpan = 2;
- this.targetEntityChooser.getControl().setLayoutData(gridData);
-
-
- CommonWidgets.buildFetchLabel(generalComposite, getWidgetFactory());
- this.fetchTypeComboViewer = CommonWidgets.buildEnumComboViewer(generalComposite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.fetchTypeComboViewer.getControl().setLayoutData(gridData);
-
-
- CommonWidgets.buildMappedByLabel(generalComposite, getWidgetFactory());
- this.mappedByCombo = new MappedByCombo(generalComposite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.mappedByCombo.getControl().setLayoutData(gridData);
-
- this.cascadeComposite = new CascadeComposite(generalComposite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalSpan = 3;
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- this.cascadeComposite.getControl().setLayoutData(gridData);
-
-
- this.orderingComposite = new OrderingComposite(composite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalSpan = 3;
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- this.orderingComposite.getControl().setLayoutData(gridData);
-
- return generalComposite;
- }
-
- private Control buildJoinTableControl(Composite composite) {
- Section section = getWidgetFactory().createSection(composite, SWT.FLAT | ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR);
- section.setText(JptUiMappingsMessages.MultiRelationshipMappingComposite_joinTable);
-
- Composite joinTableClient = getWidgetFactory().createComposite(section);
- section.setClient(joinTableClient);
-
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- joinTableClient.setLayout(layout);
-
- this.joinTableComposite = new JoinTableComposite(joinTableClient, this.commandStack, getWidgetFactory());
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- this.joinTableComposite.getControl().setLayoutData(gridData);
-
- return section;
- }
-
- public void doPopulate(EObject obj) {
- this.manyToMany = (IManyToMany) obj;
- this.targetEntityChooser.populate(this.manyToMany);
- this.fetchTypeComboViewer.populate(CommonWidgets.buildMultiRelationshipMappingFetchEnumHolder(this.manyToMany));
- this.mappedByCombo.populate(this.manyToMany);
- this.cascadeComposite.populate(this.manyToMany);
- if (this.manyToMany != null) {
- this.joinTableComposite.populate(this.manyToMany.getJoinTable());
- this.orderingComposite.populate(this.manyToMany);
- }
- else {
- this.joinTableComposite.populate(null);
- this.orderingComposite.populate(null);
- }
- }
-
- public void doPopulate() {
- this.targetEntityChooser.populate();
- this.fetchTypeComboViewer.populate();
- this.mappedByCombo.populate();
- this.cascadeComposite.populate();
- this.joinTableComposite.populate();
- this.orderingComposite.populate();
- }
-
- protected void engageListeners() {
- }
-
- protected void disengageListeners() {
- }
-
- @Override
- public void dispose() {
- this.targetEntityChooser.dispose();
- this.fetchTypeComboViewer.dispose();
- this.mappedByCombo.dispose();
- this.cascadeComposite.dispose();
- this.joinTableComposite.dispose();
- this.orderingComposite.dispose();
- super.dispose();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/ManyToOneComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/ManyToOneComposite.java
deleted file mode 100644
index 9fb170b369..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/ManyToOneComposite.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.mappings.details;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.mappings.IManyToOne;
-import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.details.BaseJpaComposite;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.help.IWorkbenchHelpSystem;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class ManyToOneComposite extends BaseJpaComposite
-{
- private IManyToOne manyToOne;
-
- private TargetEntityChooser targetEntityChooser;
-
- private EnumComboViewer fetchTypeComboViewer;
-
- private EnumComboViewer optionalComboViewer;
-
- private CascadeComposite cascadeComposite;
-
- private JoinColumnComposite joinColumnComposite;
-
- public ManyToOneComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, SWT.NULL, commandStack, widgetFactory);
- }
-
-
- @Override
- protected void initializeLayout(Composite composite) {
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- composite.setLayout(layout);
-
- Control generalControl = buildGeneralComposite(composite);
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- generalControl.setLayoutData(gridData);
-
- }
-
- private Control buildGeneralComposite(Composite composite) {
- IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
-
- Composite generalComposite = getWidgetFactory().createComposite(composite);
- GridLayout layout = new GridLayout(2, false);
- layout.marginWidth = 0;
- generalComposite.setLayout(layout);
-
- this.targetEntityChooser = CommonWidgets.buildTargetEntityChooser(generalComposite, commandStack, getWidgetFactory());
- GridData gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- gridData.horizontalSpan = 2;
- this.targetEntityChooser.getControl().setLayoutData(gridData);
- helpSystem.setHelp(targetEntityChooser.getControl(), IJpaHelpContextIds.MAPPING_TARGET_ENTITY);
-
- CommonWidgets.buildFetchLabel(generalComposite, getWidgetFactory());
- this.fetchTypeComboViewer = CommonWidgets.buildEnumComboViewer(generalComposite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.fetchTypeComboViewer.getControl().setLayoutData(gridData);
- helpSystem.setHelp(fetchTypeComboViewer.getControl(), IJpaHelpContextIds.MAPPING_FETCH_TYPE);
-
- CommonWidgets.buildOptionalLabel(generalComposite, getWidgetFactory());
- this.optionalComboViewer = CommonWidgets.buildEnumComboViewer(generalComposite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.optionalComboViewer.getControl().setLayoutData(gridData);
-
- this.cascadeComposite = new CascadeComposite(generalComposite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalSpan = 3;
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- this.cascadeComposite.getControl().setLayoutData(gridData);
-
- this.joinColumnComposite = new JoinColumnComposite(generalComposite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- gridData.horizontalSpan = 2;
- this.joinColumnComposite.getControl().setLayoutData(gridData);
-
- return generalComposite;
- }
-
- public void doPopulate(EObject obj) {
- this.manyToOne = (IManyToOne) obj;
- this.targetEntityChooser.populate(this.manyToOne);
- this.fetchTypeComboViewer.populate(CommonWidgets.buildSingleRelationshipMappingFetchEnumHolder(this.manyToOne));
- this.optionalComboViewer.populate(CommonWidgets.buildOptionalHolder(this.manyToOne));
- this.cascadeComposite.populate(this.manyToOne);
- this.joinColumnComposite.populate(this.manyToOne);
- }
-
- public void doPopulate() {
- this.targetEntityChooser.populate();
- this.fetchTypeComboViewer.populate();
- this.optionalComboViewer.populate();
- this.cascadeComposite.populate();
- this.joinColumnComposite.populate();
- }
-
- protected void engageListeners() {
- }
-
- protected void disengageListeners() {
- }
-
- @Override
- public void dispose() {
- this.targetEntityChooser.dispose();
- this.fetchTypeComboViewer.dispose();
- this.optionalComboViewer.dispose();
- this.cascadeComposite.dispose();
- this.joinColumnComposite.dispose();
- super.dispose();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/MappedByCombo.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/MappedByCombo.java
deleted file mode 100644
index 593988c654..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/MappedByCombo.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 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.ui.internal.mappings.details;
-
-import java.util.Iterator;
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.mappings.INonOwningMapping;
-import org.eclipse.jpt.core.internal.mappings.IRelationshipMapping;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.details.BaseJpaController;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class MappedByCombo extends BaseJpaController
-{
- private INonOwningMapping nonOwningMapping;
- private Adapter nonOwningMappingListener;
-
- private CCombo combo;
-
- public MappedByCombo(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, commandStack, widgetFactory);
- this.nonOwningMappingListener = buildListener();
- }
-
- private Adapter buildListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- nonOwningMappingChanged(notification);
- }
- };
- }
- @Override
- protected void buildWidget(Composite parent) {
- this.combo = getWidgetFactory().createCCombo(parent, SWT.FLAT);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(combo,IJpaHelpContextIds.MAPPING_MAPPED_BY);
- this.combo.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- if (isPopulating()) {
- return;
- }
- String mappedBy = ((CCombo) e.getSource()).getText();
- if (mappedBy.equals("")) { //$NON-NLS-1$
- mappedBy = null;
- if (getNonOwningMapping().getMappedBy() == null || getNonOwningMapping().getMappedBy().equals("")) { //$NON-NLS-1$
- return;
- }
- }
- if (getNonOwningMapping().getMappedBy() == null || !getNonOwningMapping().getMappedBy().equals(mappedBy)) {
- getNonOwningMapping().setMappedBy(mappedBy);
- }
- }
- });
- }
-
- private INonOwningMapping getNonOwningMapping() {
- return this.nonOwningMapping;
- }
-
- @Override
- protected void doPopulate(EObject obj) {
- this.nonOwningMapping = (INonOwningMapping) obj;
-
- if (this.nonOwningMapping == null) {
- return;
- }
-
- populateCombo();
- }
-
- private void populateCombo() {
- populateChoices();
- populateMappedByText();
- }
-
- private void populateChoices() {
- if (this.combo.getItemCount() > 0) {
- this.combo.removeAll();
- }
- for (Iterator<String> i = this.nonOwningMapping.candidateMappedByAttributeNames(); i.hasNext(); ) {
- this.combo.add(i.next());
- }
- }
-
- private void populateMappedByText() {
- String mappedBy = this.nonOwningMapping.getMappedBy();
- if (mappedBy != null) {
- if (!this.combo.getText().equals(mappedBy)) {
- this.combo.setText(mappedBy);
- }
- }
- else {
- this.combo.setText("");
- }
- }
-
- @Override
- protected void doPopulate() {
- }
-
- @Override
- protected void engageListeners() {
- if (this.nonOwningMapping != null) {
- this.nonOwningMapping.eAdapters().add(this.nonOwningMappingListener);
- }
- }
-
- @Override
- protected void disengageListeners() {
- if (this.nonOwningMapping != null) {
- this.nonOwningMapping.eAdapters().remove(this.nonOwningMappingListener);
- }
- }
-
- protected void nonOwningMappingChanged(Notification notification) {
- if (notification.getFeatureID(INonOwningMapping.class) == JpaCoreMappingsPackage.INON_OWNING_MAPPING__MAPPED_BY) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- populateMappedByText();
- }
- });
- }
- else if (notification.getFeatureID(IRelationshipMapping.class) == JpaCoreMappingsPackage.IRELATIONSHIP_MAPPING__RESOLVED_TARGET_ENTITY) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- populateChoices();
- }
- });
- }
- }
-
- @Override
- public Control getControl() {
- return this.combo;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/MappedSuperclassComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/MappedSuperclassComposite.java
deleted file mode 100644
index 4f9f7186a8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/MappedSuperclassComposite.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.mappings.details;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.ui.internal.details.BaseJpaComposite;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class MappedSuperclassComposite extends BaseJpaComposite
-{
-// private IMappedSuperclass mappedSuperclass;
-// private Adapter mappedSuperclassListener;
-
- public MappedSuperclassComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, SWT.NULL, commandStack, widgetFactory);
-// this.mappedSuperclassListener = buildMappedSuperclassListener();
- }
-//
-// private Adapter buildMappedSuperclassListener() {
-// return new AdapterImpl() {
-// @Override
-// public void notifyChanged(Notification notification) {
-// mappedSuperclassChanged(notification);
-// }
-// };
-// }
-
- @Override
- protected void initializeLayout(Composite composite) {
- composite.setLayout(new FillLayout(SWT.VERTICAL));
-
-// Label accessTypeLabel = new Label(composite, SWT.LEFT);
-// accessTypeLabel.setText(DaliUiMessages.MappedSuperclassComposite_accessType);
-// this.accessTypeComboViewer = buildAccessTypeCombo(composite);
-// //eventually this will be enabled if editing xml instead of java
-// this.accessTypeComboViewer.getCombo().setEnabled(false);
-// GridData gridData = new GridData();
-// gridData.horizontalAlignment = GridData.FILL;
-// gridData.grabExcessHorizontalSpace = true;
-// this.accessTypeComboViewer.getCombo().setLayoutData(gridData);
-// PlatformUI.getWorkbench().getHelpSystem().setHelp(this.accessTypeComboViewer.getCombo(), IDaliHelpContextIds.ENTITY_ACCESS_TYPE);
-
- }
-
-// private ComboViewer buildAccessTypeCombo(Composite parent) {
-// ComboViewer viewer = new ComboViewer(parent, SWT.READ_ONLY);
-// viewer.add(AccessType.VALUES.toArray());
-// viewer.addSelectionChangedListener(new ISelectionChangedListener() {
-// public void selectionChanged(SelectionChangedEvent event) {
-// if (populating) {
-// return;
-// }
-// if (event.getSelection() instanceof StructuredSelection) {
-// StructuredSelection selection = (StructuredSelection) event.getSelection();
-// editingDomain.getCommandStack().execute(SetCommand.create(editingDomain, persistentType, OrmPackage.eINSTANCE.getPersistentType_AccessType(), selection.getFirstElement()));
-// }
-// }
-// });
-// return viewer;
-// }
-
- @Override
- protected void doPopulate(EObject model) {
-// this.mappedSuperclass = (IMappedSuperclass) model;
- }
-
- @Override
- protected void doPopulate() {
-
- }
-
-
- protected void engageListeners() {
-// this.persistentTypeItemProvider.addListener(getPersistentTypeListener());
-// this.persistentType.eAdapters().add(this.persistentTypeItemProvider);
- }
-
- protected void disengageListeners() {
-// if (this.persistentType != null){
-// this.persistentType.eAdapters().remove(this.persistentTypeItemProvider);
-// this.persistentTypeItemProvider.removeListener(getPersistentTypeListener());
-// }
- }
-
-// private INotifyChangedListener getPersistentTypeListener() {
-// if (this.persistentTypeListener == null) {
-// this.persistentTypeListener = new INotifyChangedListener() {
-// public void notifyChanged(Notification notification) {
-// if (notification.getFeatureID(PersistentType.class) == OrmPackage.PERSISTENT_TYPE__ACCESS_TYPE) {
-// final AccessType accessType = (AccessType) notification.getNewValue();
-// Display.getDefault().syncExec(new Runnable() {
-// public void run() {
-// if (((StructuredSelection) accessTypeComboViewer.getSelection()).getFirstElement() != accessType) {
-// accessTypeComboViewer.setSelection(new StructuredSelection(accessType));
-// }
-// }
-// });
-// }
-// }
-// };
-// }
-// return this.persistentTypeListener;
-// }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/OneToManyComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/OneToManyComposite.java
deleted file mode 100644
index d7193b6db2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/OneToManyComposite.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.mappings.details;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.mappings.IOneToMany;
-import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.details.BaseJpaComposite;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.forms.widgets.ExpandableComposite;
-import org.eclipse.ui.forms.widgets.Section;
-import org.eclipse.ui.help.IWorkbenchHelpSystem;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class OneToManyComposite extends BaseJpaComposite
-{
- private IOneToMany oneToMany;
-
- private EnumComboViewer fetchTypeComboViewer;
-
- private TargetEntityChooser targetEntityChooser;
-
- private MappedByCombo mappedByCombo;
-
- private CascadeComposite cascadeComposite;
-
- private OrderingComposite orderingComposite;
-
- private JoinTableComposite joinTableComposite;
-
- public OneToManyComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, SWT.NULL, commandStack, widgetFactory);
- }
-
-
- @Override
- protected void initializeLayout(Composite composite) {
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- composite.setLayout(layout);
-
- Control generalControl = buildGeneralControl(composite);
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- generalControl.setLayoutData(gridData);
-
- Control joinTableControl = buildJoinTableControl(composite);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- joinTableControl.setLayoutData(gridData);
- }
-
- private Control buildGeneralControl(Composite composite) {
- IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
-
- Composite generalComposite = getWidgetFactory().createComposite(composite);
- GridLayout layout = new GridLayout(2, false);
- layout.marginWidth = 0;
- generalComposite.setLayout(layout);
-
- GridData gridData;
-
- this.targetEntityChooser = CommonWidgets.buildTargetEntityChooser(generalComposite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- gridData.horizontalSpan = 2;
- this.targetEntityChooser.getControl().setLayoutData(gridData);
-
- CommonWidgets.buildFetchLabel(generalComposite, getWidgetFactory());
- this.fetchTypeComboViewer = CommonWidgets.buildEnumComboViewer(generalComposite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.fetchTypeComboViewer.getControl().setLayoutData(gridData);
- helpSystem.setHelp(this.fetchTypeComboViewer.getControl(), IJpaHelpContextIds.MAPPING_FETCH_TYPE);
-
- CommonWidgets.buildMappedByLabel(generalComposite, getWidgetFactory());
- this.mappedByCombo = new MappedByCombo(generalComposite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.mappedByCombo.getControl().setLayoutData(gridData);
- helpSystem.setHelp(this.mappedByCombo.getControl(), IJpaHelpContextIds.MAPPING_MAPPED_BY);
-
- this.cascadeComposite = new CascadeComposite(generalComposite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalSpan = 3;
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- this.cascadeComposite.getControl().setLayoutData(gridData);
-
- this.orderingComposite = new OrderingComposite(generalComposite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalSpan = 3;
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- this.orderingComposite.getControl().setLayoutData(gridData);
-
-
- return generalComposite;
- }
-
- private Control buildJoinTableControl(Composite composite) {
- Section section = getWidgetFactory().createSection(composite, SWT.FLAT | ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR);
- section.setText(JptUiMappingsMessages.MultiRelationshipMappingComposite_joinTable);
-
- Composite joinTableClient = getWidgetFactory().createComposite(section);
- section.setClient(joinTableClient);
-
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- joinTableClient.setLayout(layout);
-
- this.joinTableComposite = new JoinTableComposite(joinTableClient, this.commandStack, getWidgetFactory());
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- this.joinTableComposite.getControl().setLayoutData(gridData);
-
- return section;
- }
-
- public void doPopulate(EObject obj) {
- this.oneToMany = (IOneToMany) obj;
- this.fetchTypeComboViewer.populate(CommonWidgets.buildMultiRelationshipMappingFetchEnumHolder(this.oneToMany));
- this.targetEntityChooser.populate(this.oneToMany);
- this.mappedByCombo.populate(this.oneToMany);
- this.cascadeComposite.populate(this.oneToMany);
- if (this.oneToMany != null) {
- this.joinTableComposite.populate(this.oneToMany.getJoinTable());
- this.orderingComposite.populate(this.oneToMany);
- }
- else {
- this.joinTableComposite.populate(null);
- this.orderingComposite.populate(null);
- }
- }
-
- public void doPopulate() {
- this.fetchTypeComboViewer.populate();
- this.targetEntityChooser.populate();
- this.mappedByCombo.populate();
- this.cascadeComposite.populate();
- this.joinTableComposite.populate();
- this.orderingComposite.populate();
- }
-
- protected void engageListeners() {
- }
-
- protected void disengageListeners() {
- }
-
- @Override
- public void dispose() {
- this.fetchTypeComboViewer.dispose();
- this.targetEntityChooser.dispose();
- this.mappedByCombo.dispose();
- this.cascadeComposite.dispose();
- this.joinTableComposite.dispose();
- this.orderingComposite.dispose();
- super.dispose();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/OneToOneComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/OneToOneComposite.java
deleted file mode 100644
index 6894ac5836..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/OneToOneComposite.java
+++ /dev/null
@@ -1,226 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.mappings.details;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.mappings.IOneToOne;
-import org.eclipse.jpt.ui.internal.details.BaseJpaComposite;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class OneToOneComposite extends BaseJpaComposite
-{
- private IOneToOne oneToOne;
-
- private TargetEntityChooser targetEntityChooser;
-
- private EnumComboViewer fetchTypeComboViewer;
-
- private MappedByCombo mappedByCombo;
-
- private EnumComboViewer optionalComboViewer;
-
- private CascadeComposite cascadeComposite;
-
- private JoinColumnComposite joinColumnComposite;
-
- public OneToOneComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, SWT.NULL, commandStack, widgetFactory);
- }
-
- protected IOneToOne getOneToOne() {
- return this.oneToOne;
- }
-
- @Override
- protected void initializeLayout(Composite composite) {
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- composite.setLayout(layout);
-
- Control generalControl = buildGeneralComposite(composite);
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- generalControl.setLayoutData(gridData);
-
- }
-
- protected Control buildGeneralComposite(Composite composite) {
-// IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
-
- Composite generalComposite = getWidgetFactory().createComposite(composite);
- GridLayout layout = new GridLayout(2, false);
- layout.marginWidth = 0;
- generalComposite.setLayout(layout);
-
- TargetEntityChooser targetEntityChooser = getTargetEntityChooser(generalComposite);
- GridData gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- gridData.horizontalSpan = 2;
- targetEntityChooser.getControl().setLayoutData(gridData);
-
-
- CommonWidgets.buildFetchLabel(generalComposite, getWidgetFactory());
- EnumComboViewer fetchTypeComboViewer = getFetchTypeComboViewer(generalComposite);
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- fetchTypeComboViewer.getControl().setLayoutData(gridData);
-
- CommonWidgets.buildMappedByLabel(generalComposite, getWidgetFactory());
- MappedByCombo mappedByCombo = getMappedByCombo(generalComposite);
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- mappedByCombo.getControl().setLayoutData(gridData);
-
- CommonWidgets.buildOptionalLabel(generalComposite, getWidgetFactory());
- EnumComboViewer optionalComboViewer = getOptionalComboViewer(generalComposite);
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- optionalComboViewer.getControl().setLayoutData(gridData);
-
- CascadeComposite cascadeComposite = getCascadeComposite(generalComposite);
- gridData = new GridData();
- gridData.horizontalSpan = 3;
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- cascadeComposite.getControl().setLayoutData(gridData);
-
- JoinColumnComposite joinColumnComposite = getJoinColumnComposite(generalComposite);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- gridData.horizontalSpan = 2;
- joinColumnComposite.getControl().setLayoutData(gridData);
-
- return generalComposite;
- }
-
- protected TargetEntityChooser getTargetEntityChooser(Composite parentComposite) {
- if (this.targetEntityChooser == null) {
- this.targetEntityChooser = createTargetEntityChooser(parentComposite);
- }
- return this.targetEntityChooser;
- }
-
- protected TargetEntityChooser createTargetEntityChooser(Composite parentComposite) {
- return CommonWidgets.buildTargetEntityChooser(parentComposite, this.commandStack, getWidgetFactory());
- }
-
- protected EnumComboViewer getFetchTypeComboViewer(Composite parentComposite) {
- if (this.fetchTypeComboViewer == null) {
- this.fetchTypeComboViewer = createFetchTypeComboViewer(parentComposite);
- }
- return this.fetchTypeComboViewer;
- }
-
- protected EnumComboViewer createFetchTypeComboViewer(Composite parentComposite) {
- return CommonWidgets.buildEnumComboViewer(parentComposite, this.commandStack, getWidgetFactory());
- }
-
- protected MappedByCombo getMappedByCombo(Composite parentComposite) {
- if (this.mappedByCombo == null) {
- this.mappedByCombo = createMappedByCombo(parentComposite);
- }
- return this.mappedByCombo;
- }
-
- protected MappedByCombo createMappedByCombo(Composite parentComposite) {
- return new MappedByCombo(parentComposite, this.commandStack, getWidgetFactory());
- }
-
- protected EnumComboViewer getOptionalComboViewer(Composite parentComposite) {
- if (this.optionalComboViewer == null) {
- this.optionalComboViewer = createOptionalComboViewer(parentComposite);
- }
- return this.optionalComboViewer;
- }
-
- protected EnumComboViewer createOptionalComboViewer(Composite parentComposite) {
- return CommonWidgets.buildEnumComboViewer(parentComposite, this.commandStack, getWidgetFactory());
- }
-
- protected CascadeComposite getCascadeComposite(Composite parentComposite) {
- if (this.cascadeComposite == null) {
- this.cascadeComposite = createCascadeComposite(parentComposite);
- }
- return this.cascadeComposite;
- }
-
- protected CascadeComposite createCascadeComposite(Composite parentComposite) {
- return new CascadeComposite(parentComposite, this.commandStack, getWidgetFactory());
- }
-
- protected JoinColumnComposite getJoinColumnComposite(Composite parentComposite) {
- if (this.joinColumnComposite == null) {
- this.joinColumnComposite = createJoinColumnComposite(parentComposite);
- }
- return this.joinColumnComposite;
- }
-
- protected JoinColumnComposite createJoinColumnComposite(Composite parentComposite) {
- return new JoinColumnComposite(parentComposite, this.commandStack, getWidgetFactory());
- }
-
-
- public void doPopulate(EObject obj) {
- this.oneToOne = (IOneToOne) obj;
- this.targetEntityChooser.populate(getOneToOne());
- this.fetchTypeComboViewer.populate(CommonWidgets.buildSingleRelationshipMappingFetchEnumHolder(getOneToOne()));
- this.mappedByCombo.populate(getOneToOne());
- this.optionalComboViewer.populate(CommonWidgets.buildOptionalHolder(getOneToOne()));
- this.cascadeComposite.populate(getOneToOne());
- this.joinColumnComposite.populate(getOneToOne());
- }
-
- public void doPopulate() {
- this.targetEntityChooser.populate();
- this.fetchTypeComboViewer.populate();
- this.mappedByCombo.populate();
- this.optionalComboViewer.populate();
- this.cascadeComposite.populate();
- this.joinColumnComposite.populate();
- }
-
- protected void engageListeners() {
- }
-
- protected void disengageListeners() {
- }
-
- @Override
- public void dispose() {
- this.targetEntityChooser.dispose();
- this.fetchTypeComboViewer.dispose();
- this.mappedByCombo.dispose();
- this.optionalComboViewer.dispose();
- this.cascadeComposite.dispose();
- this.joinColumnComposite.dispose();
- super.dispose();
- }
-
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/OrderingComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/OrderingComposite.java
deleted file mode 100644
index 95b1bc6284..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/OrderingComposite.java
+++ /dev/null
@@ -1,309 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.mappings.details;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jface.text.Document;
-import org.eclipse.jface.text.ITextListener;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.TextEvent;
-import org.eclipse.jface.text.TextViewer;
-import org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.details.BaseJpaComposite;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.help.IWorkbenchHelpSystem;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-/**
- *
- */
-public class OrderingComposite extends BaseJpaComposite {
-
- private IMultiRelationshipMapping mapping;
- private Adapter mappingListener;
-
- private Button noOrderingRadioButton;
- private Button primaryKeyOrderingRadioButton;
- private Button customOrderingRadioButton;
-
- private ITextViewer orderingTextViewer;
-
- // short circuit flag for user typing
- private boolean updatingCustomOrderBy = false;
-
-
- public OrderingComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, commandStack, widgetFactory);
- this.mappingListener = buildMappingListener();
- }
-
- private Adapter buildMappingListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- mappingChanged(notification);
- }
- };
- }
-
- @Override
- protected void initializeLayout(Composite composite) {
- IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
-
- GridLayout layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- composite.setLayout(layout);
-
- Group orderByGroup = getWidgetFactory().createGroup(composite, JptUiMappingsMessages.OrderByComposite_orderByGroup);
- orderByGroup.setLayout(new GridLayout(1, false));
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- orderByGroup.setLayoutData(gridData);
- helpSystem.setHelp(orderByGroup, IJpaHelpContextIds.MAPPING_ORDER_BY);
-
-
- this.noOrderingRadioButton = buildNoOrderingRadioButton(orderByGroup);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- this.noOrderingRadioButton.setLayoutData(gridData);
-// helpSystem().setHelp(this.noOrderingRadioButton, IJpaHelpContextIds.MAPPING_ORDER_BY_NO_ORDERING);
-
-
- this.primaryKeyOrderingRadioButton = buildPrimaryKeyOrderingRadioButton(orderByGroup);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- this.primaryKeyOrderingRadioButton.setLayoutData(gridData);
-// helpSystem().setHelp(this.primaryKeyOrderingRadioButton, IJpaHelpContextIds.MAPPING_ORDER_BY_PRIMARY_KEY_ORDERING);
-
- this.customOrderingRadioButton = buildCustomOrderingRadioButton(orderByGroup);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- this.customOrderingRadioButton.setLayoutData(gridData);
-// helpSystem().setHelp(this.customOrderingRadioButton, IJpaHelpContextIds.MAPPING_ORDER_BY_CUSTOM_ORDERING);
-
-
- this.orderingTextViewer = buildOrderByTestViewer(orderByGroup);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.horizontalIndent = 15;
- this.orderingTextViewer.getTextWidget().setLayoutData(gridData);
- helpSystem.setHelp(this.orderingTextViewer.getTextWidget(), IJpaHelpContextIds.MAPPING_ORDER_BY);
- }
-
- private Button buildNoOrderingRadioButton(Composite parent) {
- Button button = getWidgetFactory().createButton(
- parent,
- JptUiMappingsMessages.OrderByComposite_noOrdering,
- SWT.RADIO);
- button.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- // ignore
- }
- public void widgetSelected(SelectionEvent e) {
- OrderingComposite.this.noOrderingRadioButtonSelected(e);
- }
- });
-
- return button;
- }
-
- void noOrderingRadioButtonSelected(SelectionEvent e) {
- if (!((Button) e.widget).getSelection()) {
- //ignore case where radio button is deselected
- return;
- }
- if (this.mapping.isNoOrdering()) {
- return;
- }
- this.mapping.setNoOrdering();
- }
-
- private Button buildPrimaryKeyOrderingRadioButton(Composite parent) {
- Button button = getWidgetFactory().createButton(
- parent,
- JptUiMappingsMessages.OrderByComposite_primaryKeyOrdering,
- SWT.RADIO);
- button.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- // ignore
- }
- public void widgetSelected(SelectionEvent e) {
- OrderingComposite.this.primaryKeyOrderingRadioButtonSelected(e);
- }
- });
- return button;
- }
-
- void primaryKeyOrderingRadioButtonSelected(SelectionEvent e) {
- if (!((Button) e.widget).getSelection()) {
- //ignore case where radio button is deselected
- return;
- }
- if (! this.mapping.isOrderByPk()) {
- this.mapping.setOrderByPk();
- }
- setTextViewerEnabled(false);
- }
-
- private Button buildCustomOrderingRadioButton(Composite parent) {
- Button button = getWidgetFactory().createButton(
- parent,
- JptUiMappingsMessages.OrderByComposite_customOrdering,
- SWT.RADIO);
- button.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- // ignore
- }
- public void widgetSelected(SelectionEvent e) {
- OrderingComposite.this.customOrderingRadioButtonSelected(e);
- }
- });
-
- return button;
- }
-
- void customOrderingRadioButtonSelected(SelectionEvent e) {
- if (!((Button) e.widget).getSelection()) {
- //ignore case where radio button is deselected
- return;
- }
- setTextViewerEnabled(true);
- }
-
- private ITextViewer buildOrderByTestViewer(Composite parent) {
- final TextViewer textViewer = new TextViewer(parent, SWT.SINGLE | SWT.BORDER);
- textViewer.setDocument(new Document());
- textViewer.addTextListener(new ITextListener() {
- public void textChanged(TextEvent event) {
- orderingTextViewerChanged();
- }
- });
- return textViewer;
- }
-
- private void orderingTextViewerChanged() {
- if (isPopulating()) {
- return;
- }
- String orderByValue = this.orderingTextViewer.getDocument().get();
- if (orderByValue.equals(this.mapping.getOrderBy())) {
- return;
- }
-
- this.updatingCustomOrderBy = true;
- this.mapping.setOrderBy(orderByValue);
- }
-
- private void setTextViewerEnabled(boolean enabled) {
- this.orderingTextViewer.setEditable(enabled);
- this.orderingTextViewer.getTextWidget().setEnabled(enabled);
- }
-
- private void mappingChanged(Notification notification) {
- if (notification.getFeatureID(IMultiRelationshipMapping.class) == JpaCoreMappingsPackage.IMULTI_RELATIONSHIP_MAPPING__ORDER_BY) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- populate();
- }
- });
- }
- }
-
- @Override
- protected void doPopulate(EObject obj) {
- this.mapping = (IMultiRelationshipMapping) obj;
- if (this.mapping == null) {
- return;
- }
- populateOrderingRadioButtons();
- }
-
- @Override
- protected void doPopulate() {
- populateOrderingRadioButtons();
- }
-
- @Override
- protected void engageListeners() {
- if (this.mapping != null) {
- this.mapping.eAdapters().add(this.mappingListener);
- }
- }
-
- @Override
- protected void disengageListeners() {
- if (this.mapping != null) {
- this.mapping.eAdapters().remove(this.mappingListener);
- }
- }
-
- private void populateOrderingRadioButtons() {
- // short circuit if user is typing
- if (updatingCustomOrderBy) {
- updatingCustomOrderBy = false;
- return;
- }
-
- if (this.mapping.isNoOrdering()) {
- this.primaryKeyOrderingRadioButton.setSelection(false);
- this.customOrderingRadioButton.setSelection(false);
- this.noOrderingRadioButton.setSelection(true);
- if (! "".equals(this.orderingTextViewer.getDocument().get())) {
- this.orderingTextViewer.getDocument().set("");
- }
- }
- else if (this.mapping.isOrderByPk()) {
- this.customOrderingRadioButton.setSelection(false);
- this.noOrderingRadioButton.setSelection(false);
- this.primaryKeyOrderingRadioButton.setSelection(true);
-// String value = this.ordering.getValue();
-// if (value != null && !value.equals(this.orderingTextViewer.getDocument().get())) {
-// this.orderingTextViewer.getDocument().set(value);
-// }
-// else {
- if (!"".equals(this.orderingTextViewer.getDocument().get())) {
- this.orderingTextViewer.getDocument().set("");
- }
-// }
- }
- else if (this.mapping.isCustomOrdering()) {
- this.noOrderingRadioButton.setSelection(false);
- this.primaryKeyOrderingRadioButton.setSelection(false);
- this.customOrderingRadioButton.setSelection(true);
- String value = this.mapping.getOrderBy();
- if (value != null && !value.equals(this.orderingTextViewer.getDocument().get())) {
- this.orderingTextViewer.getDocument().set(value);
- }
- }
-
- setTextViewerEnabled(this.mapping.isCustomOrdering());
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/OverridesComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/OverridesComposite.java
deleted file mode 100644
index 986aab26e1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/OverridesComposite.java
+++ /dev/null
@@ -1,501 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.mappings.details;
-
-import java.util.List;
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jface.viewers.IContentProvider;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.ListViewer;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jpt.core.internal.JpaEObject;
-import org.eclipse.jpt.core.internal.mappings.IAssociationOverride;
-import org.eclipse.jpt.core.internal.mappings.IAttributeOverride;
-import org.eclipse.jpt.core.internal.mappings.IEntity;
-import org.eclipse.jpt.core.internal.mappings.IJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.IOverride;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.details.BaseJpaComposite;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.mappings.details.JoinColumnsComposite.Owner;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.part.PageBook;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class OverridesComposite extends BaseJpaComposite
-{
- private ListViewer listViewer;
-
- private IEntity entity;
- private Adapter entityListener;
-
- private IOverride selectedOverride;
- private Adapter overrideListener;
-
- protected PageBook overridePageBook;
-
- protected ColumnComposite columnComposite;
- protected JoinColumnsComposite joinColumnsComposite;
-
- private Button overrideDefaultButton;
-
- public OverridesComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, SWT.NULL, commandStack, widgetFactory);
- this.entityListener = buildEntityListener();
- this.overrideListener = buildOverrideListener();
- }
-
- private Adapter buildEntityListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- entityChanged(notification);
- }
- };
- }
-
- private Adapter buildOverrideListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- overrideChanged(notification);
- }
- };
- }
-
-
- @Override
- protected void initializeLayout(Composite composite) {
- GridLayout layout = new GridLayout(2, false);
- layout.marginWidth = 0;
- composite.setLayout(layout);
-
- Group attributeOverridesGroup = getWidgetFactory().createGroup(
- composite, JptUiMappingsMessages.AttributeOverridesComposite_attributeOverrides);
- attributeOverridesGroup.setLayout(new GridLayout(2, true));
- GridData gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace= true;
- attributeOverridesGroup.setLayoutData(gridData);
-
- this.listViewer = buildAttributeOverridesListViewer(attributeOverridesGroup);
- gridData = new GridData();
- gridData.verticalSpan = 2;
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace= true;
- this.listViewer.getList().setLayoutData(gridData);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this.listViewer.getList(), IJpaHelpContextIds.ENTITY_ATTRIBUTE_OVERRIDES);
-
- this.overrideDefaultButton =
- getWidgetFactory().createButton(
- attributeOverridesGroup,
- JptUiMappingsMessages.AttributeOverridesComposite_overridDefault,
- SWT.CHECK);
- this.overrideDefaultButton.addSelectionListener(buildOverrideDefaultSelectionListener());
- gridData = new GridData();
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- gridData.horizontalAlignment = SWT.FILL;
- this.overrideDefaultButton.setLayoutData(gridData);
-
-
- this.overridePageBook = buildOverridePageBook(attributeOverridesGroup);
- gridData = new GridData();
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- gridData.horizontalAlignment = SWT.FILL;
- this.overridePageBook.setLayoutData(gridData);
-
- this.joinColumnsComposite = new JoinColumnsComposite(this.overridePageBook, this.commandStack, getWidgetFactory(), JptUiMappingsMessages.OverridesComposite_joinColumn);
- this.columnComposite = new ColumnComposite(this.overridePageBook, this.commandStack, getWidgetFactory());
- this.overridePageBook.showPage(this.joinColumnsComposite.getControl());
- }
-
- protected PageBook buildOverridePageBook(Composite parent) {
- return new PageBook(parent, SWT.NONE);
- }
-
- private SelectionListener buildOverrideDefaultSelectionListener() {
- return new SelectionListener(){
-
- public void widgetSelected(SelectionEvent e) {
- overrideDefaultButtonSelected(e);
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- overrideDefaultButtonSelected(e);
- }
- };
- }
-
- private void overrideDefaultButtonSelected(SelectionEvent e) {
- boolean selection = this.overrideDefaultButton.getSelection();
- if (selection) {
- if (getSelectedOverride() instanceof IAttributeOverride) {
- int index = this.entity.getSpecifiedAttributeOverrides().size();
- IAttributeOverride attributeOverride = this.entity.createAttributeOverride(index);
- this.entity.getSpecifiedAttributeOverrides().add(attributeOverride);
- attributeOverride.setName(this.selectedOverride.getName());
- attributeOverride.getColumn().setSpecifiedName(((IAttributeOverride) this.selectedOverride).getColumn().getName());
- }
- else {
- int index = this.entity.getSpecifiedAssociationOverrides().size();
- IAssociationOverride associationOverride = this.entity.createAssociationOverride(index);
- String name = this.selectedOverride.getName();
- this.entity.getSpecifiedAssociationOverrides().add(associationOverride);
- associationOverride.setName(name);
- //attributeOverride.getColumn().setSpecifiedName(this.attributeOverride.getColumn().getName());
- }
- }
- else {
- if (getSelectedOverride() instanceof IAttributeOverride) {
- this.entity.getSpecifiedAttributeOverrides().remove(this.selectedOverride);
- }
- else {
- this.entity.getSpecifiedAssociationOverrides().remove(this.selectedOverride);
- }
- }
- }
-
-
- private ListViewer buildAttributeOverridesListViewer(Composite parent) {
- ListViewer listViewer = new ListViewer(parent, SWT.SINGLE | SWT.BORDER);
- listViewer.setLabelProvider(buildAttributeOverridesLabelProvider());
- listViewer.setContentProvider(buildAttributeOverridesContentProvider());
-
- listViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- overridesListSelectionChanged(event);
- }
- });
-
- return listViewer;
- }
-
- protected void overridesListSelectionChanged(SelectionChangedEvent event) {
- if (((StructuredSelection) event.getSelection()).isEmpty()) {
- this.columnComposite.populate(null);
- this.columnComposite.enableWidgets(false);
- this.overrideDefaultButton.setSelection(false);
- this.overrideDefaultButton.setEnabled(false);
- }
- else {
- this.selectedOverride = getSelectedOverride();
- if (this.selectedOverride instanceof IAttributeOverride) {
- boolean specifiedOverride = this.entity.getSpecifiedAttributeOverrides().contains(this.selectedOverride);
- this.overrideDefaultButton.setSelection(specifiedOverride);
- this.overridePageBook.showPage(this.columnComposite.getControl());
- this.columnComposite.populate(((IAttributeOverride) this.selectedOverride).getColumn());
- this.columnComposite.enableWidgets(specifiedOverride);
- this.overrideDefaultButton.setEnabled(true);
- }
- else {
- boolean specifiedOverride = this.entity.getSpecifiedAssociationOverrides().contains(this.selectedOverride);
- this.overrideDefaultButton.setSelection(specifiedOverride);
- this.overridePageBook.showPage(this.joinColumnsComposite.getControl());
- this.joinColumnsComposite.populate(new JoinColumnsOwner((IAssociationOverride) getSelectedOverride()));
- this.joinColumnsComposite.enableWidgets(specifiedOverride);
- this.overrideDefaultButton.setEnabled(true);
- }
- }
- }
-
- private ILabelProvider buildAttributeOverridesLabelProvider() {
- return new LabelProvider() {
- public String getText(Object element) {
- //TODO also display column name somehow
- return ((IOverride) element).getName();
- }
- };
- }
-
-
- private IContentProvider buildAttributeOverridesContentProvider() {
- return new IStructuredContentProvider() {
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
-
- public void dispose() {
- }
-
- public Object[] getElements(Object inputElement) {
- IEntity entity = (IEntity) inputElement;
- return CollectionTools.addAll(
- entity.getAttributeOverrides().toArray(new IOverride[entity.getAttributeOverrides().size()]),
- entity.getAssociationOverrides());
- }
- };
- }
-
- private IOverride getSelectedOverride() {
- return (IOverride) ((StructuredSelection) this.listViewer.getSelection()).getFirstElement();
- }
-
-
- public void doPopulate(EObject obj) {
- this.entity = (IEntity) obj;
- if (this.entity == null) {
- this.selectedOverride = null;
- this.columnComposite.populate(null);
- this.joinColumnsComposite.populate(null);
- this.listViewer.setInput(null);
- return;
- }
-
- if (this.listViewer.getInput() != entity) {
- this.listViewer.setInput(entity);
- }
- if (!this.entity.getAttributeOverrides().isEmpty()) {
- if (this.listViewer.getSelection().isEmpty()) {
- IOverride override = this.entity.getAttributeOverrides().get(0);
- this.listViewer.setSelection(new StructuredSelection(override));
- }
- else {
- Object selection = ((StructuredSelection) this.listViewer.getSelection()).getFirstElement();
- if (selection instanceof IAttributeOverride) {
- this.overridePageBook.showPage(this.columnComposite.getControl());
- this.columnComposite.enableWidgets(true);
- this.columnComposite.populate(((IAttributeOverride) selection).getColumn());
- }
- else {
- this.overridePageBook.showPage(this.joinColumnsComposite.getControl());
- this.joinColumnsComposite.enableWidgets(true);
- this.joinColumnsComposite.populate(new JoinColumnsOwner((IAssociationOverride) selection));
- }
- }
- }
- else {
- this.columnComposite.populate(null);
- this.columnComposite.enableWidgets(false);
- }
- }
-
- @Override
- protected void doPopulate() {
- this.columnComposite.doPopulate();
- this.joinColumnsComposite.doPopulate();
- }
-
- @Override
- protected void engageListeners() {
- if (this.entity != null) {
- this.entity.eAdapters().add(this.entityListener);
- for (IOverride attributeOverride : this.entity.getAttributeOverrides()) {
- attributeOverride.eAdapters().add(this.overrideListener);
- }
- for (IOverride attributeOverride : this.entity.getAssociationOverrides()) {
- attributeOverride.eAdapters().add(this.overrideListener);
- }
- }
- }
-
- @Override
- protected void disengageListeners() {
- if (this.entity != null) {
- this.entity.eAdapters().remove(this.entityListener);
- for (IOverride attributeOverride : this.entity.getAttributeOverrides()) {
- attributeOverride.eAdapters().remove(this.overrideListener);
- }
- for (IOverride attributeOverride : this.entity.getAssociationOverrides()) {
- attributeOverride.eAdapters().remove(this.overrideListener);
- }
- }
- }
-
-
- protected void entityChanged(Notification notification) {
- switch (notification.getFeatureID(IEntity.class)) {
- case JpaCoreMappingsPackage.IENTITY__SPECIFIED_ATTRIBUTE_OVERRIDES :
- case JpaCoreMappingsPackage.IENTITY__SPECIFIED_ASSOCIATION_OVERRIDES :
- case JpaCoreMappingsPackage.IENTITY__DEFAULT_ATTRIBUTE_OVERRIDES :
- case JpaCoreMappingsPackage.IENTITY__DEFAULT_ASSOCIATION_OVERRIDES :
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (listViewer.getList().isDisposed()) {
- return;
- }
- listViewer.refresh();
- }
- });
-
- if (notification.getEventType() == Notification.ADD) {
- ((IOverride) notification.getNewValue()).eAdapters().add(this.overrideListener);
- final Object newValue = notification.getNewValue();
- ((IOverride) newValue).eAdapters().add(this.overrideListener);
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (listViewer.getList().isDisposed()) {
- return;
- }
- listViewer.setSelection(new StructuredSelection(newValue));
- }
- });
- }
- else if (notification.getEventType() == Notification.ADD_MANY) {
- List<IOverride> addedList = (List<IOverride>) notification.getNewValue();
- for (IOverride override : addedList) {
- override.eAdapters().add(this.overrideListener);
- }
- }
- else if (notification.getEventType() == Notification.REMOVE) {
- ((IOverride) notification.getOldValue()).eAdapters().remove(this.overrideListener);
- }
- else if (notification.getEventType() == Notification.REMOVE_MANY) {
- List<IOverride> removedList = (List<IOverride>) notification.getOldValue();
- for (IOverride override : removedList) {
- override.eAdapters().remove(this.overrideListener);
- }
- }
- break;
- }
- }
-
- protected void overrideChanged(Notification notification) {
- switch (notification.getFeatureID(IOverride.class)) {
- case JpaCoreMappingsPackage.IOVERRIDE__NAME :
- final IOverride override = (IOverride) notification.getNotifier();
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- OverridesComposite.this.listViewer.update(override, null);
- }
- });
- break;
- default :
- break;
- }
- }
-
- public void dispose() {
- this.columnComposite.dispose();
- this.joinColumnsComposite.dispose();
- super.dispose();
- }
-
-
- void addJoinColumn() {
- JoinColumnInAssociationOverrideDialog dialog = new JoinColumnInAssociationOverrideDialog(this.getControl().getShell(), (IAssociationOverride) getSelectedOverride());
- this.addJoinColumnFromDialog(dialog);
- }
-
- private void addJoinColumnFromDialog(JoinColumnInAssociationOverrideDialog dialog) {
- if (dialog.open() != Window.OK) {
- return;
- }
- int index = ((IAssociationOverride) getSelectedOverride()).getJoinColumns().size();
- IJoinColumn joinColumn = ((IAssociationOverride) getSelectedOverride()).createJoinColumn(index);
- ((IAssociationOverride) getSelectedOverride()).getSpecifiedJoinColumns().add(joinColumn);
- joinColumn.setSpecifiedName(dialog.getSelectedName());
- joinColumn.setSpecifiedReferencedColumnName(dialog.getReferencedColumnName());
- }
-
- void editJoinColumn(IJoinColumn joinColumn) {
- JoinColumnInAssociationOverrideDialog dialog = new JoinColumnInAssociationOverrideDialog(this.getControl().getShell(), joinColumn);
- editJoinColumnFromDialog(dialog, joinColumn);
- }
-
- private void editJoinColumnFromDialog(JoinColumnInAssociationOverrideDialog dialog, IJoinColumn joinColumn) {
- if (dialog.open() == Window.OK) {
- editJoinColumnDialogOkd(dialog, joinColumn);
- }
- }
-
- private void editJoinColumnDialogOkd(JoinColumnInAssociationOverrideDialog dialog, IJoinColumn joinColumn) {
- String name = dialog.getSelectedName();
- String referencedColumnName = dialog.getReferencedColumnName();
-
- if (dialog.isDefaultNameSelected()) {
- if (joinColumn.getSpecifiedName() != null) {
- joinColumn.setSpecifiedName(null);
- }
- }
- else if (joinColumn.getSpecifiedName() == null || !joinColumn.getSpecifiedName().equals(name)){
- joinColumn.setSpecifiedName(name);
- }
-
- if (dialog.isDefaultReferencedColumnNameSelected()) {
- if (joinColumn.getSpecifiedReferencedColumnName() != null) {
- joinColumn.setSpecifiedReferencedColumnName(null);
- }
- }
- else if (joinColumn.getSpecifiedReferencedColumnName() == null || !joinColumn.getSpecifiedReferencedColumnName().equals(referencedColumnName)){
- joinColumn.setSpecifiedReferencedColumnName(referencedColumnName);
- }
- }
-
- private class JoinColumnsOwner extends JpaEObject implements Owner {
-
- IAssociationOverride associationOverride;
-
- public JoinColumnsOwner(IAssociationOverride associationOverride) {
- super();
- this.associationOverride = associationOverride;
- }
-
- public void addJoinColumn() {
- OverridesComposite.this.addJoinColumn();
- }
-
- public boolean containsSpecifiedJoinColumns() {
- return this.associationOverride.containsSpecifiedJoinColumns();
- }
-
- public IJoinColumn createJoinColumn(int index) {
- return this.associationOverride.createJoinColumn(index);
- }
-
- public List<IJoinColumn> getJoinColumns() {
- return this.associationOverride.getJoinColumns();
- }
-
- public List<IJoinColumn> getSpecifiedJoinColumns() {
- return this.associationOverride.getSpecifiedJoinColumns();
- }
-
- public int specifiedJoinColumnsFeatureId() {
- return JpaCoreMappingsPackage.IASSOCIATION_OVERRIDE__SPECIFIED_JOIN_COLUMNS;
- }
-
- public Class owningFeatureClass() {
- return IAssociationOverride.class;
- }
-
- public void editJoinColumn(IJoinColumn joinColumn) {
- OverridesComposite.this.editJoinColumn(joinColumn);
- }
-
- public EObject getEObject() {
- return this.associationOverride;
- }
- }
-
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/PrimaryKeyJoinColumnDialog.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/PrimaryKeyJoinColumnDialog.java
deleted file mode 100644
index f7aa9653e9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/PrimaryKeyJoinColumnDialog.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.mappings.details;
-
-import org.eclipse.jpt.core.internal.mappings.IEntity;
-import org.eclipse.jpt.core.internal.mappings.IPrimaryKeyJoinColumn;
-import org.eclipse.jpt.db.internal.Table;
-import org.eclipse.swt.widgets.Shell;
-
-public class PrimaryKeyJoinColumnDialog extends AbstractJoinColumnDialog<IPrimaryKeyJoinColumn> {
-
- private IEntity entity;
-
- PrimaryKeyJoinColumnDialog(Shell parent, IEntity entity) {
- super(parent);
- this.entity = entity;
- }
-
- PrimaryKeyJoinColumnDialog(Shell parent, IPrimaryKeyJoinColumn joinColumn) {
- super(parent, joinColumn);
- this.entity = (IEntity) joinColumn.eContainer();
- }
-
- protected Table getNameTable() {
- return this.entity.primaryDbTable();
- }
-
- protected Table getReferencedNameTable() {
- return this.entity.parentEntity().primaryDbTable();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/PrimaryKeyJoinColumnInSecondaryTableDialog.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/PrimaryKeyJoinColumnInSecondaryTableDialog.java
deleted file mode 100644
index 51a220df88..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/PrimaryKeyJoinColumnInSecondaryTableDialog.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.mappings.details;
-
-import org.eclipse.jpt.core.internal.mappings.IPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.ISecondaryTable;
-import org.eclipse.jpt.db.internal.Table;
-import org.eclipse.swt.widgets.Shell;
-
-public class PrimaryKeyJoinColumnInSecondaryTableDialog extends AbstractJoinColumnDialog<IPrimaryKeyJoinColumn> {
-
- private ISecondaryTable secondaryTable;
-
- PrimaryKeyJoinColumnInSecondaryTableDialog(Shell parent, ISecondaryTable secondaryTable) {
- super(parent);
- this.secondaryTable = secondaryTable;
- }
-
- PrimaryKeyJoinColumnInSecondaryTableDialog(Shell parent, IPrimaryKeyJoinColumn joinColumn) {
- super(parent, joinColumn);
- this.secondaryTable = (ISecondaryTable) joinColumn.eContainer();
- }
-
- protected Table getNameTable() {
- return this.secondaryTable.dbTable();
- }
-
- protected Table getReferencedNameTable() {
- return this.secondaryTable.typeMapping().primaryDbTable();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/PrimaryKeyJoinColumnsComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/PrimaryKeyJoinColumnsComposite.java
deleted file mode 100644
index e870bfcac8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/PrimaryKeyJoinColumnsComposite.java
+++ /dev/null
@@ -1,405 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.mappings.details;
-
-import java.util.Iterator;
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jface.viewers.IContentProvider;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.ListViewer;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jpt.core.internal.mappings.IAbstractJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.IEntity;
-import org.eclipse.jpt.core.internal.mappings.INamedColumn;
-import org.eclipse.jpt.core.internal.mappings.IPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.details.BaseJpaComposite;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class PrimaryKeyJoinColumnsComposite extends BaseJpaComposite
-{
- private IEntity entity;
- private final Adapter entityListener;
- private final Adapter pkJoinColumnListener;
-
- ListViewer pkJoinColumnsListViewer;
-
- private Group pkJoinColumnsGroup;
- Button overrideDefaultJoinColumnsCheckBox;
- private Button pkJoinColumnsRemoveButton;
- private Button pkJoinColumnsEditButton;
-
-
- public PrimaryKeyJoinColumnsComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, SWT.NULL, commandStack, widgetFactory);
- this.entityListener = buildEntityListener();
- this.pkJoinColumnListener = buildPkJoinColumnListener();
- }
-
- private Adapter buildEntityListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- entityChanged(notification);
- }
- };
- }
-
- private Adapter buildPkJoinColumnListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- pkJoinColumnChanged(notification);
- }
- };
- }
-
- @Override
- protected void initializeLayout(Composite composite) {
- GridLayout layout = new GridLayout(2, false);
- layout.marginWidth = 0;
- composite.setLayout(layout);
-
- GridData gridData = new GridData();
- this.overrideDefaultJoinColumnsCheckBox = getWidgetFactory().createButton(
- composite,
- JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_overrideDefaultPrimaryKeyJoinColumns,
- SWT.CHECK);
- this.overrideDefaultJoinColumnsCheckBox.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- // do nothing
- }
-
- public void widgetSelected(SelectionEvent e) {
- if (PrimaryKeyJoinColumnsComposite.this.overrideDefaultJoinColumnsCheckBox.getSelection()) {
- IPrimaryKeyJoinColumn defaultJoinColumn = PrimaryKeyJoinColumnsComposite.this.entity.getDefaultPrimaryKeyJoinColumns().get(0);
- String columnName = defaultJoinColumn.getDefaultName();
- String referencedColumnName = defaultJoinColumn.getDefaultReferencedColumnName();
-
- IPrimaryKeyJoinColumn pkJoinColumn = PrimaryKeyJoinColumnsComposite.this.entity.createPrimaryKeyJoinColumn(0);
- PrimaryKeyJoinColumnsComposite.this.entity.getSpecifiedPrimaryKeyJoinColumns().add(pkJoinColumn);
- pkJoinColumn.setSpecifiedName(columnName);
- pkJoinColumn.setSpecifiedReferencedColumnName(referencedColumnName);
- } else {
- PrimaryKeyJoinColumnsComposite.this.entity.getSpecifiedPrimaryKeyJoinColumns().clear();
- }
- }
- });
-
- this.pkJoinColumnsGroup =
- getWidgetFactory().createGroup(
- composite,
- JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_primaryKeyJoinColumn);
- this.pkJoinColumnsGroup.setLayout(new GridLayout(2, false));
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- gridData.horizontalSpan = 2;
- this.pkJoinColumnsGroup.setLayoutData(gridData);
-
- this.pkJoinColumnsListViewer = new ListViewer(this.pkJoinColumnsGroup, SWT.BORDER | SWT.MULTI);
- this.pkJoinColumnsListViewer.setContentProvider(buildJoinColumnsListContentProvider());
- this.pkJoinColumnsListViewer.setLabelProvider(buildJoinColumnsListLabelProvider());
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- gridData.verticalSpan = 3;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- this.pkJoinColumnsListViewer.getList().setLayoutData(gridData);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this.pkJoinColumnsListViewer.getList(), IJpaHelpContextIds.MAPPING_JOIN_TABLE_COLUMNS);
-
- Button addJoinColumnButton = getWidgetFactory().createButton(
- this.pkJoinColumnsGroup,
- JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_add,
- SWT.NONE);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- addJoinColumnButton.setLayoutData(gridData);
- addJoinColumnButton.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- // do nothing
- }
-
- public void widgetSelected(SelectionEvent e) {
- addPrimaryKeyJoinColumn();
- }
- });
-
- this.pkJoinColumnsEditButton = getWidgetFactory().createButton(
- this.pkJoinColumnsGroup,
- JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_edit,
- SWT.NONE);
- this.pkJoinColumnsEditButton.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- // do nothing
- }
-
- public void widgetSelected(SelectionEvent e) {
- editPrimaryKeyJoinColumn();
- }
- });
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- this.pkJoinColumnsEditButton.setLayoutData(gridData);
-
- this.pkJoinColumnsRemoveButton = getWidgetFactory().createButton(
- this.pkJoinColumnsGroup,
- JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_remove,
- SWT.NONE);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.BEGINNING;
- this.pkJoinColumnsRemoveButton.setLayoutData(gridData);
- this.pkJoinColumnsRemoveButton.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- // do nothing
- }
-
- public void widgetSelected(SelectionEvent e) {
- removePrimaryKeyJoinColumn();
- }
- });
-
- this.pkJoinColumnsListViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- updatePrimaryKeyJoinColumnsEnablement();
- }
- });
- }
-
- private IContentProvider buildJoinColumnsListContentProvider() {
- return new IStructuredContentProvider(){
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- // do nothing
- }
-
- public void dispose() {
- // do nothing
- }
-
- public Object[] getElements(Object inputElement) {
- return ((IEntity) inputElement).getPrimaryKeyJoinColumns().toArray();
- }
- };
- }
-
- private ILabelProvider buildJoinColumnsListLabelProvider() {
- return new LabelProvider() {
- public String getText(Object element) {
- IPrimaryKeyJoinColumn joinColumn = (IPrimaryKeyJoinColumn) element;
- return (PrimaryKeyJoinColumnsComposite.this.entity.containsSpecifiedPrimaryKeyJoinColumns()) ?
- buildJoinColumnLabel(joinColumn)
- :
- buildDefaultJoinColumnLabel(joinColumn);
- }
- };
- }
-
- String buildDefaultJoinColumnLabel(IPrimaryKeyJoinColumn joinColumn) {
- return NLS.bind(JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_mappingBetweenTwoParamsDefault, joinColumn.getName(), joinColumn.getReferencedColumnName());
- }
-
- String buildJoinColumnLabel(IPrimaryKeyJoinColumn joinColumn) {
- if (joinColumn.getSpecifiedName() == null) {
- if (joinColumn.getSpecifiedReferencedColumnName() == null) {
- return NLS.bind(JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_mappingBetweenTwoParamsBothDefault, joinColumn.getName(),joinColumn.getReferencedColumnName());
- }
- return NLS.bind(JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_mappingBetweenTwoParamsFirstDefault, joinColumn.getName(), joinColumn.getReferencedColumnName());
- }
- else if (joinColumn.getSpecifiedReferencedColumnName() == null) {
- return NLS.bind(JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_mappingBetweenTwoParamsSecDefault, joinColumn.getName(), joinColumn.getReferencedColumnName());
- }
- else {
- return NLS.bind(JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_mappingBetweenTwoParams, joinColumn.getName(), joinColumn.getReferencedColumnName());
- }
- }
-
-
- void addPrimaryKeyJoinColumn() {
- PrimaryKeyJoinColumnDialog dialog = new PrimaryKeyJoinColumnDialog(this.getControl().getShell(), this.entity);
- addJoinColumnFromDialog(dialog);
- }
-
- private void addJoinColumnFromDialog(PrimaryKeyJoinColumnDialog dialog) {
- if (dialog.open() == Window.OK) {
- int index = this.entity.getSpecifiedPrimaryKeyJoinColumns().size();
- String name = dialog.getSelectedName();
- String referencedColumnName = dialog.getReferencedColumnName();
- IPrimaryKeyJoinColumn joinColumn = this.entity.createPrimaryKeyJoinColumn(index);
- this.entity.getSpecifiedPrimaryKeyJoinColumns().add(joinColumn);
- joinColumn.setSpecifiedName(name);
- joinColumn.setSpecifiedReferencedColumnName(referencedColumnName);
- }
- }
-
- private IPrimaryKeyJoinColumn getSelectedJoinColumn() {
- return (IPrimaryKeyJoinColumn) ((StructuredSelection) this.pkJoinColumnsListViewer.getSelection()).getFirstElement();
- }
-
- void editPrimaryKeyJoinColumn() {
- IPrimaryKeyJoinColumn joinColumn = getSelectedJoinColumn();
- PrimaryKeyJoinColumnDialog dialog = new PrimaryKeyJoinColumnDialog(this.getControl().getShell(), joinColumn);
- editJoinColumnFromDialog(dialog, joinColumn);
- }
-
- private void editJoinColumnFromDialog(PrimaryKeyJoinColumnDialog dialog, IPrimaryKeyJoinColumn joinColumn) {
- if (dialog.open() == Window.OK) {
- editJoinColumnDialogOkd(dialog, joinColumn);
- }
- }
-
- private void editJoinColumnDialogOkd(PrimaryKeyJoinColumnDialog dialog, IPrimaryKeyJoinColumn joinColumn) {
- String name = dialog.getSelectedName();
- String referencedColumnName = dialog.getReferencedColumnName();
-
- if (dialog.isDefaultNameSelected()) {
- if (joinColumn.getSpecifiedName() != null) {
- joinColumn.setSpecifiedName(null);
- }
- }
- else if (joinColumn.getSpecifiedName() == null || !joinColumn.getSpecifiedName().equals(name)){
- joinColumn.setSpecifiedName(name);
- }
-
- if (dialog.isDefaultReferencedColumnNameSelected()) {
- if (joinColumn.getSpecifiedReferencedColumnName() != null) {
- joinColumn.setSpecifiedReferencedColumnName(null);
- }
- }
- else if (joinColumn.getSpecifiedReferencedColumnName() == null || !joinColumn.getSpecifiedReferencedColumnName().equals(referencedColumnName)){
- joinColumn.setSpecifiedReferencedColumnName(referencedColumnName);
- }
- }
-
- void removePrimaryKeyJoinColumn() {
- ISelection selection = this.pkJoinColumnsListViewer.getSelection();
- if (selection instanceof StructuredSelection) {
- for (Iterator i = ((StructuredSelection) selection).iterator(); i.hasNext(); ) {
- this.entity.getPrimaryKeyJoinColumns().remove(i.next());
- }
- }
- }
-
- void updatePrimaryKeyJoinColumnsEnablement() {
- boolean groupEnabledState = this.entity.containsSpecifiedPrimaryKeyJoinColumns();
- enableGroup(this.pkJoinColumnsGroup, groupEnabledState);
-
- this.pkJoinColumnsRemoveButton.setEnabled(groupEnabledState && !((StructuredSelection) this.pkJoinColumnsListViewer.getSelection()).isEmpty());
- this.pkJoinColumnsEditButton.setEnabled(groupEnabledState && ((StructuredSelection) this.pkJoinColumnsListViewer.getSelection()).size() == 1);
- }
-
- private void enableGroup(Group group, boolean enabled) {
- group.setEnabled(enabled);
- for (int i = 0; i < group.getChildren().length; i++) {
- group.getChildren()[i].setEnabled(enabled);
- }
- }
-
-
- public void doPopulate(EObject obj) {
- this.entity = (IEntity) obj;
- if (this.entity == null) {
- this.pkJoinColumnsListViewer.setInput(null);
- return;
- }
-
- this.pkJoinColumnsListViewer.setInput(this.entity);
-
-
- updatePrimaryKeyJoinColumnsEnablement();
- this.overrideDefaultJoinColumnsCheckBox.setSelection(this.entity.containsSpecifiedPrimaryKeyJoinColumns());
- }
-
- @Override
- protected void doPopulate() {
- }
-
- protected void engageListeners() {
- if (this.entity != null) {
- this.entity.eAdapters().add(this.entityListener);
- for (IPrimaryKeyJoinColumn pkJoinColumn : this.entity.getPrimaryKeyJoinColumns()) {
- pkJoinColumn.eAdapters().add(this.pkJoinColumnListener);
- }
- //this.addConnectionListener();
- }
- }
-
- protected void disengageListeners() {
- if (this.entity != null) {
- //this.removeConnectionListener();
- for (IPrimaryKeyJoinColumn pkJoinColumn : this.entity.getPrimaryKeyJoinColumns()) {
- pkJoinColumn.eAdapters().remove(this.pkJoinColumnListener);
- }
- this.entity.eAdapters().remove(this.entityListener);
- }
- }
-
- protected void entityChanged(Notification notification) {
- if (notification.getFeatureID(IEntity.class) == JpaCoreMappingsPackage.IENTITY__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS) {
- if (notification.getEventType() == Notification.ADD) {
- ((IPrimaryKeyJoinColumn) notification.getNewValue()).eAdapters().add(this.pkJoinColumnListener);
- }
- else if (notification.getEventType() == Notification.REMOVE) {
- ((IPrimaryKeyJoinColumn) notification.getOldValue()).eAdapters().remove(this.pkJoinColumnListener);
- }
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- pkJoinColumnsListViewer.refresh();
- overrideDefaultJoinColumnsCheckBox.setSelection(entity.containsSpecifiedPrimaryKeyJoinColumns());
- updatePrimaryKeyJoinColumnsEnablement();
- }
- });
- }
- }
-
- protected void pkJoinColumnChanged(Notification notification) {
- if (notification.getFeatureID(INamedColumn.class) == JpaCoreMappingsPackage.INAMED_COLUMN__SPECIFIED_NAME
- || notification.getFeatureID(IAbstractJoinColumn.class) == JpaCoreMappingsPackage.IABSTRACT_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME
- || notification.getFeatureID(INamedColumn.class) == JpaCoreMappingsPackage.INAMED_COLUMN__DEFAULT_NAME
- || notification.getFeatureID(IAbstractJoinColumn.class) == JpaCoreMappingsPackage.IABSTRACT_JOIN_COLUMN__DEFAULT_REFERENCED_COLUMN_NAME) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- pkJoinColumnsListViewer.refresh();
- }
- });
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/PrimaryKeyJoinColumnsInSecondaryTableComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/PrimaryKeyJoinColumnsInSecondaryTableComposite.java
deleted file mode 100644
index 8b06e17166..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/PrimaryKeyJoinColumnsInSecondaryTableComposite.java
+++ /dev/null
@@ -1,413 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.mappings.details;
-
-import java.util.Iterator;
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jface.viewers.IContentProvider;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.ListViewer;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jpt.core.internal.mappings.IAbstractJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.INamedColumn;
-import org.eclipse.jpt.core.internal.mappings.IPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.ISecondaryTable;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.details.BaseJpaComposite;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class PrimaryKeyJoinColumnsInSecondaryTableComposite extends BaseJpaComposite
-{
- private ISecondaryTable secondaryTable;
- private final Adapter secondaryTableListener;
- private final Adapter pkJoinColumnListener;
-
- ListViewer pkJoinColumnsListViewer;
-
- private Group pkJoinColumnsGroup;
- Button overrideDefaultJoinColumnsCheckBox;
- private Button pkJoinColumnsAddButton;
- private Button pkJoinColumnsRemoveButton;
- private Button pkJoinColumnsEditButton;
-
-
- public PrimaryKeyJoinColumnsInSecondaryTableComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, SWT.NULL, commandStack, widgetFactory);
- this.secondaryTableListener = buildSecondaryTableListener();
- this.pkJoinColumnListener = buildPkJoinColumnListener();
- }
-
- private Adapter buildSecondaryTableListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- secondaryTableChanged(notification);
- }
- };
- }
-
- private Adapter buildPkJoinColumnListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- pkJoinColumnChanged(notification);
- }
- };
- }
-
- @Override
- protected void initializeLayout(Composite composite) {
- GridLayout layout = new GridLayout(2, false);
- layout.marginWidth = 0;
- composite.setLayout(layout);
-
- GridData gridData = new GridData();
- this.overrideDefaultJoinColumnsCheckBox = getWidgetFactory().createButton(
- composite,
- JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_overrideDefaultPrimaryKeyJoinColumns,
- SWT.CHECK);
- this.overrideDefaultJoinColumnsCheckBox.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- // do nothing
- }
-
- public void widgetSelected(SelectionEvent e) {
- if (PrimaryKeyJoinColumnsInSecondaryTableComposite.this.overrideDefaultJoinColumnsCheckBox.getSelection()) {
- IPrimaryKeyJoinColumn defaultJoinColumn = PrimaryKeyJoinColumnsInSecondaryTableComposite.this.secondaryTable.getDefaultPrimaryKeyJoinColumns().get(0);
- String columnName = defaultJoinColumn.getDefaultName();
- String referencedColumnName = defaultJoinColumn.getDefaultReferencedColumnName();
-
- IPrimaryKeyJoinColumn pkJoinColumn = PrimaryKeyJoinColumnsInSecondaryTableComposite.this.secondaryTable.createPrimaryKeyJoinColumn(0);
- PrimaryKeyJoinColumnsInSecondaryTableComposite.this.secondaryTable.getSpecifiedPrimaryKeyJoinColumns().add(pkJoinColumn);
- pkJoinColumn.setSpecifiedName(columnName);
- pkJoinColumn.setSpecifiedReferencedColumnName(referencedColumnName);
- } else {
- PrimaryKeyJoinColumnsInSecondaryTableComposite.this.secondaryTable.getSpecifiedPrimaryKeyJoinColumns().clear();
- }
- }
- });
-
- this.pkJoinColumnsGroup =
- getWidgetFactory().createGroup(
- composite,
- JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_primaryKeyJoinColumn);
- this.pkJoinColumnsGroup.setLayout(new GridLayout(2, false));
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- gridData.horizontalSpan = 2;
- this.pkJoinColumnsGroup.setLayoutData(gridData);
-
- this.pkJoinColumnsListViewer = new ListViewer(this.pkJoinColumnsGroup, SWT.BORDER | SWT.MULTI);
- this.pkJoinColumnsListViewer.setContentProvider(buildJoinColumnsListContentProvider());
- this.pkJoinColumnsListViewer.setLabelProvider(buildJoinColumnsListLabelProvider());
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- gridData.verticalSpan = 3;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- this.pkJoinColumnsListViewer.getList().setLayoutData(gridData);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this.pkJoinColumnsListViewer.getList(), IJpaHelpContextIds.MAPPING_JOIN_TABLE_COLUMNS);
-
- this.pkJoinColumnsAddButton = getWidgetFactory().createButton(
- this.pkJoinColumnsGroup,
- JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_add,
- SWT.NONE);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- this.pkJoinColumnsAddButton.setLayoutData(gridData);
- this.pkJoinColumnsAddButton.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- // do nothing
- }
-
- public void widgetSelected(SelectionEvent e) {
- addPrimaryKeyJoinColumn();
- }
- });
-
- this.pkJoinColumnsEditButton = getWidgetFactory().createButton(
- this.pkJoinColumnsGroup,
- JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_edit,
- SWT.NONE);
- this.pkJoinColumnsEditButton.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- // do nothing
- }
-
- public void widgetSelected(SelectionEvent e) {
- editPrimaryKeyJoinColumn();
- }
- });
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- this.pkJoinColumnsEditButton.setLayoutData(gridData);
-
- this.pkJoinColumnsRemoveButton = getWidgetFactory().createButton(
- this.pkJoinColumnsGroup,
- JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_remove,
- SWT.NONE);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.BEGINNING;
- this.pkJoinColumnsRemoveButton.setLayoutData(gridData);
- this.pkJoinColumnsRemoveButton.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- // do nothing
- }
-
- public void widgetSelected(SelectionEvent e) {
- removePrimaryKeyJoinColumn();
- }
- });
-
- this.pkJoinColumnsListViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- updatePrimaryKeyJoinColumnsEnablement();
- }
- });
- }
-
- private IContentProvider buildJoinColumnsListContentProvider() {
- return new IStructuredContentProvider(){
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- // do nothing
- }
-
- public void dispose() {
- // do nothing
- }
-
- public Object[] getElements(Object inputElement) {
- return ((ISecondaryTable) inputElement).getPrimaryKeyJoinColumns().toArray();
- }
- };
- }
-
- private ILabelProvider buildJoinColumnsListLabelProvider() {
- return new LabelProvider() {
- public String getText(Object element) {
- IPrimaryKeyJoinColumn joinColumn = (IPrimaryKeyJoinColumn) element;
- return (PrimaryKeyJoinColumnsInSecondaryTableComposite.this.secondaryTable.containsSpecifiedPrimaryKeyJoinColumns()) ?
- buildJoinColumnLabel(joinColumn)
- :
- buildDefaultJoinColumnLabel(joinColumn);
- }
- };
- }
-
- String buildDefaultJoinColumnLabel(IPrimaryKeyJoinColumn joinColumn) {
- return NLS.bind(JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_mappingBetweenTwoParamsDefault, joinColumn.getName(), joinColumn.getReferencedColumnName());
- }
-
- String buildJoinColumnLabel(IPrimaryKeyJoinColumn joinColumn) {
- if (joinColumn.getSpecifiedName() == null) {
- if (joinColumn.getSpecifiedReferencedColumnName() == null) {
- return NLS.bind(JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_mappingBetweenTwoParamsBothDefault, joinColumn.getName(),joinColumn.getReferencedColumnName());
- }
- return NLS.bind(JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_mappingBetweenTwoParamsFirstDefault, joinColumn.getName(), joinColumn.getReferencedColumnName());
- }
- else if (joinColumn.getSpecifiedReferencedColumnName() == null) {
- return NLS.bind(JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_mappingBetweenTwoParamsSecDefault, joinColumn.getName(), joinColumn.getReferencedColumnName());
- }
- else {
- return NLS.bind(JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_mappingBetweenTwoParams, joinColumn.getName(), joinColumn.getReferencedColumnName());
- }
- }
-
-
- void addPrimaryKeyJoinColumn() {
- PrimaryKeyJoinColumnInSecondaryTableDialog dialog = new PrimaryKeyJoinColumnInSecondaryTableDialog(this.getControl().getShell(), this.secondaryTable);
- addJoinColumnFromDialog(dialog);
- }
-
- private void addJoinColumnFromDialog(PrimaryKeyJoinColumnInSecondaryTableDialog dialog) {
- if (dialog.open() == Window.OK) {
- int index = this.secondaryTable.getSpecifiedPrimaryKeyJoinColumns().size();
- String name = dialog.getSelectedName();
- String referencedColumnName = dialog.getReferencedColumnName();
- IPrimaryKeyJoinColumn joinColumn = this.secondaryTable.createPrimaryKeyJoinColumn(index);
- this.secondaryTable.getSpecifiedPrimaryKeyJoinColumns().add(joinColumn);
- joinColumn.setSpecifiedName(name);
- joinColumn.setSpecifiedReferencedColumnName(referencedColumnName);
- }
- }
-
- private IPrimaryKeyJoinColumn getSelectedJoinColumn() {
- return (IPrimaryKeyJoinColumn) ((StructuredSelection) this.pkJoinColumnsListViewer.getSelection()).getFirstElement();
- }
-
- void editPrimaryKeyJoinColumn() {
- IPrimaryKeyJoinColumn joinColumn = getSelectedJoinColumn();
- PrimaryKeyJoinColumnInSecondaryTableDialog dialog = new PrimaryKeyJoinColumnInSecondaryTableDialog(this.getControl().getShell(), joinColumn);
- editJoinColumnFromDialog(dialog, joinColumn);
- }
-
- private void editJoinColumnFromDialog(PrimaryKeyJoinColumnInSecondaryTableDialog dialog, IPrimaryKeyJoinColumn joinColumn) {
- if (dialog.open() == Window.OK) {
- editJoinColumnDialogOkd(dialog, joinColumn);
- }
- }
-
- private void editJoinColumnDialogOkd(PrimaryKeyJoinColumnInSecondaryTableDialog dialog, IPrimaryKeyJoinColumn joinColumn) {
- String name = dialog.getSelectedName();
- String referencedColumnName = dialog.getReferencedColumnName();
-
- if (dialog.isDefaultNameSelected()) {
- if (joinColumn.getSpecifiedName() != null) {
- joinColumn.setSpecifiedName(null);
- }
- }
- else if (joinColumn.getSpecifiedName() == null || !joinColumn.getSpecifiedName().equals(name)){
- joinColumn.setSpecifiedName(name);
- }
-
- if (dialog.isDefaultReferencedColumnNameSelected()) {
- if (joinColumn.getSpecifiedReferencedColumnName() != null) {
- joinColumn.setSpecifiedReferencedColumnName(null);
- }
- }
- else if (joinColumn.getSpecifiedReferencedColumnName() == null || !joinColumn.getSpecifiedReferencedColumnName().equals(referencedColumnName)){
- joinColumn.setSpecifiedReferencedColumnName(referencedColumnName);
- }
- }
-
- void removePrimaryKeyJoinColumn() {
- ISelection selection = this.pkJoinColumnsListViewer.getSelection();
- if (selection instanceof StructuredSelection) {
- for (Iterator i = ((StructuredSelection) selection).iterator(); i.hasNext(); ) {
- this.secondaryTable.getPrimaryKeyJoinColumns().remove(i.next());
- }
- }
- }
-
- void updatePrimaryKeyJoinColumnsEnablement() {
- boolean groupEnabledState = this.secondaryTable.containsSpecifiedPrimaryKeyJoinColumns();
- enableGroup(this.pkJoinColumnsGroup, groupEnabledState);
-
- this.pkJoinColumnsRemoveButton.setEnabled(groupEnabledState && !((StructuredSelection) this.pkJoinColumnsListViewer.getSelection()).isEmpty());
- this.pkJoinColumnsEditButton.setEnabled(groupEnabledState && ((StructuredSelection) this.pkJoinColumnsListViewer.getSelection()).size() == 1);
- }
-
- private void enableGroup(Group group, boolean enabled) {
- group.setEnabled(enabled);
- for (int i = 0; i < group.getChildren().length; i++) {
- group.getChildren()[i].setEnabled(enabled);
- }
- }
-
-
- public void doPopulate(EObject obj) {
- this.secondaryTable = (ISecondaryTable) obj;
- if (this.secondaryTable == null) {
- this.pkJoinColumnsListViewer.setInput(null);
- return;
- }
-
- this.pkJoinColumnsListViewer.setInput(this.secondaryTable);
-
-
- updatePrimaryKeyJoinColumnsEnablement();
- this.overrideDefaultJoinColumnsCheckBox.setSelection(this.secondaryTable.containsSpecifiedPrimaryKeyJoinColumns());
- }
-
- @Override
- protected void doPopulate() {
- }
-
- protected void engageListeners() {
- if (this.secondaryTable != null) {
- this.secondaryTable.eAdapters().add(this.secondaryTableListener);
- for (IPrimaryKeyJoinColumn pkJoinColumn : this.secondaryTable.getPrimaryKeyJoinColumns()) {
- pkJoinColumn.eAdapters().add(this.pkJoinColumnListener);
- }
- }
- }
-
- protected void disengageListeners() {
- if (this.secondaryTable != null) {
- for (IPrimaryKeyJoinColumn pkJoinColumn : this.secondaryTable.getPrimaryKeyJoinColumns()) {
- pkJoinColumn.eAdapters().remove(this.pkJoinColumnListener);
- }
- this.secondaryTable.eAdapters().remove(this.secondaryTableListener);
- }
- }
-
- protected void secondaryTableChanged(Notification notification) {
- if (notification.getFeatureID(ISecondaryTable.class) == JpaCoreMappingsPackage.ISECONDARY_TABLE__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS) {
- if (notification.getEventType() == Notification.ADD) {
- ((IPrimaryKeyJoinColumn) notification.getNewValue()).eAdapters().add(this.pkJoinColumnListener);
- }
- else if (notification.getEventType() == Notification.REMOVE) {
- ((IPrimaryKeyJoinColumn) notification.getOldValue()).eAdapters().remove(this.pkJoinColumnListener);
- }
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- pkJoinColumnsListViewer.refresh();
- overrideDefaultJoinColumnsCheckBox.setSelection(secondaryTable.containsSpecifiedPrimaryKeyJoinColumns());
- updatePrimaryKeyJoinColumnsEnablement();
- }
- });
- }
- }
-
- protected void pkJoinColumnChanged(Notification notification) {
- if (notification.getFeatureID(INamedColumn.class) == JpaCoreMappingsPackage.INAMED_COLUMN__SPECIFIED_NAME
- || notification.getFeatureID(IAbstractJoinColumn.class) == JpaCoreMappingsPackage.IABSTRACT_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME
- || notification.getFeatureID(INamedColumn.class) == JpaCoreMappingsPackage.INAMED_COLUMN__DEFAULT_NAME
- || notification.getFeatureID(IAbstractJoinColumn.class) == JpaCoreMappingsPackage.IABSTRACT_JOIN_COLUMN__DEFAULT_REFERENCED_COLUMN_NAME) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- pkJoinColumnsListViewer.refresh();
- }
- });
- }
- }
-
- protected void enableWidgets(boolean enabled) {
- this.pkJoinColumnsListViewer.getControl().setEnabled(enabled);
- this.overrideDefaultJoinColumnsCheckBox.setEnabled(enabled);
- this.pkJoinColumnsEditButton.setEnabled(enabled);
- this.pkJoinColumnsRemoveButton.setEnabled(enabled);
- this.pkJoinColumnsAddButton.setEnabled(enabled);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/SchemaCombo.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/SchemaCombo.java
deleted file mode 100644
index f5b11b34b4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/SchemaCombo.java
+++ /dev/null
@@ -1,327 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.mappings.details;
-
-import java.util.Iterator;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.mappings.ITable;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.db.internal.ConnectionListener;
-import org.eclipse.jpt.db.internal.ConnectionProfile;
-import org.eclipse.jpt.db.internal.Database;
-import org.eclipse.jpt.db.internal.Schema;
-import org.eclipse.jpt.db.internal.Table;
-import org.eclipse.jpt.ui.internal.details.BaseJpaController;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class SchemaCombo extends BaseJpaController
-{
- private ITable table;
-
- private Adapter listener;
-
- /**
- * Caching the connectionProfile so we can remove the listener. If the
- * cached table object has been removed from the model then we no longer
- * have access to the parent and cannot find the connectionProfile
- */
- private ConnectionProfile connectionProfile;
-
- private ConnectionListener connectionListener;
-
- private CCombo combo;
-
- public SchemaCombo(Composite parent, CommandStack theCommandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, theCommandStack, widgetFactory);
- this.listener = this.buildTableListener();
- this.connectionListener = this.buildConnectionListener();
- }
-
- private Adapter buildTableListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- SchemaCombo.this.schemaChanged(notification);
- }
- };
- }
-
- private ConnectionListener buildConnectionListener() {
- return new ConnectionListener() {
- public void aboutToClose(ConnectionProfile profile) {
- // not interested to this event.
- }
-
- public void closed(ConnectionProfile profile) {
- getCombo().getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- SchemaCombo.this.populateShemaCombo();
- }
- });
- }
-
- public void modified(ConnectionProfile profile) {
- getCombo().getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- SchemaCombo.this.populateShemaCombo();
- }
- });
- }
-
- public boolean okToClose(ConnectionProfile profile) {
- // not interested to this event.
- return true;
- }
-
- public void opened(ConnectionProfile profile) {
- getCombo().getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- SchemaCombo.this.populateShemaCombo();
- }
- });
- }
-
- public void databaseChanged(ConnectionProfile profile, final Database database) {
- getControl().getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (database == SchemaCombo.this.getDatabase()) {
- if (!getControl().isDisposed()) {
- SchemaCombo.this.populateShemaCombo();
- }
- }
- }
- });
- }
-
- public void schemaChanged(ConnectionProfile profile, final Schema schema) {
- getControl().getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (schema == SchemaCombo.this.getTableSchema()) {
- if (!getControl().isDisposed()) {
- SchemaCombo.this.populateShemaCombo();
- }
- }
- }
- });
- }
-
- public void tableChanged(ConnectionProfile profile, final Table table) {
- // not interested to this event.
- }
- };
- }
-
- @Override
- protected void buildWidget(Composite parent) {
- this.combo = getWidgetFactory().createCCombo(parent, SWT.FLAT);
- this.combo.add(JptUiMappingsMessages.TableComposite_defaultEmpty);
- this.combo.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- if (isPopulating()) {
- return;
- }
- String schemaText = ((CCombo) e.getSource()).getText();
- if (schemaText.equals("")) { //$NON-NLS-1$
- schemaText = null;
- if (SchemaCombo.this.table.getSpecifiedSchema() == null || SchemaCombo.this.table.getSpecifiedSchema().equals("")) { //$NON-NLS-1$
- return;
- }
- }
- if (schemaText != null && combo.getItemCount() > 0 && schemaText.equals(combo.getItem(0))) {
- schemaText = null;
- }
- if (SchemaCombo.this.table.getSpecifiedSchema() == null && schemaText != null) {
- SchemaCombo.this.table.setSpecifiedSchema(schemaText);
- }
- if (SchemaCombo.this.table.getSpecifiedSchema() != null && !SchemaCombo.this.table.getSpecifiedSchema().equals(schemaText)) {
- SchemaCombo.this.table.setSpecifiedSchema(schemaText);
- }
- }
- });
- }
-
- protected void schemaChanged(Notification notification) {
- if (notification.getFeatureID(ITable.class) == JpaCoreMappingsPackage.ITABLE__SPECIFIED_SCHEMA) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- SchemaCombo.this.populateSchemaName();
- }
- });
- }
- else if (notification.getFeatureID(ITable.class) == JpaCoreMappingsPackage.ITABLE__DEFAULT_SCHEMA) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- SchemaCombo.this.populateDefaultSchemaName();
- }
- });
- }
- else if (notification.getFeatureID(ITable.class) == JpaCoreMappingsPackage.ITABLE__DEFAULT_CATALOG) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- SchemaCombo.this.populateShemaCombo();
- }
- });
- }
- else if (notification.getFeatureID(ITable.class) == JpaCoreMappingsPackage.ITABLE__SPECIFIED_CATALOG) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- SchemaCombo.this.populateShemaCombo();
- }
- });
- }
- }
-
- public void doPopulate(EObject obj) {
- this.table = (ITable) obj;
- if (this.table != null) {
- this.populateShemaCombo();
- }
- else {
- this.connectionProfile = null;
- }
- }
-
- public void doPopulate() {
- this.populateShemaCombo();
- }
-
- protected Database getDatabase() {
- return this.getConnectionProfile().getDatabase();
- }
-
- private ConnectionProfile getConnectionProfile() {
- if (this.connectionProfile == null) {
- this.connectionProfile = this.table.getJpaProject().connectionProfile();
- }
- return this.connectionProfile;
- }
-
- private void populateShemaCombo() {
- if (this.table == null) {
- return;
- }
- this.populateDefaultSchemaName();
- if (this.getConnectionProfile().isConnected()) {
- this.combo.remove(1, this.combo.getItemCount() - 1);
- Database database = this.getDatabase();
- if (database != null) {
- Iterator<String> schemata = database.schemaNames();
- for (Iterator<String> stream = CollectionTools.sort(schemata); stream.hasNext();) {
- this.combo.add(stream.next());
- }
- }
- }
- else {
- this.combo.remove(1, this.combo.getItemCount() - 1);
- }
- this.populateSchemaName();
- }
-
- protected void populateDefaultSchemaName() {
- String defaultSchemaName = this.table.getDefaultSchema();
- int selectionIndex = combo.getSelectionIndex();
- combo.setItem(0, NLS.bind(JptUiMappingsMessages.TableComposite_defaultWithOneParam, defaultSchemaName));
- if (selectionIndex == 0) {
- combo.clearSelection();
- combo.select(0);
- }
- }
-
- protected void populateSchemaName() {
- if (this.table == null) {
- return;
- }
- String schemaName = this.table.getSpecifiedSchema();
- String defaultSchemaName = this.table.getDefaultSchema();
- if (!StringTools.stringIsEmpty(schemaName)) {
- if (!this.combo.getText().equals(schemaName)) {
- this.combo.setText(schemaName);
- }
- }
- else {
- if (!this.combo.getText().equals(NLS.bind(JptUiMappingsMessages.TableComposite_defaultWithOneParam, defaultSchemaName))) {
- this.combo.select(0);
- }
- }
- }
-
- public CCombo getCombo() {
- return this.combo;
- }
-
- @Override
- public Control getControl() {
- return getCombo();
- }
-
- protected Schema getTableSchema() {
- return this.getConnectionProfile().getDatabase().schemaNamed(table.getSchema());
- }
-
- @Override
- protected void disengageListeners() {
- if (this.table != null) {
- this.removeConnectionListener();
- this.table.eAdapters().remove(this.listener);
- }
- }
-
- @Override
- protected void engageListeners() {
- if (this.table != null) {
- this.table.eAdapters().add(this.listener);
- this.addConnectionListener();
- }
- }
-
- private void addConnectionListener() {
- this.getConnectionProfile().addConnectionListener(this.connectionListener);
- }
-
- private void removeConnectionListener() {
- this.getConnectionProfile().removeConnectionListener(this.connectionListener);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/SecondaryTableDialog.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/SecondaryTableDialog.java
deleted file mode 100644
index 14be07b492..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/SecondaryTableDialog.java
+++ /dev/null
@@ -1,247 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.mappings.details;
-
-import java.util.Iterator;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jpt.core.internal.IJpaProject;
-import org.eclipse.jpt.core.internal.mappings.IEntity;
-import org.eclipse.jpt.core.internal.mappings.ISecondaryTable;
-import org.eclipse.jpt.db.internal.ConnectionProfile;
-import org.eclipse.jpt.db.internal.Database;
-import org.eclipse.jpt.db.internal.Schema;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-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;
-
-public class SecondaryTableDialog extends Dialog {
-
- //if creating a new JoinColumn, this will be null,
- //specify the JoinColumnOwner instead in the appropriate construtor
- private ISecondaryTable secondaryTable;
- private IEntity entity;
-
- protected Combo nameCombo;
- protected Combo catalogCombo;
- protected Combo schemaCombo;
-
- private String selectedName;
- private String selectedSchema;
- private String selectedCatalog;
-
- private boolean defaultSchemaSelected;
- private boolean defaultCatalogSelected;
-
- SecondaryTableDialog(Shell parent, IEntity entity) {
- super(parent);
- this.entity = entity;
- }
-
- SecondaryTableDialog(Shell parent, ISecondaryTable secondaryTable, IEntity entity) {
- super(parent);
- this.secondaryTable = secondaryTable;
- this.entity = entity;
- }
-
- protected void configureShell(Shell shell) {
- super.configureShell(shell);
- shell.setText(getTitle());
- }
-
- protected String getTitle() {
- return JptUiMappingsMessages.SecondaryTableDialog_editSecondaryTable;
- }
-
- protected Control createDialogArea(Composite parent) {
- Composite composite = (Composite) super.createDialogArea(parent);
- GridLayout gridLayout = (GridLayout) composite.getLayout();
- gridLayout.numColumns = 2;
-
- Label nameLabel = new Label(composite, SWT.LEFT);
- nameLabel.setText(JptUiMappingsMessages.SecondaryTableDialog_name);
- GridData gridData = new GridData();
- nameLabel.setLayoutData(gridData);
-
- this.nameCombo = new Combo(composite, SWT.LEFT);
- gridData = new GridData();
- gridData.grabExcessHorizontalSpace = true;
- gridData.horizontalAlignment = SWT.FILL;
- this.nameCombo.setLayoutData(gridData);
- populateNameCombo();
-
- Label catalogLabel = new Label(composite, SWT.LEFT);
- catalogLabel.setText(JptUiMappingsMessages.SecondaryTableDialog_catalog);
- gridData = new GridData();
- catalogLabel.setLayoutData(gridData);
-
- this.catalogCombo = new Combo(composite, SWT.LEFT);
- gridData = new GridData();
- gridData.grabExcessHorizontalSpace = true;
- gridData.horizontalAlignment = SWT.FILL;
- this.catalogCombo.setLayoutData(gridData);
- populateCatalogCombo();
-
- Label schemaLabel = new Label(composite, SWT.LEFT);
- schemaLabel.setText(JptUiMappingsMessages.SecondaryTableDialog_schema);
- gridData = new GridData();
- schemaLabel.setLayoutData(gridData);
-
- this.schemaCombo = new Combo(composite, SWT.LEFT);
- gridData = new GridData();
- gridData.grabExcessHorizontalSpace = true;
- gridData.horizontalAlignment = SWT.FILL;
- this.schemaCombo.setLayoutData(gridData);
- populateSchemaCombo();
-
- return composite;
- }
-
- protected Database getDatabase() {
- return this.getConnectionProfile().getDatabase();
- }
-
- private ConnectionProfile getConnectionProfile() {
- IJpaProject project = (this.secondaryTable == null) ? this.entity.getJpaProject() : this.secondaryTable.getJpaProject();
- return project.connectionProfile();
- }
-
- protected Schema getTableSchema() {
- Database database = this.getDatabase();
- if (database != null) {
- if (this.secondaryTable != null) {
- return database.schemaNamed(this.secondaryTable.getSchema());
- }
- return database.schemaNamed(this.entity.getTable().getSchema());
- }
- return null;
- }
-
- protected void populateNameCombo() {
- Schema schema = this.getTableSchema();
- if (schema != null) {
- Iterator<String> tables = schema.tableNames();
- for (Iterator<String> stream = CollectionTools.sort( tables); stream.hasNext(); ) {
- this.nameCombo.add(stream.next());
- }
- }
-
- if (getSecondaryTable() != null) {
- if (getSecondaryTable().getSpecifiedName() != null) {
- this.nameCombo.setText(getSecondaryTable().getSpecifiedName());
- }
- }
- }
-
- protected void populateSchemaCombo() {
- if (getSecondaryTable() != null) {
- this.schemaCombo.add(NLS.bind(JptUiMappingsMessages.SecondaryTableDialog_defaultSchema, getSecondaryTable().getDefaultSchema()));
- }
-
- Database database = this.getDatabase();
-
- if (database != null) {
- Iterator<String> schemata = database.schemaNames();
- for (Iterator<String> stream = CollectionTools.sort(schemata); stream.hasNext(); ) {
- this.schemaCombo.add(stream.next());
- }
- }
-
- if (getSecondaryTable() != null) {
- if (getSecondaryTable().getSpecifiedSchema() != null) {
- this.schemaCombo.setText(getSecondaryTable().getSpecifiedSchema());
- }
- else {
- this.schemaCombo.select(0);
- }
- }
- }
-
- protected void populateCatalogCombo() {
- if (getSecondaryTable() != null) {
- this.catalogCombo.add(NLS.bind(JptUiMappingsMessages.SecondaryTableDialog_defaultCatalog, getSecondaryTable().getDefaultCatalog()));
- }
- Database database = this.getDatabase();
-
- if (database != null) {
- Iterator<String> catalogs = database.catalogNames();
- for (Iterator<String> stream = CollectionTools.sort(catalogs); stream.hasNext(); ) {
- this.catalogCombo.add(stream.next());
- }
- }
-
- if (getSecondaryTable() != null) {
- if (getSecondaryTable().getSpecifiedCatalog() != null) {
- this.catalogCombo.setText(getSecondaryTable().getSpecifiedCatalog());
- }
- else {
- this.catalogCombo.select(0);
- }
- }
- }
-
- protected Combo getNameCombo() {
- return this.nameCombo;
- }
-
- protected Combo getSchemaCombo() {
- return this.schemaCombo;
- }
-
- protected Combo getCatalogCombo() {
- return this.catalogCombo;
- }
-
- protected ISecondaryTable getSecondaryTable() {
- return this.secondaryTable;
- }
-
-
- protected String getSelectedName() {
- return this.selectedName;
- }
-
- protected String getSelectedCatalog() {
- return this.selectedCatalog;
- }
-
- protected String getSelectedSchema() {
- return this.selectedSchema;
- }
-
- protected boolean isDefaultSchemaSelected() {
- return this.defaultSchemaSelected;
- }
-
- protected boolean isDefaultCatalogSelected() {
- return this.defaultCatalogSelected;
- }
-
- public boolean close() {
- this.selectedName = this.nameCombo.getText();
- this.selectedSchema = this.schemaCombo.getText();
- if (this.selectedSchema.equals("")) {
- this.selectedSchema = null;
- }
- this.selectedCatalog = this.catalogCombo.getText();
- if (this.selectedCatalog.equals("")) {
- this.selectedCatalog = null;
- }
- this.defaultSchemaSelected = this.schemaCombo.getSelectionIndex() == 0;
- this.defaultCatalogSelected = this.catalogCombo.getSelectionIndex() == 0;
- return super.close();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/SecondaryTablesComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/SecondaryTablesComposite.java
deleted file mode 100644
index 052cd72f48..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/SecondaryTablesComposite.java
+++ /dev/null
@@ -1,388 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.mappings.details;
-
-import java.util.Iterator;
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jface.viewers.IContentProvider;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.ListViewer;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jpt.core.internal.mappings.IEntity;
-import org.eclipse.jpt.core.internal.mappings.ISecondaryTable;
-import org.eclipse.jpt.core.internal.mappings.ITable;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.ui.internal.details.BaseJpaComposite;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-//TODO handle xml, how to handle virtual secondaryTables, adding them to xml, are they overriden, etc??
-public class SecondaryTablesComposite extends BaseJpaComposite
-{
- private IEntity entity;
- private final Adapter entityListener;
- private final Adapter secondaryTableListener;
-
- ListViewer secondaryTablesListViewer;
-
- private Button addButton;
- private Button editButton;
- private Button removeButton;
-
- private PrimaryKeyJoinColumnsInSecondaryTableComposite pkJoinColumnsComposite;
-
- public SecondaryTablesComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, SWT.NULL, commandStack, widgetFactory);
- this.entityListener = buildEntityListener();
- this.secondaryTableListener = buildSecondaryTableListener();
- }
-
- private Adapter buildEntityListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- entityChanged(notification);
- }
- };
- }
-
- private Adapter buildSecondaryTableListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- seoncaryTableChanged(notification);
- }
- };
- }
-
- @Override
- protected void initializeLayout(Composite composite) {
- GridLayout layout = new GridLayout(2, false);
- layout.marginWidth = 0;
- composite.setLayout(layout);
-
- GridData gridData = new GridData();
-
- Composite secondaryTablesComposite = new Composite(composite, SWT.NONE);
- layout = new GridLayout(3, false);
- layout.marginWidth = 0;
- secondaryTablesComposite.setLayout(layout);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- secondaryTablesComposite.setLayoutData(gridData);
-
- this.secondaryTablesListViewer = buildSecondaryTablesListViewer(secondaryTablesComposite);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- gridData.horizontalSpan = 3;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- this.secondaryTablesListViewer.getList().setLayoutData(gridData);
- //PlatformUI.getWorkbench().getHelpSystem().setHelp(this.secondaryTablesListViewer.getList(), IJpaHelpContextIds.MAPPING_JOIN_TABLE_COLUMNS);
-
- Composite buttonsComposite = new Composite(secondaryTablesComposite, SWT.NONE);
- layout = new GridLayout(3, false);
- layout.marginWidth = 0;
- buttonsComposite.setLayout(layout);
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.END;
- buttonsComposite.setLayoutData(gridData);
-
- this.addButton = getWidgetFactory().createButton(
- buttonsComposite,
- JptUiMappingsMessages.SecondaryTablesComposite_add,
- SWT.NONE);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- this.addButton.setLayoutData(gridData);
- this.addButton.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- // do nothing
- }
-
- public void widgetSelected(SelectionEvent e) {
- addSecondaryTable();
- }
- });
-
- this.editButton = getWidgetFactory().createButton(
- buttonsComposite,
- JptUiMappingsMessages.SecondaryTablesComposite_edit,
- SWT.NONE);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- this.editButton.setLayoutData(gridData);
- this.editButton.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- // do nothing
- }
-
- public void widgetSelected(SelectionEvent e) {
- editSecondaryTable();
- }
- });
-
- this.removeButton = getWidgetFactory().createButton(
- buttonsComposite,
- JptUiMappingsMessages.SecondaryTablesComposite_remove,
- SWT.NONE);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.BEGINNING;
- this.removeButton.setLayoutData(gridData);
- this.removeButton.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- // do nothing
- }
-
- public void widgetSelected(SelectionEvent e) {
- removeSecondaryTable();
- }
- });
-
- this.pkJoinColumnsComposite = new PrimaryKeyJoinColumnsInSecondaryTableComposite(composite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- this.pkJoinColumnsComposite.getControl().setLayoutData(gridData);
- }
-
- private ListViewer buildSecondaryTablesListViewer(Composite parent) {
- ListViewer listViewer = new ListViewer(parent, SWT.SINGLE | SWT.BORDER);
- listViewer.setLabelProvider(buildSecondaryTablesListLabelProvider());
- listViewer.setContentProvider(buildSecondaryTablesListContentProvider());
-
- listViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- updateEnablement();
- secondaryTablesListSelectionChanged(event);
- }
- });
-
- return listViewer;
- }
-
- protected void secondaryTablesListSelectionChanged(SelectionChangedEvent event) {
- if (((StructuredSelection) event.getSelection()).isEmpty()) {
- this.pkJoinColumnsComposite.populate(null);
- this.pkJoinColumnsComposite.enableWidgets(false);
- }
- else {
- ISecondaryTable selectedSecondaryTable = getSelectedSecondaryTable();
- this.pkJoinColumnsComposite.populate(selectedSecondaryTable);
- this.pkJoinColumnsComposite.enableWidgets(true);
- }
- }
-
- private IContentProvider buildSecondaryTablesListContentProvider() {
- return new IStructuredContentProvider(){
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- // do nothing
- }
-
- public void dispose() {
- // do nothing
- }
-
- public Object[] getElements(Object inputElement) {
- return ((IEntity) inputElement).getSecondaryTables().toArray();
- }
- };
- }
-
- private ILabelProvider buildSecondaryTablesListLabelProvider() {
- return new LabelProvider() {
- public String getText(Object element) {
- //TODO display a qualified name instead
- ISecondaryTable secondaryTable = (ISecondaryTable) element;
- return secondaryTable.getName();
- }
- };
- }
-
- void addSecondaryTable() {
- SecondaryTableDialog dialog = new SecondaryTableDialog(this.getControl().getShell(), this.entity);
- addSecondaryTableFromDialog(dialog);
- }
-
- private void addSecondaryTableFromDialog(SecondaryTableDialog dialog) {
- if (dialog.open() == Window.OK) {
- int index = this.entity.getSpecifiedSecondaryTables().size();
- String name = dialog.getSelectedName();
- String catalog = dialog.getSelectedCatalog();
- String schema = dialog.getSelectedSchema();
- ISecondaryTable secondaryTable = this.entity.createSecondaryTable(index);
- this.entity.getSpecifiedSecondaryTables().add(secondaryTable);
- secondaryTable.setSpecifiedName(name);
- secondaryTable.setSpecifiedCatalog(catalog);
- secondaryTable.setSpecifiedSchema(schema);
-
- this.secondaryTablesListViewer.setSelection(new StructuredSelection(secondaryTable));
- }
- }
-
- void editSecondaryTable() {
- ISecondaryTable secondaryTable = getSelectedSecondaryTable();
- SecondaryTableDialog dialog = new SecondaryTableDialog(this.getControl().getShell(), secondaryTable, this.entity);
- editSecondaryTableFromDialog(dialog, secondaryTable);
- }
-
- private void editSecondaryTableFromDialog(SecondaryTableDialog dialog, ISecondaryTable secondaryTable) {
- if (dialog.open() == Window.OK) {
- editSecondaryTableDialogOkd(dialog, secondaryTable);
- }
- }
-
- private void editSecondaryTableDialogOkd(SecondaryTableDialog dialog, ISecondaryTable secondaryTable) {
- String name = dialog.getSelectedName();
- String catalog = dialog.getSelectedCatalog();
- String schema = dialog.getSelectedSchema();
-
- if (secondaryTable.getSpecifiedName() == null || !secondaryTable.getSpecifiedName().equals(name)){
- secondaryTable.setSpecifiedName(name);
- }
-
- if (dialog.isDefaultCatalogSelected()) {
- if (secondaryTable.getSpecifiedCatalog() != null) {
- secondaryTable.setSpecifiedCatalog(null);
- }
- }
- else if (secondaryTable.getSpecifiedCatalog() == null || !secondaryTable.getSpecifiedCatalog().equals(catalog)){
- secondaryTable.setSpecifiedCatalog(catalog);
- }
-
- if (dialog.isDefaultSchemaSelected()) {
- if (secondaryTable.getSpecifiedSchema() != null) {
- secondaryTable.setSpecifiedSchema(null);
- }
- }
- else if (secondaryTable.getSpecifiedSchema() == null || !secondaryTable.getSpecifiedSchema().equals(schema)){
- secondaryTable.setSpecifiedSchema(schema);
- }
- }
-
- private ISecondaryTable getSelectedSecondaryTable() {
- return (ISecondaryTable) ((StructuredSelection) this.secondaryTablesListViewer.getSelection()).getFirstElement();
- }
-
-
- void removeSecondaryTable() {
- ISelection selection = this.secondaryTablesListViewer.getSelection();
- if (selection instanceof StructuredSelection) {
- for (Iterator<ISecondaryTable> i = ((StructuredSelection) selection).iterator(); i.hasNext(); ) {
- this.entity.getSpecifiedSecondaryTables().remove(i.next());
- }
- }
- }
-
- void updateEnablement() {
- this.editButton.setEnabled(!((StructuredSelection) this.secondaryTablesListViewer.getSelection()).isEmpty());
- this.removeButton.setEnabled(!((StructuredSelection) this.secondaryTablesListViewer.getSelection()).isEmpty());
- }
-
- public void doPopulate(EObject obj) {
- this.entity = (IEntity) obj;
- if (this.entity == null) {
- this.secondaryTablesListViewer.setInput(null);
- return;
- }
-
- this.secondaryTablesListViewer.setInput(this.entity);
- if (!this.entity.getSecondaryTables().isEmpty()) {
- this.secondaryTablesListViewer.setSelection(new StructuredSelection(this.entity.getSecondaryTables().get(0)));
- }
- else {
- this.secondaryTablesListViewer.setSelection(null);
- }
- updateEnablement();
- }
-
- @Override
- protected void doPopulate() {
- }
-
- protected void engageListeners() {
- if (this.entity != null) {
- this.entity.eAdapters().add(this.entityListener);
- for (ISecondaryTable secondaryTable : this.entity.getSecondaryTables()) {
- secondaryTable.eAdapters().add(this.secondaryTableListener);
- }
- }
- }
-
- protected void disengageListeners() {
- if (this.entity != null) {
- for (ISecondaryTable secondaryTable : this.entity.getSecondaryTables()) {
- secondaryTable.eAdapters().remove(this.secondaryTableListener);
- }
- this.entity.eAdapters().remove(this.entityListener);
- }
- }
-
- protected void entityChanged(Notification notification) {
- if (notification.getFeatureID(IEntity.class) == JpaCoreMappingsPackage.IENTITY__SPECIFIED_SECONDARY_TABLES) {
- if (notification.getEventType() == Notification.ADD) {
- ((ISecondaryTable) notification.getNewValue()).eAdapters().add(this.secondaryTableListener);
- }
- else if (notification.getEventType() == Notification.REMOVE) {
- ((ISecondaryTable) notification.getOldValue()).eAdapters().remove(this.secondaryTableListener);
- }
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- secondaryTablesListViewer.refresh();
- updateEnablement();
- }
- });
- }
- }
-
- protected void seoncaryTableChanged(Notification notification) {
- if (notification.getFeatureID(ITable.class) == JpaCoreMappingsPackage.ITABLE__SPECIFIED_NAME
- || notification.getFeatureID(ITable.class) == JpaCoreMappingsPackage.ITABLE__SPECIFIED_CATALOG
- || notification.getFeatureID(ITable.class) == JpaCoreMappingsPackage.ITABLE__SPECIFIED_SCHEMA
- || notification.getFeatureID(ITable.class) == JpaCoreMappingsPackage.ITABLE__DEFAULT_CATALOG
- || notification.getFeatureID(ITable.class) == JpaCoreMappingsPackage.ITABLE__DEFAULT_SCHEMA) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- secondaryTablesListViewer.refresh();
- }
- });
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/SequenceGeneratorComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/SequenceGeneratorComposite.java
deleted file mode 100644
index 9be54c3668..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/SequenceGeneratorComposite.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.mappings.details;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.IJpaProject;
-import org.eclipse.jpt.core.internal.mappings.IId;
-import org.eclipse.jpt.core.internal.mappings.ISequenceGenerator;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.db.internal.ConnectionProfile;
-import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.help.IWorkbenchHelpSystem;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-/**
- * SequenceGeneratorComposite
- */
-public class SequenceGeneratorComposite extends GeneratorComposite<ISequenceGenerator>
-{
- private CCombo sequenceNameCombo;
-
- private ModifyListener sequenceNameComboListener;
-
- private ConnectionProfile connectionProfile;
-
- public SequenceGeneratorComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, commandStack, widgetFactory);
- }
-
- protected ISequenceGenerator createGenerator() {
- ISequenceGenerator sequenceGenerator = idMapping().createSequenceGenerator();
- idMapping().setSequenceGenerator(sequenceGenerator);
- return sequenceGenerator;
- }
-
- protected ISequenceGenerator generator(IId idMapping) {
- return idMapping.getSequenceGenerator();
- }
-
- @Override
- protected void initializeLayout(Composite composite) {
- IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
-
- GridLayout layout = new GridLayout(2, false);
- composite.setLayout(layout);
- getWidgetFactory().createLabel(composite, JptUiMappingsMessages.SequenceGeneratorComposite_name);
-
- this.nameTextWidget = buildNameText(composite);
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- this.nameTextWidget.setLayoutData(gridData);
- helpSystem.setHelp(this.nameTextWidget, IJpaHelpContextIds.MAPPING_SEQUENCE_GENERATOR_NAME);
-
- getWidgetFactory().createLabel(composite, JptUiMappingsMessages.SequenceGeneratorComposite_sequence);
-
- this.sequenceNameCombo = buildSequenceNameCombo(composite);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- this.sequenceNameCombo.setLayoutData(gridData);
- helpSystem.setHelp(sequenceNameCombo, IJpaHelpContextIds.MAPPING_SEQUENCE_GENERATOR_SEQUENCE);
- }
-
- private CCombo buildSequenceNameCombo(Composite parent) {
- CCombo combo = getWidgetFactory().createCCombo(parent, SWT.FLAT);
- combo.add(""); //$NON-NLS-1$
- combo.select(0);
- combo.addModifyListener(getSequenceNameListener());
- return combo;
- }
-
- private ModifyListener getSequenceNameListener() {
- if (this.sequenceNameComboListener == null) {
- this.sequenceNameComboListener = new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- if (isPopulating()) {
- return;
- }
- String text = ((CCombo) e.getSource()).getText();
- if (text != null && sequenceNameCombo.getItemCount() > 0 && text.equals(sequenceNameCombo.getItem(0))) {
- text = null;
- }
- ISequenceGenerator generator = getGenerator();
- if (generator == null) {
- generator = createGenerator();
- }
- generator.setSpecifiedSequenceName(text);
- }
- };
- }
- return this.sequenceNameComboListener;
- }
-
- protected void generatorChanged(Notification notification) {
- super.generatorChanged(notification);
- if (notification.getFeatureID(ISequenceGenerator.class) == JpaCoreMappingsPackage.ISEQUENCE_GENERATOR__SPECIFIED_SEQUENCE_NAME) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- String sequenceName = getGenerator().getSpecifiedSequenceName();
- if (sequenceName == null) {
- sequenceNameCombo.select(0);
- }
- else if (!sequenceNameCombo.getText().equals(sequenceName)) {
- sequenceNameCombo.setText(sequenceName);
- }
- }
- });
- }
- }
-
- @Override
- protected void doPopulate(EObject obj) {
- super.doPopulate(obj);
- if (obj == null) {
- return;
- }
- populateSequenceNameCombo();
- }
-
- @Override
- protected void doPopulate() {
- populateSequenceNameCombo();
- }
-
- private ConnectionProfile getConnectionProfile() {
- if(this.connectionProfile == null) {
- IJpaProject jpaProject = getGenerator().getJpaProject();
- this.connectionProfile = jpaProject.connectionProfile();
- }
- return this.connectionProfile;
- }
-
- private void populateSequenceNameCombo() {
- if (this.getGenerator() == null) {
- return;
- }
- this.sequenceNameCombo.setItem(0, JptUiMappingsMessages.SequenceGeneratorComposite_default);
- if (this.getConnectionProfile().isConnected()) {
-// this.sequenceNameCombo.remove(1, this.sequenceNameCombo.getItemCount() - 1);
-// Schema schema = getConnectionProfile().getDatabase().schemaNamed(getGenerator().getJpaProject().getSchemaName());
-// if (schema != null) {
-// for (Iterator stream = CollectionTools.sort(schema.sequenceNames()); stream.hasNext();) {
-// this.sequenceNameCombo.add((String) stream.next());
-// }
-// }
- }
- String sequenceName = this.getGenerator().getSpecifiedSequenceName();
- if (sequenceName != null) {
- if (!this.sequenceNameCombo.getText().equals(sequenceName)) {
- this.sequenceNameCombo.setText(sequenceName);
- }
- }
- else {
- this.sequenceNameCombo.select(0);
- }
- }
-
- protected void clear() {
- super.clear();
- this.sequenceNameCombo.select(0);
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/StringWithDefaultChooser.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/StringWithDefaultChooser.java
deleted file mode 100644
index 57c7624201..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/StringWithDefaultChooser.java
+++ /dev/null
@@ -1,274 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.mappings.details;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jface.viewers.IBaseLabelProvider;
-import org.eclipse.jface.viewers.IContentProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jpt.ui.internal.details.BaseJpaController;
-import org.eclipse.jpt.ui.internal.widgets.CComboViewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class StringWithDefaultChooser extends BaseJpaController
-{
- private StringHolder stringHolder;
- private Adapter stringHolderListener;
-
- private CComboViewer comboViewer;
-
- private static final String DEFAULT = "default";
-
-
- public StringWithDefaultChooser(Composite parent, CommandStack theCommandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, theCommandStack, widgetFactory);
- buildStringHolderListener();
- }
-
-
- private void buildStringHolderListener() {
- this.stringHolderListener = new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- stringHolderChanged(notification);
- }
- };
- }
-
- @Override
- protected void buildWidget(Composite parent) {
- CCombo combo = getWidgetFactory().createCCombo(parent, SWT.FLAT);
- this.comboViewer = new CComboViewer(combo);
- this.comboViewer.setContentProvider(buildContentProvider());
- this.comboViewer.setLabelProvider(buildLabelProvider());
-
- this.comboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- StringWithDefaultChooser.this.selectionChanged(event.getSelection());
- }
- });
-
- combo.addModifyListener(
- new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- comboModified(e);
- }
- });
- }
-
- private IContentProvider buildContentProvider() {
- return new IStructuredContentProvider(){
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
-
- public void dispose() {
- }
-
- public Object[] getElements(Object inputElement) {
- return new String[] {DEFAULT};
- }
- };
- }
-
-
- private IBaseLabelProvider buildLabelProvider() {
- return new LabelProvider() {
- @Override
- public String getText(Object element) {
- if (element == DEFAULT && stringHolder.wrappedObject() != null) {
- return stringHolder.defaultItem();
- }
- return super.getText(element);
- }
- };
- }
- void selectionChanged(ISelection sel) {
- if (isPopulating()) {
- return;
- }
-
- if (sel instanceof IStructuredSelection) {
- String selection = (String) ((IStructuredSelection) sel).getFirstElement();
- if (this.comboViewer.getCombo().getSelectionIndex() == 0) {
- selection = null;
- }
- if (this.stringHolder.getString() == null) {
- if (selection != null) {
- this.stringHolder.setString(selection);
- }
- }
- else if (!this.stringHolder.getString().equals(selection)) {
- this.stringHolder.setString(selection);
- }
- }
- }
-
- private void comboModified(ModifyEvent e) {
- if (isPopulating()) {
- return;
- }
- CCombo combo = (CCombo) e.getSource();
- combo.getSelectionIndex();
- String text = combo.getText();
-
- if (text != null && combo.getItemCount() > 0 && text.equals(combo.getItem(0))) {
- text = null;
- }
- if (this.stringHolder.getString() != text) {
- this.stringHolder.setString(text);
- }
- }
-
- private void stringHolderChanged(Notification notification) {
- if (notification.getFeatureID(this.stringHolder.featureClass()) ==
- this.stringHolder.featureId()) {
- Display.getDefault().asyncExec(
- new Runnable() {
- public void run() {
- if (getCombo().isDisposed()) {
- return;
- }
- populate();
- }
- });
- }
- else if (this.stringHolder.supportsDefault()) {
- if (notification.getFeatureID(this.stringHolder.featureClass()) ==
- this.stringHolder.defaultFeatureId()) {
- Display.getDefault().asyncExec(
- new Runnable() {
- public void run() {
- if (getCombo().isDisposed()) {
- return;
- }
- populate();
- }
- });
-
- }
- }
- }
-
- @Override
- protected void engageListeners() {
- if (this.stringHolder != null && this.stringHolder.wrappedObject() != null) {
- this.stringHolder.wrappedObject().eAdapters().add(this.stringHolderListener);
- }
- }
-
- @Override
- protected void disengageListeners() {
- if (this.stringHolder != null && this.stringHolder.wrappedObject() != null) {
- this.stringHolder.wrappedObject().eAdapters().remove(this.stringHolderListener);
- }
- }
-
- @Override
- public void doPopulate(EObject obj) {
- this.stringHolder = (StringHolder) obj;
- this.comboViewer.setInput(this.stringHolder);
- populateCombo();
- }
-
- @Override
- protected void doPopulate() {
- populateCombo();
- }
-
- private void populateCombo() {
- if (this.stringHolder.wrappedObject() == null) {
- this.comboViewer.setSelection(StructuredSelection.EMPTY);
- return;
- }
- this.comboViewer.update(this.comboViewer.getElementAt(0), null);
-
- String string = this.stringHolder.getString();
- if (string == null) {
- if (((StructuredSelection) this.comboViewer.getSelection()).getFirstElement() == DEFAULT) {
- this.comboViewer.refresh();
- }
- else {
- this.comboViewer.setSelection(new StructuredSelection(DEFAULT));
- }
- }
- else {
- if (!this.comboViewer.getCombo().getText().equals(string)) {
- this.comboViewer.getCombo().setText(string);
- }
- }
- }
-
- public CCombo getCombo() {
- return this.comboViewer.getCombo();
- }
-
- @Override
- public Control getControl() {
- return getCombo();
- }
- /**
- * An interface to wrap an object that supports a string with a default setting
- * An object of this type must be passed in to populate(EObject)
- */
- public static interface StringHolder extends EObject {
- /**
- * Return the string setting from the wrapped object
- * @return
- */
- String getString();
-
- /**
- * Set the string setting on the wrapped object
- * @param string
- */
- void setString(String string);
-
- /**
- * Return the Class of the wrapped object
- * @return
- */
- Class featureClass();
-
- /**
- * Return the feature id of string setting on the wrapped object
- * @return
- */
- int featureId();
-
- boolean supportsDefault();
-
- int defaultFeatureId();
-
- /**
- * The wrapped EObject that the enum setting is stored on
- * @return
- */
- EObject wrappedObject();
-
- String defaultItem();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TableCombo.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TableCombo.java
deleted file mode 100644
index 68e148bc9a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TableCombo.java
+++ /dev/null
@@ -1,338 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.mappings.details;
-
-import java.util.Iterator;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.mappings.ITable;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.db.internal.ConnectionListener;
-import org.eclipse.jpt.db.internal.ConnectionProfile;
-import org.eclipse.jpt.db.internal.Database;
-import org.eclipse.jpt.db.internal.Schema;
-import org.eclipse.jpt.db.internal.Table;
-import org.eclipse.jpt.ui.internal.details.BaseJpaController;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class TableCombo extends BaseJpaController
-{
- private ITable table;
-
- private Adapter listener;
-
- /**
- * Caching the connectionProfile so we can remove the listener. If the
- * cached table object has been removed from the model then we no longer
- * have access to parent and cannot find the connectionProfile
- */
- private ConnectionProfile connectionProfile;
-
- private ConnectionListener connectionListener;
-
- private CCombo combo;
-
- public TableCombo(Composite parent, CommandStack theCommandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, theCommandStack, widgetFactory);
- this.listener = buildTableListener();
- this.connectionListener = buildConnectionListener();
- }
-
- private Adapter buildTableListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- tableChanged(notification);
- }
- };
- }
-
- private ConnectionListener buildConnectionListener() {
- return new ConnectionListener() {
- public void aboutToClose(ConnectionProfile profile) {
- // not interested to this event.
- }
-
- public void closed(ConnectionProfile profile) {
- getCombo().getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- TableCombo.this.populateTableCombo();
- }
- });
- }
-
- public void modified(ConnectionProfile profile) {
- getCombo().getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- TableCombo.this.populateTableCombo();
- }
- });
- }
-
- public boolean okToClose(ConnectionProfile profile) {
- // not interested to this event.
- return true;
- }
-
- public void opened(ConnectionProfile profile) {
- getCombo().getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- TableCombo.this.populateTableCombo();
- }
- });
- }
-
- public void databaseChanged(ConnectionProfile profile, final Database database) {
- getControl().getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (database == TableCombo.this.getDatabase()) {
- if (!getControl().isDisposed()) {
- TableCombo.this.populateTableCombo();
- }
- }
- }
- });
- }
-
- public void schemaChanged(ConnectionProfile profile, final Schema schema) {
- getControl().getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (schema == TableCombo.this.getTableSchema()) {
- if (!getControl().isDisposed()) {
- TableCombo.this.populateTableCombo();
- }
- }
- }
- });
- }
-
- public void tableChanged(ConnectionProfile profile, final Table table) {
- // not interested to this event.
- }
- };
- }
-
- @Override
- protected void buildWidget(Composite parent) {
- this.combo = getWidgetFactory().createCCombo(parent, SWT.FLAT);
- this.combo.add(JptUiMappingsMessages.TableComposite_defaultEmpty);
- this.combo.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- if (isPopulating()) {
- return;
- }
- String tableText = ((CCombo) e.getSource()).getText();
- if (tableText.equals("")) { //$NON-NLS-1$
- tableText = null;
- if (table.getSpecifiedName() == null || table.getSpecifiedName().equals("")) { //$NON-NLS-1$
- return;
- }
- }
- if (tableText != null && combo.getItemCount() > 0 && tableText.equals(combo.getItem(0))) {
- tableText = null;
- }
- if (table.getSpecifiedName() == null && tableText != null) {
- table.setSpecifiedName(tableText);
- }
- if (table.getSpecifiedName() != null && !table.getSpecifiedName().equals(tableText)) {
- table.setSpecifiedName(tableText);
- }
- }
- });
- }
-
- protected void tableChanged(Notification notification) {
- if (notification.getFeatureID(ITable.class) == JpaCoreMappingsPackage.ITABLE__SPECIFIED_NAME) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- populateTableName();
- }
- });
- }
- else if (notification.getFeatureID(ITable.class) == JpaCoreMappingsPackage.ITABLE__DEFAULT_NAME) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- populateDefaultTableName();
- }
- });
- }
- else if (notification.getFeatureID(ITable.class) == JpaCoreMappingsPackage.ITABLE__DEFAULT_SCHEMA) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- populateTableCombo();
- }
- });
- }
- else if (notification.getFeatureID(ITable.class) == JpaCoreMappingsPackage.ITABLE__SPECIFIED_SCHEMA) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- populateTableCombo();
- }
- });
- }
- }
-
- public void doPopulate(EObject obj) {
- this.table = (ITable) obj;
- if (this.table != null) {
- populateTableCombo();
- }
- else {
- this.connectionProfile = null;
- }
- }
-
- public void doPopulate() {
- if (this.table != null) {
- populateTableCombo();
- }
- }
-
- protected Database getDatabase() {
- return getConnectionProfile().getDatabase();
- }
-
- protected Schema getTableSchema() {
- return getConnectionProfile().getDatabase().schemaNamed(table.getSchema());
- }
-
- private ConnectionProfile getConnectionProfile() {
- if (this.connectionProfile == null) {
- this.connectionProfile = this.table.getJpaProject().connectionProfile();
- }
- return this.connectionProfile;
- }
-
- private void populateTableCombo() {
- if (this.table == null) {
- return;
- }
- // TODO don't do instanceof check here - check on Table, or isRoot check
- // on Entity
- // this.tableCombo.setEnabled(!(this.table instanceof
- // SingleTableInheritanceChildTableImpl));
- populateDefaultTableName();
- if (getConnectionProfile().isConnected()) {
- this.combo.remove(1, this.combo.getItemCount() - 1);
- Schema schema = this.getTableSchema();
- if (schema != null) {
- Iterator<String> tables = schema.tableNames();
- for (Iterator<String> stream = CollectionTools.sort(tables); stream.hasNext();) {
- this.combo.add(stream.next());
- }
- }
- }
- else {
- this.combo.remove(1, this.combo.getItemCount() - 1);
- }
- populateTableName();
- }
-
- protected void populateDefaultTableName() {
- if (this.table == null) {
- return;
- }
- String defaultTableName = table.getDefaultName();
- int selectionIndex = combo.getSelectionIndex();
- combo.setItem(0, NLS.bind(JptUiMappingsMessages.TableComposite_defaultWithOneParam, defaultTableName));
- if (selectionIndex == 0) {
- // combo text does not update when switching between 2 mappings of
- // the same type
- // that both have a default column name. clear the selection and
- // then set it again
- combo.clearSelection();
- combo.select(0);
- }
- }
-
- protected void populateTableName() {
- if (this.table == null) {
- return;
- }
- String tableName = this.table.getSpecifiedName();
- String defaultTableName = this.table.getDefaultName();
- if (tableName != null) {
- if (!this.combo.getText().equals(tableName)) {
- this.combo.setText(tableName);
- }
- }
- else {
- if (!this.combo.getText().equals(NLS.bind(JptUiMappingsMessages.TableComposite_defaultWithOneParam, defaultTableName))) {
- this.combo.select(0);
- }
- }
- }
-
- public CCombo getCombo() {
- return this.combo;
- }
-
- @Override
- public Control getControl() {
- return getCombo();
- }
-
- @Override
- protected void disengageListeners() {
- if (this.table != null) {
- this.removeConnectionListener();
- this.table.eAdapters().remove(this.listener);
- }
- }
-
- @Override
- protected void engageListeners() {
- if (this.table != null) {
- this.table.eAdapters().add(this.listener);
- this.addConnectionListener();
- }
- }
-
- private void addConnectionListener() {
- this.getConnectionProfile().addConnectionListener(this.connectionListener);
- }
-
- private void removeConnectionListener() {
- this.getConnectionProfile().removeConnectionListener(this.connectionListener);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TableComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TableComposite.java
deleted file mode 100644
index cc6f99ae00..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TableComposite.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.mappings.details;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.mappings.ITable;
-import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.details.BaseJpaComposite;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.help.IWorkbenchHelpSystem;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-//TODO repopulate this panel based on the Entity table changing
-public class TableComposite extends BaseJpaComposite
-{
- private ITable table;
-
- protected TableCombo tableCombo;
-
- protected CatalogCombo catalogCombo;
- protected SchemaCombo schemaCombo;
-
- public TableComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, SWT.NULL, commandStack, widgetFactory);
- }
-
- @Override
- protected void initializeLayout(Composite composite) {
- IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- composite.setLayout(layout);
-
- Group columnGroup = getWidgetFactory().createGroup(composite, JptUiMappingsMessages.TableComposite_tableSection);
- layout = new GridLayout();
- layout.marginHeight = 0;
- columnGroup.setLayout(layout);
- GridData gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace= true;
- columnGroup.setLayoutData(gridData);
-
- //created this composite because combos as direct children of a Group do not have a border, no clue why
- Composite intermediaryComposite = getWidgetFactory().createComposite(columnGroup);
- layout = new GridLayout(2, false);
- layout.marginWidth = 0;
- intermediaryComposite.setLayout(layout);
-
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace= true;
- intermediaryComposite.setLayoutData(gridData);
-
- CommonWidgets.buildTableLabel(intermediaryComposite, getWidgetFactory());
-
- this.tableCombo = new TableCombo(intermediaryComposite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.tableCombo.getCombo().setLayoutData(gridData);
- helpSystem.setHelp(tableCombo.getCombo(), IJpaHelpContextIds.ENTITY_TABLE);
-
- CommonWidgets.buildCatalogLabel(intermediaryComposite, getWidgetFactory());
- this.catalogCombo = new CatalogCombo(intermediaryComposite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.catalogCombo.getCombo().setLayoutData(gridData);
- helpSystem.setHelp(catalogCombo.getCombo(), IJpaHelpContextIds.ENTITY_CATALOG);
-
- CommonWidgets.buildSchemaLabel(intermediaryComposite, getWidgetFactory());
- this.schemaCombo = new SchemaCombo(intermediaryComposite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.schemaCombo.getCombo().setLayoutData(gridData);
- helpSystem.setHelp(schemaCombo.getCombo(), IJpaHelpContextIds.ENTITY_SCHEMA);
- }
-
- @Override
- protected void engageListeners() {
- }
-
- @Override
- protected void disengageListeners() {
- }
-
- public void doPopulate(EObject obj) {
- this.table = (ITable) obj;
- this.tableCombo.populate(this.table);
- this.catalogCombo.populate(this.table);
- this.schemaCombo.populate(this.table);
- }
-
- public void doPopulate() {
- this.tableCombo.populate();
- this.catalogCombo.populate();
- this.schemaCombo.populate();
- }
-
- @Override
- public void dispose() {
- this.catalogCombo.dispose();
- this.schemaCombo.dispose();
- this.tableCombo.dispose();
- super.dispose();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TableGeneratorComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TableGeneratorComposite.java
deleted file mode 100644
index 7426882c70..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TableGeneratorComposite.java
+++ /dev/null
@@ -1,535 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.mappings.details;
-
-import java.util.Iterator;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.IJpaProject;
-import org.eclipse.jpt.core.internal.mappings.IId;
-import org.eclipse.jpt.core.internal.mappings.ITableGenerator;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.db.internal.ConnectionListener;
-import org.eclipse.jpt.db.internal.ConnectionProfile;
-import org.eclipse.jpt.db.internal.Database;
-import org.eclipse.jpt.db.internal.Schema;
-import org.eclipse.jpt.db.internal.Table;
-import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.help.IWorkbenchHelpSystem;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class TableGeneratorComposite extends GeneratorComposite<ITableGenerator>
-{
- private CCombo tableNameCombo;
- private CCombo pkColumnNameCombo;
- private CCombo valueColumnNameCombo;
- private CCombo pkColumnValueCombo;
-
- private ConnectionListener connectionListener;
-
- private ConnectionProfile connectionProfile;
-
- public TableGeneratorComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, commandStack, widgetFactory);
- this.connectionListener = this.buildConnectionListener();
- }
-
- protected ITableGenerator createGenerator() {
- ITableGenerator tableGenerator = idMapping().createTableGenerator();
- idMapping().setTableGenerator(tableGenerator);
- return tableGenerator;
- }
-
- protected ITableGenerator generator(IId idMapping) {
- return idMapping.getTableGenerator();
- }
-
- @Override
- protected void initializeLayout(Composite composite) {
- GridLayout layout = new GridLayout(2, false);
- composite.setLayout(layout);
-
- IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
-
- getWidgetFactory().createLabel(composite, JptUiMappingsMessages.TableGeneratorComposite_name);
-
- this.nameTextWidget = buildNameText(composite);
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- this.nameTextWidget.setLayoutData(gridData);
- helpSystem.setHelp(this.nameTextWidget, IJpaHelpContextIds.MAPPING_TABLE_GENERATOR_NAME);
-
- getWidgetFactory().createLabel(composite, JptUiMappingsMessages.TableGeneratorComposite_table);
-
- this.tableNameCombo = buildTableNameCombo(composite);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- this.tableNameCombo.setLayoutData(gridData);
- helpSystem.setHelp(this.tableNameCombo, IJpaHelpContextIds.MAPPING_TABLE_GENERATOR_TABLE);
-
- getWidgetFactory().createLabel(composite, JptUiMappingsMessages.TableGeneratorComposite_pkColumn);
-
- this.pkColumnNameCombo = buildPkColumnNameCombo(composite);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- this.pkColumnNameCombo.setLayoutData(gridData);
- helpSystem.setHelp(this.pkColumnNameCombo, IJpaHelpContextIds.MAPPING_TABLE_GENERATOR_PRIMARY_KEY_COLUMN);
-
- getWidgetFactory().createLabel(composite, JptUiMappingsMessages.TableGeneratorComposite_valueColumn);
-
- this.valueColumnNameCombo = buildValueColumnNameCombo(composite);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- this.valueColumnNameCombo.setLayoutData(gridData);
- helpSystem.setHelp(this.valueColumnNameCombo, IJpaHelpContextIds.MAPPING_TABLE_GENERATOR_VALUE_COLUMN);
-
- getWidgetFactory().createLabel(composite, JptUiMappingsMessages.TableGeneratorComposite_pkColumnValue);
-
- this.pkColumnValueCombo = buildPkColumnValueCombo(composite);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- this.pkColumnValueCombo.setLayoutData(gridData);
- helpSystem.setHelp(this.pkColumnValueCombo, IJpaHelpContextIds.MAPPING_TABLE_GENERATOR_PRIMARY_KEY_COLUMN_VALUE);
- }
-
- private CCombo buildTableNameCombo(Composite parent) {
- CCombo combo = getWidgetFactory().createCCombo(parent, SWT.FLAT);
- combo.add(JptUiMappingsMessages.TableGeneratorComposite_default);
- combo.select(0);
- combo.addModifyListener(buildTableNameListener());
- return combo;
- }
-
- private CCombo buildPkColumnNameCombo(Composite parent) {
- CCombo combo = getWidgetFactory().createCCombo(parent, SWT.FLAT);
- combo.add(JptUiMappingsMessages.TableGeneratorComposite_default);
- combo.select(0);
- combo.addModifyListener(buildPkColumnNameListener());
- return combo;
- }
-
- private CCombo buildValueColumnNameCombo(Composite parent) {
- CCombo combo = getWidgetFactory().createCCombo(parent, SWT.FLAT);
- combo.add(JptUiMappingsMessages.TableGeneratorComposite_default);
- combo.select(0);
- combo.addModifyListener(buildValueColumnNameListener());
- return combo;
- }
-
- private CCombo buildPkColumnValueCombo(Composite parent) {
- CCombo combo = getWidgetFactory().createCCombo(parent, SWT.FLAT);
- combo.add(JptUiMappingsMessages.TableGeneratorComposite_default);
- combo.select(0);
- combo.addModifyListener(buildPkColumnValueListener());
- return combo;
- }
-
- private ModifyListener buildTableNameListener() {
- return new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- if (isPopulating()) {
- return;
- }
- String text = ((CCombo) e.getSource()).getText();
- if (text != null && tableNameCombo.getItemCount() > 0 && text.equals(tableNameCombo.getItem(0))) {
- text = null;
- }
- ITableGenerator generator = getGenerator();
- if (generator == null) {
- generator = createGenerator();
- }
- generator.setSpecifiedTable(text);
- }
- };
- }
-
- private ModifyListener buildPkColumnNameListener() {
- return new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- if (isPopulating()) {
- return;
- }
- String text = ((CCombo) e.getSource()).getText();
- if (text != null && pkColumnNameCombo.getItemCount() > 0 && text.equals(pkColumnNameCombo.getItem(0))) {
- text = null;
- }
- ITableGenerator generator = getGenerator();
- if (generator == null) {
- generator = createGenerator();
- }
- generator.setSpecifiedPkColumnName(text);
- }
- };
- }
-
- private ModifyListener buildValueColumnNameListener() {
- return new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- if (isPopulating()) {
- return;
- }
- String text = ((CCombo) e.getSource()).getText();
- if (text != null && valueColumnNameCombo.getItemCount() > 0 && text.equals(valueColumnNameCombo.getItem(0))) {
- text = null;
- }
- ITableGenerator generator = getGenerator();
- if (generator == null) {
- generator = createGenerator();
- }
- generator.setSpecifiedValueColumnName(text);
- }
- };
- }
-
- private ModifyListener buildPkColumnValueListener() {
- return new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- if (isPopulating()) {
- return;
- }
- String text = ((CCombo) e.getSource()).getText();
- if (text != null && pkColumnValueCombo.getItemCount() > 0 && text.equals(pkColumnValueCombo.getItem(0))) {
- text = null;
- }
- ITableGenerator generator = getGenerator();
- if (generator == null) {
- generator = createGenerator();
- }
- generator.setSpecifiedPkColumnValue(text);
- }
- };
- }
-
- protected void generatorChanged(Notification notification) {
- super.generatorChanged(notification);
- if (notification.getFeatureID(ITableGenerator.class) == JpaCoreMappingsPackage.ITABLE_GENERATOR__SPECIFIED_TABLE) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- String tableName = getGenerator().getSpecifiedTable();
- if (tableName == null) {
- tableNameCombo.select(0);
- }
- else if (!tableNameCombo.getText().equals(tableName)) {
- tableNameCombo.setText(tableName);
- }
- populatePkColumnNameCombo();
- populateValueColumnNameCombo();
- }
- });
- }
- else if (notification.getFeatureID(ITableGenerator.class) == JpaCoreMappingsPackage.ITABLE_GENERATOR__SPECIFIED_PK_COLUMN_NAME) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- populatePkColumnName();
-
- }
- });
- }
- else if (notification.getFeatureID(ITableGenerator.class) == JpaCoreMappingsPackage.ITABLE_GENERATOR__SPECIFIED_VALUE_COLUMN_NAME) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- String columnName = getGenerator().getSpecifiedValueColumnName();
- if (columnName == null) {
- valueColumnNameCombo.select(0);
- }
- else if (!valueColumnNameCombo.getText().equals(columnName)) {
- valueColumnNameCombo.setText(columnName);
- }
- }
- });
- }
- else if (notification.getFeatureID(ITableGenerator.class) == JpaCoreMappingsPackage.ITABLE_GENERATOR__SPECIFIED_PK_COLUMN_VALUE) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- String columnValue = getGenerator().getSpecifiedPkColumnValue();
- if (columnValue == null) {
- pkColumnValueCombo.select(0);
- }
- else if (!pkColumnValueCombo.getText().equals(columnValue)) {
- pkColumnValueCombo.setText(columnValue);
- }
- }
- });
- }
- }
-
- @Override
- protected void doPopulate(EObject obj) {
- super.doPopulate(obj);
- if (obj == null) {
- this.connectionProfile = null;
- return;
- }
- populateTableNameCombo();
- populatePkColumnNameCombo();
- populateValueColumnNameCombo();
- populatePkColumnValueCombo();
- }
-
- @Override
- protected void doPopulate() {
- super.doPopulate();
- populateTableNameCombo();
- populatePkColumnNameCombo();
- populateValueColumnNameCombo();
- populatePkColumnValueCombo();
- }
-
- @Override
- protected void engageListeners() {
- super.engageListeners();
- if (getGenerator() != null) {
- addConnectionListener();
- }
- }
-
- @Override
- protected void disengageListeners() {
- if (getGenerator() != null) {
- removeConnectionListener();
- }
- super.disengageListeners();
- }
-
- private ConnectionProfile getConnectionProfile() {
- if(this.connectionProfile == null) {
- IJpaProject jpaProject = idMapping().getJpaProject();
- this.connectionProfile = jpaProject.connectionProfile();
- }
- return this.connectionProfile;
- }
-
-
- private void addConnectionListener() {
- this.getConnectionProfile().addConnectionListener(this.connectionListener);
- }
-
- private void removeConnectionListener() {
- this.getConnectionProfile().removeConnectionListener(this.connectionListener);
- }
-
- protected Schema getSchema() {
- if (getGenerator() != null) {
- return this.getConnectionProfile().getDatabase().schemaNamed(getGenerator().getSchema());
- }
- return null;
- }
- private void populateTableNameCombo() {
- if (this.getGenerator() == null) {
- return;
- }
- if (this.getConnectionProfile().isConnected()) {
- this.tableNameCombo.remove(1, this.tableNameCombo.getItemCount()-1);
- Schema schema = this.getSchema();
- if (schema != null) {
- Iterator<String> tables = schema.tableNames();
- for (Iterator<String> stream = CollectionTools.sort(tables); stream.hasNext(); ) {
- this.tableNameCombo.add(stream.next());
- }
- }
- }
- String tableName = this.getGenerator().getSpecifiedTable();
- if (tableName != null) {
- if (!this.tableNameCombo.getText().equals(tableName)) {
- this.tableNameCombo.setText(tableName);
- }
- }
- else {
- this.tableNameCombo.select(0);
- }
- }
-
- private void populatePkColumnNameCombo() {
- if (this.getGenerator() == null) {
- return;
- }
- populatePkColumnChoices();
- populatePkColumnName();
- }
- private void populatePkColumnChoices() {
- this.pkColumnNameCombo.remove(1, this.pkColumnNameCombo.getItemCount() - 1);
-
- if (this.getConnectionProfile().isConnected()) {
- if (!this.tableNameCombo.getText().equals(JptUiMappingsMessages.TableGeneratorComposite_default)) { // hmm,
- // if
- // they
- // actually
- // set
- // the
- // table
- // to
- // Default??
- String tableName = this.tableNameCombo.getText();
- Schema schema = getSchema();
- if (schema != null) {
- Table table = schema.tableNamed(tableName);
- if (table != null) {
- for (Iterator<String> stream = CollectionTools.sort(table.columnNames()); stream.hasNext();) {
- this.pkColumnNameCombo.add(stream.next());
- }
- }
- }
- }
- }
- }
-
- private void populatePkColumnName() {
- String pkColumnName = this.getGenerator().getSpecifiedPkColumnName();
- if (pkColumnName != null) {
- if (!this.pkColumnNameCombo.getText().equals(pkColumnName)) {
- this.pkColumnNameCombo.setText(pkColumnName);
- }
- }
- else {
- this.pkColumnNameCombo.select(0);
- }
- }
-
- private void populateValueColumnNameCombo() {
- if (this.getGenerator() == null) {
- return;
- }
- if (this.getConnectionProfile().isConnected()) {
- this.valueColumnNameCombo.remove(1, this.valueColumnNameCombo.getItemCount() - 1);
- if (!this.tableNameCombo.getText().equals(JptUiMappingsMessages.TableGeneratorComposite_default)) { // hmm,
- // if
- // they
- // actually
- // set
- // the
- // table
- // to
- // Default??
- String tableName = this.tableNameCombo.getText();
- Schema schema = getSchema();
- if (schema != null) {
- Table table = schema.tableNamed(tableName);
- if (table != null) {
- for (Iterator<String> stream = CollectionTools.sort(table.columnNames()); stream.hasNext();) {
- this.valueColumnNameCombo.add(stream.next());
- }
- }
- }
- }
- }
- String valueColumnName = this.getGenerator().getSpecifiedValueColumnName();
- if (valueColumnName != null) {
- if (!this.valueColumnNameCombo.getText().equals(valueColumnName)) {
- this.valueColumnNameCombo.setText(valueColumnName);
- }
- }
- else {
- this.valueColumnNameCombo.select(0);
- }
- }
-
- private void populatePkColumnValueCombo() {
- if (this.getGenerator() == null) {
- return;
- }
- String pkColumnValue = this.getGenerator().getSpecifiedPkColumnValue();
- if (pkColumnValue != null) {
- if (!this.pkColumnValueCombo.getText().equals(pkColumnValue)) {
- this.pkColumnValueCombo.setText(pkColumnValue);
- }
- }
- else {
- this.pkColumnValueCombo.select(0);
- }
- }
-
- protected void clear() {
- super.clear();
- this.tableNameCombo.select(0);
- this.pkColumnNameCombo.select(0);
- this.pkColumnValueCombo.select(0);
- this.valueColumnNameCombo.select(0);
- }
-
- private ConnectionListener buildConnectionListener() {
- return new ConnectionListener() {
- public void closed(ConnectionProfile profile) {
- populate();
- }
-
- public void modified(ConnectionProfile profile) {
- populate();
- }
-
- public void opened(ConnectionProfile profile) {
- populate();
- }
-
- public void databaseChanged(ConnectionProfile profile, final Database database) {
- populate();
- }
-
- public void schemaChanged(ConnectionProfile profile, final Schema schema) {
- populate();
- }
-
- private void populate() {
- getControl().getDisplay().asyncExec( new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- populateTableNameCombo();
- populatePkColumnChoices();
- populateValueColumnNameCombo();
- }
- });
- }
-
- public void aboutToClose(ConnectionProfile profile) {
- // not interested to this event.
- }
-
- public boolean okToClose(ConnectionProfile profile) {
- // not interested to this event.
- return true;
- }
-
- public void tableChanged(ConnectionProfile profile, final Table table) {
- // not interested to this event.
- }
- };
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TargetEntityChooser.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TargetEntityChooser.java
deleted file mode 100644
index dc1ae25cfa..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TargetEntityChooser.java
+++ /dev/null
@@ -1,226 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.mappings.details;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.search.SearchEngine;
-import org.eclipse.jdt.ui.IJavaElementSearchConstants;
-import org.eclipse.jdt.ui.JavaUI;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jpt.core.internal.mappings.IRelationshipMapping;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.details.BaseJpaController;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-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.ui.PlatformUI;
-import org.eclipse.ui.dialogs.SelectionDialog;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class TargetEntityChooser extends BaseJpaController
-{
- private IRelationshipMapping relationshipMapping;
- private Adapter relationshipMappingListener;
-
- protected CCombo targetEntityCombo;
-
-
- private Composite composite;
-
- public TargetEntityChooser(Composite parent, CommandStack theCommandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, theCommandStack, widgetFactory);
- buildRelationshipMappingListener();
- }
-
-
- private void buildRelationshipMappingListener() {
- relationshipMappingListener = new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- relationshipMappingChanged(notification);
- }
- };
- }
-
- @Override
- protected void buildWidget(Composite parent) {
- this.composite = getWidgetFactory().createComposite(parent);
- GridLayout gridLayout = new GridLayout();
- gridLayout.marginHeight = 0;
- gridLayout.marginWidth = 0;
- gridLayout.numColumns = 3;
- this.composite.setLayout(gridLayout);
-
- CommonWidgets.buildTargetEntityLabel(this.composite, getWidgetFactory());
-
- this.targetEntityCombo = buildTargetEntityCombo(this.composite);
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- this.targetEntityCombo.setLayoutData(gridData);
-
- buildTargetEntitySelectionButton(this.composite);
-
- }
-
- protected CCombo buildTargetEntityCombo(Composite parent) {
- final CCombo combo = getWidgetFactory().createCCombo(parent, SWT.FLAT);
- combo.add(JptUiMappingsMessages.TargetEntityChooser_defaultEmpty);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(combo, IJpaHelpContextIds.MAPPING_TARGET_ENTITY);
- combo.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- if (isPopulating()) {
- return;
- }
- String targetEntityName = ((CCombo) e.getSource()).getText();
- if (targetEntityName.equals(combo.getItem(0)) || targetEntityName.equals("")) { //$NON-NLS-1$
- targetEntityName = null;
- }
- else if (!relationshipMapping.targetEntityIsValid(targetEntityName)) {
- return;
- }
- relationshipMapping.setSpecifiedTargetEntity(targetEntityName);
- }
- });
- return combo;
- }
-
-
- private void relationshipMappingChanged(Notification notification) {
- if (notification.getFeatureID(IRelationshipMapping.class) ==
- JpaCoreMappingsPackage.IRELATIONSHIP_MAPPING__SPECIFIED_TARGET_ENTITY) {
- Display.getDefault().asyncExec(
- new Runnable() {
- public void run() {
- populate();
- }
- });
- }
- else if (notification.getFeatureID(IRelationshipMapping.class) ==
- JpaCoreMappingsPackage.IRELATIONSHIP_MAPPING__DEFAULT_TARGET_ENTITY) {
- Display.getDefault().asyncExec(
- new Runnable() {
- public void run() {
- populate();
- }
- });
- }
- }
-
- @Override
- protected void engageListeners() {
- if (relationshipMapping != null) {
- relationshipMapping.eAdapters().add(relationshipMappingListener);
- }
- }
-
- @Override
- protected void disengageListeners() {
- if (this.relationshipMapping != null) {
- this.relationshipMapping.eAdapters().remove(relationshipMappingListener);
- }
- }
-
- @Override
- public void doPopulate(EObject obj) {
- this.relationshipMapping = (IRelationshipMapping) obj;
- populateCombo();
- }
-
- @Override
- protected void doPopulate() {
- populateCombo();
- }
-
- private void populateCombo() {
- if (relationshipMapping == null) {
- targetEntityCombo.clearSelection();
- return;
- }
- String targetEntity = this.relationshipMapping.getSpecifiedTargetEntity();
- this.targetEntityCombo.setItem(0, NLS.bind(JptUiMappingsMessages.TargetEntityChooser_defaultWithOneParam, this.relationshipMapping.getDefaultTargetEntity()));
- if (targetEntity != null) {
- if (!this.targetEntityCombo.getText().equals(targetEntity)) {
- this.targetEntityCombo.setText(targetEntity);
- }
- }
- else {
- if (this.targetEntityCombo.getSelectionIndex() != 0) {
- this.targetEntityCombo.select(0);
- }
- }
- }
-
- @Override
- public Control getControl() {
- return this.composite;
- }
-
- //see org.eclipse.pde.internal.ui.editor.plugin.rows.ClassAttributeRow
- //for example of the hyperlink opening a resource
- protected Button buildTargetEntitySelectionButton(Composite parent) {
- Button button = getWidgetFactory().createButton(
- parent,
- JptUiMappingsMessages.TargetEntityChooser_browse,
- SWT.PUSH);
-
- button.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- browse();
- }
- });
- return button;
- }
-
- protected void browse() {
- BusyIndicator.showWhile(this.targetEntityCombo.getDisplay(), new Runnable() {
- public void run() {
- doOpenSelectionDialog();
- }
- });
- }
-
- private void doOpenSelectionDialog() {
- SelectionDialog dialog;
- try {
- dialog = JavaUI.createTypeDialog(getControl().getShell(),
- PlatformUI.getWorkbench().getProgressService(),
- SearchEngine.createWorkspaceScope(),
- IJavaElementSearchConstants.CONSIDER_ALL_TYPES,
- false,
- ""); //$NON-NLS-1$
- }
- catch (JavaModelException e) {
- throw new RuntimeException(e);
- }
- dialog.setTitle("Select Type"); //$NON-NLS-1$
- if (dialog.open() == Window.OK) {
- IType type = (IType) dialog.getResult()[0];
- this.targetEntityCombo.setText(type.getFullyQualifiedName('$'));
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TransientComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TransientComposite.java
deleted file mode 100644
index 3871e8ac4c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TransientComposite.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.mappings.details;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.ui.internal.details.BaseJpaComposite;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class TransientComposite extends BaseJpaComposite
-{
- public TransientComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, SWT.NULL, commandStack, widgetFactory);
- }
-
- @Override
- protected void initializeLayout(Composite composite) {
-
- }
-
-
- public void doPopulate(EObject obj) {
- }
-
- public void doPopulate() {
- }
-
- protected void engageListeners() {
- }
-
- protected void disengageListeners() {
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/VersionComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/VersionComposite.java
deleted file mode 100644
index fe7fb65ac2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/VersionComposite.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.mappings.details;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.impl.EObjectImpl;
-import org.eclipse.jpt.core.internal.mappings.IBasic;
-import org.eclipse.jpt.core.internal.mappings.IVersion;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.core.internal.mappings.TemporalType;
-import org.eclipse.jpt.ui.internal.details.BaseJpaComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.EnumComboViewer.EnumHolder;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class VersionComposite extends BaseJpaComposite
-{
- private IVersion version;
-
- private ColumnComposite columnComposite;
-
- private EnumComboViewer temporalTypeViewer;
-
-
- public VersionComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, SWT.NULL, commandStack, widgetFactory);
- }
- @Override
- protected void initializeLayout(Composite composite) {
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- composite.setLayout(layout);
-
- Control generalControl = buildGeneralComposite(composite);
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- generalControl.setLayoutData(gridData);
-
- }
-
- private Control buildGeneralComposite(Composite composite) {
-// IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
-
- Composite generalComposite = getWidgetFactory().createComposite(composite);
- GridLayout layout = new GridLayout(2, false);
- layout.marginWidth = 0;
- generalComposite.setLayout(layout);
-
- this.columnComposite = new ColumnComposite(generalComposite, this.commandStack, getWidgetFactory());
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.horizontalSpan = 2;
- this.columnComposite.getControl().setLayoutData(gridData);
-
- CommonWidgets.buildTemporalLabel(generalComposite, getWidgetFactory());
- this.temporalTypeViewer = CommonWidgets.buildEnumComboViewer(generalComposite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.temporalTypeViewer.getControl().setLayoutData(gridData);
-
- return generalComposite;
- }
-
- public void doPopulate(EObject obj) {
- this.version = (IVersion) obj;
- if (this.version != null) {
- this.columnComposite.populate(this.version.getColumn());
- }
- else {
- this.columnComposite.populate(null);
- }
- this.temporalTypeViewer.populate(new TemporalTypeHolder(this.version));
- }
-
- public void doPopulate() {
- this.columnComposite.populate();
- this.temporalTypeViewer.populate();
- }
-
- protected void engageListeners() {
- }
-
- protected void disengageListeners() {
- }
-
- @Override
- public void dispose() {
- this.columnComposite.dispose();
- this.temporalTypeViewer.dispose();
- super.dispose();
- }
-
- protected IVersion getVersion() {
- return this.version;
- }
-
-
-
-
- private class TemporalTypeHolder extends EObjectImpl implements EnumHolder {
-
- private IVersion version;
-
- TemporalTypeHolder(IVersion version) {
- super();
- this.version = version;
- }
-
- public Object get() {
- return this.version.getTemporal();
- }
-
- public void set(Object enumSetting) {
- this.version.setTemporal((TemporalType) enumSetting);
- }
-
- public Class featureClass() {
- return IBasic.class;
- }
-
- public int featureId() {
- return JpaCoreMappingsPackage.IVERSION__TEMPORAL;
- }
-
- public EObject wrappedObject() {
- return this.version;
- }
-
- public Object[] enumValues() {
- return TemporalType.VALUES.toArray();
- }
-
- /**
- * TemporalType has no Default, return null
- */
- public Object defaultValue() {
- return null;
- }
-
- /**
- * TemporalType has no Default, return null
- */
- public String defaultString() {
- return null;
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/perspective/JpaPerspectiveFactory.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/perspective/JpaPerspectiveFactory.java
deleted file mode 100644
index fa41ccf94d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/perspective/JpaPerspectiveFactory.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.perspective;
-
-import org.eclipse.jdt.ui.JavaUI;
-import org.eclipse.ui.IFolderLayout;
-import org.eclipse.ui.IPageLayout;
-import org.eclipse.ui.IPerspectiveFactory;
-import org.eclipse.ui.progress.IProgressConstants;
-
-public class JpaPerspectiveFactory implements IPerspectiveFactory {
-
- public void createInitialLayout(IPageLayout layout) {
- String editorArea = layout.getEditorArea();
-
- //Package area
- IFolderLayout folder = layout.createFolder(
- "left", IPageLayout.LEFT, (float) 0.25, editorArea); //$NON-NLS-1$
- folder.addView(JavaUI.ID_PACKAGES);
- folder.addPlaceholder(JavaUI.ID_TYPE_HIERARCHY);
- folder.addPlaceholder(IPageLayout.ID_RES_NAV);
-
- //Database Explorer area
- layout.addView("org.eclipse.datatools.connectivity.DataSourceExplorerNavigator", //$NON-NLS-1$
- IPageLayout.BOTTOM, (float) 0.60, JavaUI.ID_PACKAGES);
-
- //Problems/Console area
- IFolderLayout outputFolder = layout.createFolder(
- "bottom", IPageLayout.BOTTOM, (float) 0.60, editorArea); //$NON-NLS-1$
- outputFolder.addView(IPageLayout.ID_PROBLEM_VIEW);
- outputFolder.addPlaceholder(IPageLayout.ID_BOOKMARKS);
- outputFolder.addPlaceholder(IProgressConstants.PROGRESS_VIEW_ID);
-
- //JPA Details (Split with Problems/Console area)
- layout.addView("org.eclipse.jpt.ui.jpaDetailsView",
- IPageLayout.RIGHT, (float) .60, "bottom");
-
- //JPA Structure area
- IFolderLayout outlineFolder = layout.createFolder(
- "right", IPageLayout.RIGHT, (float) 0.75, editorArea); //$NON-NLS-1$
- outlineFolder.addView("org.eclipse.jpt.ui.jpaStructureView");
- outlineFolder.addView(IPageLayout.ID_OUTLINE);
-
- layout.addActionSet(JavaUI.ID_ACTION_SET);
- layout.addActionSet(JavaUI.ID_ELEMENT_CREATION_ACTION_SET);
- layout.addActionSet(IPageLayout.ID_NAVIGATE_ACTION_SET);
-
- // views - java
- layout.addShowViewShortcut(JavaUI.ID_PACKAGES);
- layout.addShowViewShortcut(JavaUI.ID_TYPE_HIERARCHY);
- layout.addShowViewShortcut(JavaUI.ID_SOURCE_VIEW);
- layout.addShowViewShortcut(JavaUI.ID_JAVADOC_VIEW);
-
- // views - standard workbench
- layout.addShowViewShortcut(IPageLayout.ID_OUTLINE);
- layout.addShowViewShortcut(IPageLayout.ID_PROBLEM_VIEW);
- layout.addShowViewShortcut(IPageLayout.ID_RES_NAV);
-
- // new actions - Java project creation wizard
- layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewPackageCreationWizard"); //$NON-NLS-1$
- layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewClassCreationWizard"); //$NON-NLS-1$
- layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewInterfaceCreationWizard"); //$NON-NLS-1$
- layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewEnumCreationWizard"); //$NON-NLS-1$
- layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewAnnotationCreationWizard"); //$NON-NLS-1$
- layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewSourceFolderCreationWizard"); //$NON-NLS-1$
- layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewSnippetFileCreationWizard"); //$NON-NLS-1$
- layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.folder");//$NON-NLS-1$
- layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.file");//$NON-NLS-1$
- layout.addNewWizardShortcut("org.eclipse.ui.editors.wizards.UntitledTextFileWizard");//$NON-NLS-1$
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/prefs/JpaPreferencePage.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/prefs/JpaPreferencePage.java
deleted file mode 100644
index 669418d54e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/prefs/JpaPreferencePage.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.prefs;
-
-import java.io.IOException;
-import org.eclipse.core.runtime.preferences.InstanceScope;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.internal.ui.preferences.UserLibraryPreferencePage;
-import org.eclipse.jface.preference.IPersistentPreferenceStore;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.jpt.core.internal.JptCorePlugin;
-import org.eclipse.jpt.core.internal.prefs.JpaPreferenceConstants;
-import org.eclipse.jpt.ui.internal.JptUiMessages;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-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.Link;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
-import org.eclipse.ui.preferences.ScopedPreferenceStore;
-
-public class JpaPreferencePage extends PreferencePage
- implements IWorkbenchPreferencePage
-{
- public static final String ID = "org.eclipse.jpt.ui.jpaPreferencePage";
-
-
- private IPersistentPreferenceStore preferences;
-
- private IPreferenceStore userLibPreferences;
-
- private Label jpaLibLabel;
-
- private Combo jpaLibCombo;
-
- private Link userLibsLink;
-
-
- public JpaPreferencePage() {
- super();
- preferences =
- new ScopedPreferenceStore(
- new InstanceScope(),
- JptCorePlugin.instance().getBundle().getSymbolicName());
- userLibPreferences =
- new ScopedPreferenceStore(
- new InstanceScope(),
- JavaCore.getPlugin().getBundle().getSymbolicName());
- }
-
- public void init(IWorkbench workbench) {}
-
- public Control createContents(Composite parent) {
- Composite container = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- container.setLayout(layout);
-
- jpaLibLabel = createLabel(container, 1, JptUiMessages.JpaPreferencePage_defaultJpaLib);
-
- jpaLibCombo = createCombo(container, true);
-
- userLibsLink = new Link(container, SWT.NONE);
- GridData data = new GridData(GridData.END, GridData.CENTER, false, false);
- data.horizontalSpan = 2;
- userLibsLink.setLayoutData(data);
- userLibsLink.setText(JptUiMessages.JpaPreferencePage_userLibsLink);
- userLibsLink.addSelectionListener(
- new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- ((IWorkbenchPreferenceContainer) getContainer())
- .openPage(UserLibraryPreferencePage.ID, null);
- }
- }
- );
-
- performDefaults();
- return container;
- }
-
- private Label createLabel(Composite container, int span, String text) {
- Label label = new Label(container, SWT.NONE);
- label.setText(text);
- GridData gd = new GridData();
- gd.horizontalSpan = span;
- label.setLayoutData(gd);
- return label;
- }
-
- private Combo createCombo(Composite container, boolean fillHorizontal) {
- Combo combo = new Combo(container, SWT.BORDER | SWT.SINGLE | SWT.READ_ONLY);
- if (fillHorizontal) {
- combo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- }
- else {
- combo.setLayoutData(new GridData());
- }
- return combo;
- }
-
- private void fillJpaLibs() {
- int index = jpaLibCombo.getSelectionIndex();
- String selectedJpaLib = null;
- if (index >= 0) {
- selectedJpaLib = jpaLibCombo.getItem(jpaLibCombo.getSelectionIndex());
- }
-
- jpaLibCombo.clearSelection();
- jpaLibCombo.setItems(JavaCore.getUserLibraryNames());
-
- if (selectedJpaLib != null) {
- int newIndex = CollectionTools.indexOf(jpaLibCombo.getItems(), selectedJpaLib);
- if (newIndex >= 0) {
- jpaLibCombo.select(newIndex);
- }
- }
- }
-
- @Override
- public void setVisible(boolean visible) {
- super.setVisible(visible);
- if (visible) {
- fillJpaLibs();
- }
- }
-
- public void performDefaults() {
- fillJpaLibs();
- String defaultLib = preferences.getString(JpaPreferenceConstants.PREF_DEFAULT_JPA_LIB);
- int index = -1;
- if (! StringTools.stringIsEmpty(defaultLib)) {
- index = CollectionTools.indexOf(jpaLibCombo.getItems(), defaultLib);
- }
- if (index >= 0) {
- jpaLibCombo.select(index);
- }
-
- super.performDefaults();
- }
-
- public boolean performOk() {
- int index = jpaLibCombo.getSelectionIndex();
- String defaultLib = (index >= 0) ? jpaLibCombo.getItem(index) : null;
- if (! StringTools.stringIsEmpty(defaultLib)) {
- preferences.setValue(JpaPreferenceConstants.PREF_DEFAULT_JPA_LIB, defaultLib);
- }
- try {
- preferences.save();
- }
- catch (IOException ioe) {
- JptCorePlugin.log(ioe);
- }
- return true;
- }
-
- public void dispose() {
- // null pointer check - bug 168337
- if (jpaLibLabel != null) jpaLibLabel.dispose();
- if (jpaLibCombo != null) jpaLibCombo.dispose();
- super.dispose();
- }
-
-
-
-// private boolean libContainsJpaClasses() {
-// return true;
-// String jarLocation = getStringValue();
-// String errorMessage = JptUiMessages.JpaPreferencePage_invalidJpaLib;
-// boolean hasError = false;
-//
-// try {
-// JarFile jarFile = new JarFile(jarLocation);
-// hasError = jarFile.getEntry("javax/persistence/EntityManager.class") == null;
-// }
-// catch (IOException ioe) {
-// hasError = true;
-// }
-//
-// if (hasError) {
-// showErrorMessage(errorMessage);
-// }
-// else {
-// clearErrorMessage();
-// }
-//
-// return ! hasError;
-// }
-// }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/properties/DataModelPropertyPage.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/properties/DataModelPropertyPage.java
deleted file mode 100644
index cc0b64d8f2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/properties/DataModelPropertyPage.java
+++ /dev/null
@@ -1,309 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 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.ui.internal.properties;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.PropertyPage;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelEvent;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelListener;
-import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelSynchHelper;
-import org.eclipse.wst.common.frameworks.internal.ui.ValidationStatus;
-
-public abstract class DataModelPropertyPage
- extends PropertyPage
- implements Listener, IDataModelListener
-{
- protected IDataModel model;
-
- private ValidationStatus status = new ValidationStatus();
- private Map validationMap;
- private String[] validationPropertyNames;
- private boolean isValidating = false;
-
- protected DataModelSynchHelper synchHelper;
-
- private String infopopID;
-
-
- protected DataModelPropertyPage(IDataModel model) {
- super();
- this.model = model;
- model.addListener(this);
- synchHelper = initializeSynchHelper(model);
- }
-
-
- /**
- * @return
- */
- public DataModelSynchHelper initializeSynchHelper(IDataModel dm) {
- return new DataModelSynchHelper(dm);
- }
-
-
- @Override
- protected Control createContents(Composite parent) {
- Composite top = createTopLevelComposite(parent);
- setupInfopop(top);
- setDefaults();
- addListeners();
- initializeValidationProperties();
- return top;
- }
-
- private void initializeValidationProperties() {
- validationPropertyNames = getValidationPropertyNames();
- if (validationPropertyNames == null || validationPropertyNames.length == 0)
- validationMap = Collections.EMPTY_MAP;
- else {
- validationMap = new HashMap(validationPropertyNames.length);
- for (int i = 0; i < validationPropertyNames.length; i++)
- validationMap.put(validationPropertyNames[i], new Integer(i));
- }
- }
-
- /**
- * Subclass should return the model property names that need to be validated on this page in the
- * order that they should present their messages.
- *
- * @return
- */
- protected abstract String[] getValidationPropertyNames();
-
- /**
- * Return the top level Composite for this page.
- */
- protected abstract Composite createTopLevelComposite(Composite parent);
-
- /**
- * Set up info pop hooks if set.
- */
- protected void setupInfopop(Control parent) {
- if (getInfopopID() != null)
- PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, getInfopopID());
- }
-
- /**
- * Setup the default values for this page. Subclasses should override to provide appropriate
- * defaults.
- */
- protected void setDefaults() {
- restoreDefaultSettings();
- }
-
- /**
- * Subclasses should implement this method if they have default settings that have been stored
- * and need to be restored.
- *
- * @see storeDefaultSettings()
- */
- protected void restoreDefaultSettings() {
- }
-
- /**
- * Add Listeners to controls at this point to avoid unnecessary events. Subclasses should
- * override to add listeners to its controls.
- */
- protected void addListeners() {
- }
-
- /**
- * Exiting the page. Subclasses may extend.
- */
- protected void exit() {
- }
-
- protected boolean getStatus(Integer key) {
- return status.hasError(key);
- }
-
- /**
- * Sent when an event that the receiver has registered for occurs. If a subclass overrides this
- * method, it must call super.
- *
- * @param event
- * the event which occurred
- */
- public void handleEvent(org.eclipse.swt.widgets.Event event) {
- }
-
- /**
- * Set the error message for this page based on the last error in the ValidationStatus.
- */
- protected void setErrorMessage() {
- String error = status.getLastErrMsg();
- if (error == null) {
- if (getErrorMessage() != null)
- setErrorMessage((String) null);
- String warning = status.getLastWarningMsg();
- if (warning == null) {
- if (getMessage() != null && getMessageType() == IMessageProvider.WARNING)
- setMessage(null, IMessageProvider.WARNING);
- else {
- String info = status.getLastInfoMsg();
- if (info == null) {
- if (getMessage() != null && getMessageType() == IMessageProvider.INFORMATION)
- setMessage(null, IMessageProvider.INFORMATION);
- } else if (!info.equals(getMessage())) {
- setMessage(info, IMessageProvider.INFORMATION);
- }
- }
- } else if (!warning.equals(getMessage()))
- setMessage(warning, IMessageProvider.WARNING);
- } else if (!error.equals(getErrorMessage()))
- setErrorMessage(error);
- }
-
- protected void setErrorStatus(Integer key, String errorMessage) {
- status.setErrorStatus(key, errorMessage);
- }
-
- protected void setWarningStatus(Integer key, String warningMessage) {
- status.setWarningStatus(key, warningMessage);
- }
-
- protected void setInfoStatus(Integer key, String infoMessage) {
- status.setInfoStatus(key, infoMessage);
- }
-
- protected void setOKStatus(Integer key) {
- status.setOKStatus(key);
- }
-
- /**
- * This should be called by the Wizard just prior to running the performFinish operation.
- * Subclasses should override to store their default settings.
- */
- public void storeDefaultSettings() {
- }
-
- /**
- * The page is now being validated. At this time, each control is validated and then the
- * controls are updated based on the results in the ValidationStatus which was updated during
- * <code>validateControls()</code>. Finally, it will display the last error message and it
- * will set the page complete. Subclasses will not typically override this method.
- */
- protected void validatePage() {
- if (!isValidating) {
- isValidating = true;
- try {
- validateControlsBase();
- updateControls();
- setErrorMessage();
- setValid(status.getLastErrMsg() == null);
- }
- finally {
- isValidating = false;
- }
- }
- }
-
- /**
- * Validate individual controls. Use validation keys to keep track of errors.
- *
- * @see setOKStatus(Integer) and setErrorMessage(Integer, String)
- */
- protected final String validateControlsBase() {
- if (!validationMap.isEmpty()) {
- String propName;
- for (int i = 0; i < validationPropertyNames.length; i++) {
- propName = validationPropertyNames[i];
- Integer valKey = (Integer) validationMap.get(propName);
- if (valKey != null)
- validateProperty(propName, valKey);
- if (!getStatus(valKey))
- return propName;
- }
- }
- return null;
- }
-
- /**
- * @param propertyName
- * @param validationkey
- */
- private void validateProperty(String propertyName, Integer validationKey) {
- setOKStatus(validationKey);
- IStatus status1 = model.validateProperty(propertyName);
- if (!status1.isOK()) {
- String message = status1.isMultiStatus() ? status1.getChildren()[0].getMessage() : status1.getMessage();
- switch (status1.getSeverity()) {
- case IStatus.ERROR :
- setErrorStatus(validationKey, message);
- break;
- case IStatus.WARNING :
- setWarningStatus(validationKey, message);
- break;
- case IStatus.INFO :
- setInfoStatus(validationKey, message);
- break;
- }
- }
- }
-
- /**
- * Update the enablement of controls after validation. Sublcasses should check the status of
- * validation keys to determine enablement.
- */
- protected void updateControls() {
- }
-
-
- /*
- * If a property changes that we want to validate, force validation on this page.
- *
- * @see org.eclipse.wst.common.frameworks.internal.operation.WTPOperationDataModelListener#propertyChanged(java.lang.String,
- * java.lang.Object, java.lang.Object)
- */
- public void propertyChanged(DataModelEvent event) {
- String propertyName = event.getPropertyName();
- if (validationPropertyNames != null && (event.getFlag() == DataModelEvent.VALUE_CHG || (!isValid() && event.getFlag() == DataModelEvent.VALID_VALUES_CHG))) {
- for (int i = 0; i < validationPropertyNames.length; i++) {
- if (validationPropertyNames[i].equals(propertyName)) {
- validatePage();
- break;
- }
- }
- }
- }
-
- /**
- * @return Returns the model.
- */
- protected IDataModel getDataModel() {
- return model;
- }
-
- public void dispose() {
- super.dispose();
- if (synchHelper != null) {
- synchHelper.dispose();
- synchHelper = null;
- }
- }
-
- protected String getInfopopID() {
- return infopopID;
- }
-
- public void setInfopopID(String infopopID) {
- this.infopopID = infopopID;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/properties/JpaProjectPropertiesPage.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/properties/JpaProjectPropertiesPage.java
deleted file mode 100644
index e59e78b77d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/properties/JpaProjectPropertiesPage.java
+++ /dev/null
@@ -1,425 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.properties;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.Iterator;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IncrementalProjectBuilder;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.viewers.ComboViewer;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jpt.core.internal.IJpaProject;
-import org.eclipse.jpt.core.internal.JpaModelManager;
-import org.eclipse.jpt.core.internal.JpaPlatformRegistry;
-import org.eclipse.jpt.core.internal.JptCorePlugin;
-import org.eclipse.jpt.core.internal.facet.IJpaFacetDataModelProperties;
-import org.eclipse.jpt.core.internal.facet.JpaFacetDataModelProvider;
-import org.eclipse.jpt.db.internal.ConnectionProfileRepository;
-import org.eclipse.jpt.db.ui.internal.DTPUiTools;
-import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.JptUiMessages;
-import org.eclipse.jpt.ui.internal.JptUiPlugin;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-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.Group;
-import org.eclipse.swt.widgets.Link;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelEvent;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelListener;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
-
-public class JpaProjectPropertiesPage
- extends DataModelPropertyPage
- implements IJpaFacetDataModelProperties
-{
- private PlatformGroup platformGroup;
-
- private ConnectionGroup connectionGroup;
-
- private PersistentClassManagementGroup persistentClassManagementGroup;
-
-
- /**
- * Constructor for SamplePropertyPage.
- */
- public JpaProjectPropertiesPage() {
- super(DataModelFactory.createDataModel(new JpaFacetDataModelProvider()));
- }
-
-
- @Override
- protected Composite createTopLevelComposite(Composite parent) {
- Composite composite = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
- composite.setLayout(layout);
-
- platformGroup = new PlatformGroup(composite);
- connectionGroup = new ConnectionGroup(composite);
- persistentClassManagementGroup = new PersistentClassManagementGroup(composite);
-
- setRuntime();
-
- Dialog.applyDialogFont(parent);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IJpaHelpContextIds.PROPERTIES_JAVA_PERSISTENCE);
-
- return composite;
- }
-
- private void setRuntime() {
- IFacetedProject facetedProject = null;
- try {
- facetedProject = ProjectFacetsManager.create(getJpaProject().project());
- }
- catch (CoreException ce) {
- JptUiPlugin.log(ce);
- return;
- }
- IRuntime runtime = facetedProject.getPrimaryRuntime();
- model.setProperty(IJpaFacetDataModelProperties.RUNTIME, runtime);
- }
-
- @Override
- protected String[] getValidationPropertyNames() {
- return new String[] {
- IJpaFacetDataModelProperties.PLATFORM_ID,
- IJpaFacetDataModelProperties.CONNECTION,
- IJpaFacetDataModelProperties.DISCOVER_ANNOTATED_CLASSES
- };
- }
-
- protected IJpaProject getJpaProject() {
- return (IJpaProject) this.getElement().getAdapter(IJpaProject.class);
- }
-
- Combo createCombo(Composite container, boolean fillHorizontal) {
- Combo combo = new Combo(container, SWT.BORDER | SWT.SINGLE | SWT.READ_ONLY);
- if (fillHorizontal) {
- combo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- }
- else {
- combo.setLayoutData(new GridData());
- }
- return combo;
- }
-
- Button createButton(Composite container, int span, String text, int style) {
- Button button = new Button(container, SWT.NONE | style);
- button.setText(text);
- GridData gd = new GridData();
- gd.horizontalSpan = span;
- button.setLayoutData(gd);
- return button;
- }
-
- @Override
- protected void performDefaults() {
- platformGroup.performDefaults();
- connectionGroup.performDefaults();
- persistentClassManagementGroup.performDefaults();
- }
-
- @Override
- public boolean performOk() {
- IJpaProject jpaProject = this.getJpaProject();
- if (jpaProject == null) {
- return true; // the facet has been uninstalled during our trip to the properties
- }
-
- boolean change = false;
- boolean platformChange = false;
-
- IProject project = jpaProject.project();
-
- String platform = this.model.getStringProperty(IJpaFacetDataModelProperties.PLATFORM_ID);
- if ( ! platform.equals(jpaProject.jpaPlatform().getId())) {
- change = true;
- platformChange = true;
- JptCorePlugin.setJpaPlatformId(project, platform);
- }
-
- String connection = this.model.getStringProperty(IJpaFacetDataModelProperties.CONNECTION);
- if ( ! connection.equals(jpaProject.dataSource().getConnectionProfileName())) {
- change = true;
- jpaProject.dataSource().setConnectionProfileName(connection);
- JptCorePlugin.setConnectionProfileName(project, connection);
- }
-
- boolean discover = this.model.getBooleanProperty(IJpaFacetDataModelProperties.DISCOVER_ANNOTATED_CLASSES);
- if (discover != jpaProject.discoversAnnotatedClasses()) {
- change = true;
- jpaProject.setDiscoversAnnotatedClasses(discover);
- JptCorePlugin.setDiscoverAnnotatedClasses(project, discover);
- }
-
- if (platformChange) {
- JpaModelManager.instance().rebuildJpaProject(project);
- }
- if (change) {
- buildProject(project);
- }
- return true;
- }
-
- private static void buildProject(final IProject project) {
- IRunnableWithProgress r= new IRunnableWithProgress() {
- public void run(IProgressMonitor pm) throws InvocationTargetException {
- try {
- project.build(IncrementalProjectBuilder.FULL_BUILD, pm);
- }
- catch (CoreException ce) {
- JptUiPlugin.log(ce);
- }
- }
- };
- try {
- PlatformUI.getWorkbench().getProgressService().run(true, false, r);
- }
- catch (InterruptedException ie) { /* nothing to do */ }
- catch (InvocationTargetException ie) { /* nothing to do */ }
- }
-
-
- private final class PlatformGroup
- {
- final ComboViewer platformCombo;
-
-
- public PlatformGroup(Composite composite) {
- Group group = new Group(composite, SWT.NONE);
- group.setText(JptUiMessages.JpaFacetWizardPage_platformLabel);
- group.setLayout(new GridLayout());
- group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- // TODO
- // PlatformUI.getWorkbench().getHelpSystem().setHelp(group, IDaliHelpContextIds.NEW_JPA_PROJECT_CONTENT_PAGE_DATABASE);
-
- platformCombo = new ComboViewer(createCombo(group, true));
- platformCombo.setContentProvider(
- new IStructuredContentProvider() {
- public Object[] getElements(Object inputElement) {
- return CollectionTools.array(JpaPlatformRegistry.instance().jpaPlatformIds());
- }
-
- public void dispose() {
- // do nothing
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- // do nothing
- }
- }
- );
- platformCombo.setLabelProvider(
- new ILabelProvider() {
- public Image getImage(Object element) {
- return null;
- }
-
- public String getText(Object element) {
- return JpaPlatformRegistry.instance().jpaPlatformLabel((String) element);
- }
-
- public void addListener(ILabelProviderListener listener) {
- // do nothing
- }
-
- public void removeListener(ILabelProviderListener listener) {
- // do nothing
- }
-
- public void dispose() {
- // do nothing
- }
-
- public boolean isLabelProperty(Object element, String property) {
- return true;
- }
- }
- );
- platformCombo.addSelectionChangedListener(
- new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- model.setProperty(PLATFORM_ID, ((StructuredSelection) platformCombo.getSelection()).getFirstElement());
- }
- }
- );
- // we need some input here, even if it means absolutely nothing
- platformCombo.setInput("null input");
- performDefaults();
- }
-
- void performDefaults() {
- String platformId = getJpaProject().jpaPlatform().getId();
- model.setProperty(PLATFORM_ID, platformId);
- platformCombo.setSelection(new StructuredSelection(platformId));
- }
- }
-
-
- private final class ConnectionGroup
- {
- final Combo connectionCombo;
-
- private Link connectionLink;
-
-
- public ConnectionGroup(Composite composite) {
- Group group = new Group(composite, SWT.NONE);
- group.setText(JptUiMessages.JpaFacetWizardPage_connectionLabel);
- group.setLayout(new GridLayout());
- group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- connectionCombo = createCombo(group, true);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(group, IJpaHelpContextIds.PROPERTIES_JAVA_PERSISTENCE_CONNECTION);
- connectionCombo.addSelectionListener(
- new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
-
- public void widgetSelected(SelectionEvent e) {
- model.setProperty(CONNECTION, connectionCombo.getItem(connectionCombo.getSelectionIndex()));
- }
- }
- );
- fillConnections();
-
- connectionLink = new Link(group, SWT.NONE);
- GridData data = new GridData(GridData.END, GridData.CENTER, false, false);
- data.horizontalSpan = 2;
- connectionLink.setLayoutData(data);
- connectionLink.setText(JptUiMessages.JpaFacetWizardPage_connectionLink);
- connectionLink.addSelectionListener(
- new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- openNewConnectionWizard();
- }
- }
- );
- performDefaults();
- }
-
- private void fillConnections() {
- //clear out connection entries from previous login.
- connectionCombo.removeAll();
-
- for (Iterator<String> stream = ConnectionProfileRepository.instance().profileNames(); stream.hasNext(); ) {
- connectionCombo.add(stream.next());
- }
- }
-
- void performDefaults() {
- String connectionName = getJpaProject().dataSource().getConnectionProfileName();
- model.setProperty(CONNECTION, connectionName);
- if (connectionName == null) {
- connectionCombo.clearSelection();
- }
- else {
- connectionCombo.setText(connectionName);
- }
- }
-
- void openNewConnectionWizard() {
- String connectionName = DTPUiTools.createNewProfile();
- if (connectionName != null) {
- fillConnections();
- model.setProperty(CONNECTION, connectionName);
- connectionCombo.select(connectionCombo.indexOf(connectionName));
- }
- }
- }
-
-
- private final class PersistentClassManagementGroup
- {
- final Button discoverClassesButton;
-
- final Button listClassesButton;
-
-
- public PersistentClassManagementGroup(Composite composite) {
- Group group = new Group(composite, SWT.NONE);
- group.setText(JptUiMessages.JpaFacetWizardPage_persistentClassManagementLabel);
- group.setLayout(new GridLayout());
- group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- PlatformUI.getWorkbench().getHelpSystem().setHelp(group, IJpaHelpContextIds.NEW_JPA_PROJECT_CONTENT_PAGE_CLASSPATH);
-
- discoverClassesButton = createButton(group, 1, JptUiMessages.JpaFacetWizardPage_discoverClassesButton, SWT.RADIO);
- discoverClassesButton.addSelectionListener(
- new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
-
- public void widgetSelected(SelectionEvent e) {
- model.setBooleanProperty(DISCOVER_ANNOTATED_CLASSES, true);
- }
- }
- );
-
- listClassesButton = createButton(group, 1, JptUiMessages.JpaFacetWizardPage_listClassesButton, SWT.RADIO);
- listClassesButton.addSelectionListener(
- new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
-
- public void widgetSelected(SelectionEvent e) {
- model.setBooleanProperty(DISCOVER_ANNOTATED_CLASSES, false);
- }
- }
- );
-
- model.addListener(
- new IDataModelListener() {
- public void propertyChanged(DataModelEvent event) {
- if (DISCOVER_ANNOTATED_CLASSES.equals(event.getPropertyName())) {
- boolean discoverClasses = (Boolean) event.getProperty();
- discoverClassesButton.setSelection(discoverClasses);
- listClassesButton.setSelection(! discoverClasses);
- }
- }
- }
- );
-
- performDefaults();
- }
-
- void performDefaults() {
- boolean discoverClasses = getJpaProject().discoversAnnotatedClasses();
- model.setProperty(DISCOVER_ANNOTATED_CLASSES, discoverClasses);
- discoverClassesButton.setSelection(discoverClasses);
- listClassesButton.setSelection(! discoverClasses);
- }
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/ISelectionManager.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/ISelectionManager.java
deleted file mode 100644
index 42e7dc2aef..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/ISelectionManager.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.selection;
-
-import org.eclipse.ui.IWorkbenchPart;
-
-public interface ISelectionManager
-{
- /**
- * Return the current selection.
- * This will never be null, but it may be <code>Selection.NULL_SELECTION</code>.
- */
- public Selection getCurrentSelection();
-
- /**
- * Not to be called lightly, this will affect the selection for all interested
- * objects in a window.
- * The newSelection will be selected.
- */
- public void select(Selection newSelection);
-
- /**
- * Not to be called lightly, this will affect the selection for all interested
- * objects in a window.
- * The oldSelection will be deselected, iff it matches the current selection.
- */
- public void deselect(Selection oldSelection);
-
- /**
- * This may be used to register a part with the selection manager if the part
- * is known to need access to the selection manager before it is ever activated
- * or in the case it may be activated prior to the selection manager being
- * created.
- *
- * It should not be necessary to deregister a part, as that happens when the
- * part is closed.
- */
- public void register(IWorkbenchPart part);
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/ISelectionParticipant.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/ISelectionParticipant.java
deleted file mode 100644
index 56fdb85040..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/ISelectionParticipant.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.selection;
-
-public interface ISelectionParticipant
-{
- /**
- * Return the current selection of the participant
- */
- Selection getSelection();
-
- /**
- * The selection has changed in the central selection manager.
- * Update this participant accordingly.
- */
- void selectionChanged(SelectionEvent evt);
-
- /**
- * Return whether this selection participant should disconnect itself from
- * its part when its part is hidden from view.
- * <b>Typically</b> editor participants will return true and view participants will
- * return false.
- */
- boolean disposeOnHide();
-
- /**
- * This participant is no longer needed (most likely because its part has
- * closed). Dispose of it.
- */
- void dispose();
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/JpaDetailsSelectionParticipant.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/JpaDetailsSelectionParticipant.java
deleted file mode 100644
index da44c1d141..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/JpaDetailsSelectionParticipant.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.selection;
-
-import org.eclipse.jpt.ui.internal.views.JpaDetailsView;
-
-
-public class JpaDetailsSelectionParticipant
- implements ISelectionParticipant
-{
- private final JpaDetailsView detailsView;
-
-
- public JpaDetailsSelectionParticipant(JpaDetailsView detailsView) {
- super();
- this.detailsView = detailsView;
- }
-
- public Selection getSelection() {
- return this.detailsView.getSelection();
- }
-
- public void selectionChanged(SelectionEvent evt) {
- this.detailsView.select(evt.getSelection());
- }
-
- public boolean disposeOnHide() {
- return false;
- }
-
- public void dispose() {
- // NOP
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/JpaStructureSelectionParticipant.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/JpaStructureSelectionParticipant.java
deleted file mode 100644
index 749efdcf55..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/JpaStructureSelectionParticipant.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.selection;
-
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jpt.ui.internal.views.JpaStructureView;
-
-public class JpaStructureSelectionParticipant
- implements ISelectionParticipant
-{
- final JpaStructureView structureView;
-
-
- public JpaStructureSelectionParticipant(ISelectionManager selectionManager, JpaStructureView structureView) {
- super();
- this.structureView = structureView;
- structureView.addSelectionChangedListener(new StructureViewSelectionListener(selectionManager, structureView));
- }
-
- public Selection getSelection() {
- return this.structureView.getSelection();
- }
-
- public void selectionChanged(SelectionEvent evt) {
- this.structureView.select(evt.getSelection());
- }
-
- public boolean disposeOnHide() {
- return false;
- }
-
- public void dispose() {
- // NOP
- }
-
-
- // ********** listener **********
-
- private class StructureViewSelectionListener
- implements ISelectionChangedListener
- {
- private final ISelectionManager selectionManager;
-
- StructureViewSelectionListener(ISelectionManager selectionManager, JpaStructureView structureView) {
- super();
- this.selectionManager = selectionManager;
- }
-
- public void selectionChanged(SelectionChangedEvent event) {
- this.selectionManager.select(this.structureViewSelection());
- }
-
- private Selection structureViewSelection() {
- return JpaStructureSelectionParticipant.this.structureView.getSelection();
- }
-
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/Selection.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/Selection.java
deleted file mode 100644
index e05032bdf0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/Selection.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.selection;
-
-import org.eclipse.jpt.core.internal.IJpaContentNode;
-
-
-public class Selection
-{
- public static Selection NULL_SELECTION = new Selection();
-
- private IJpaContentNode selectedNode;
-
-
- /* Used internally - only for NULL_SELECTION */
- private Selection() {
- super();
- }
-
- public Selection(IJpaContentNode selectedNode) {
- if (selectedNode == null) {
- throw new NullPointerException("A 'selectedNode' is required; otherwise use NULL_SELECTION.");
- }
- this.selectedNode = selectedNode;
- }
-
- public IJpaContentNode getSelectedNode() {
- return selectedNode;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (! (obj instanceof Selection)) {
- return false;
- }
-
- if ((this == NULL_SELECTION) && (obj == NULL_SELECTION)) {
- return true;
- }
-
- if ((this == NULL_SELECTION) || (obj == NULL_SELECTION)) {
- return false;
- }
-
- return this.selectedNode.equals(((Selection) obj).selectedNode);
- }
-
- @Override
- public int hashCode() {
- return (this == NULL_SELECTION) ?
- super.hashCode()
- :
- this.selectedNode.hashCode();
- }
-
- @Override
- public String toString() {
- return (this == NULL_SELECTION) ?
- "NULL_SELECTION"
- :
- selectedNode.toString();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/SelectionEvent.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/SelectionEvent.java
deleted file mode 100644
index 1020ef3ec1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/SelectionEvent.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.selection;
-
-import java.util.EventObject;
-
-public class SelectionEvent extends EventObject
-{
- /**
- * Serializable uid
- * @since 0.5
- */
- private static final long serialVersionUID = 1L;
-
-
- /**
- * Indicates that the selection object is now selected
- */
- public static int SELECTION = 1;
-
- /**
- * Indicates that the selection object has now been deselected
- */
- public static int DESELECTION = 2;
-
-
- /**
- * The selection object whose selection status has changed
- */
- private Selection selection;
-
- /**
- * The type of the selection event, either a SELECTION or a DESELECTION
- */
- private int type;
-
-
- public SelectionEvent(Selection theSelection, int theType, Object source) {
- super(source);
- selection = theSelection;
- type = theType;
- }
-
- /**
- * Return the selection object whose selection status has changed
- */
- public Selection getSelection() {
- return selection;
- }
-
- /**
- * Return the type of selection event, either a SELECTION or a DESELECTION
- */
- public int getType() {
- return type;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/SelectionManager.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/SelectionManager.java
deleted file mode 100644
index 108a700989..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/SelectionManager.java
+++ /dev/null
@@ -1,279 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.selection;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.jpt.utility.internal.iterators.CloneIterator;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IPageListener;
-import org.eclipse.ui.IPartListener2;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchPartReference;
-import org.eclipse.ui.IWorkbenchWindow;
-
-/**
- * A <code>SelectionManager</code> stores the current <code>Selection</code> and
- * notifies <code>ISelectionListener</code>s when the selection changes.
- */
-public class SelectionManager
- implements ISelectionManager
-{
- /* The set of pages for which this object is managing selections */
- private Set<IWorkbenchPage> pages;
-
- /* The map of <code>ISelectionParticipant</code>s (keyed by part) this object
- is using to manage selections */
- private Map<IWorkbenchPart, ISelectionParticipant> selectionParticipants;
-
- private IPageListener pageListener;
-
- private IPartListener2 partListener;
-
- /* The window for which this object manages selections */
- private IWorkbenchWindow window;
-
- private Selection currentSelection;
-
-
- public SelectionManager() {
- super();
- pages = Collections.synchronizedSet(new HashSet<IWorkbenchPage>());
- selectionParticipants = Collections.synchronizedMap(new HashMap<IWorkbenchPart, ISelectionParticipant>());
- pageListener = new PageListener();
- partListener = new PartListener();
- currentSelection = Selection.NULL_SELECTION;
- }
-
- public void init(IWorkbenchWindow aWindow) {
- window = aWindow;
- aWindow.addPageListener(pageListener);
- initPage(aWindow.getActivePage());
- }
-
- void initPage(IWorkbenchPage page) {
- if ((page != null) && (! pages.contains(page))) {
- page.addPartListener(partListener);
- pages.add(page);
- IEditorPart activeEditor = page.getActiveEditor();
- initPart(activeEditor);
- selectPart(activeEditor);
- }
- }
-
- void disposePage(IWorkbenchPage page) {
- if ((page != null) && (pages.contains(page))) {
- page.removePartListener(partListener);
- pages.remove(page);
- }
- }
-
- void initPart(IWorkbenchPart part) {
- if (part != null) {
- if (selectionParticipants.get(part) == null) {
- ISelectionParticipant selectionParticipant =
- (ISelectionParticipant) part.getAdapter(ISelectionParticipant.class);
- if (selectionParticipant != null) {
- selectionParticipants.put(part, selectionParticipant);
- }
- }
- }
- }
-
- void selectPart(IWorkbenchPart part) {
- ISelectionParticipant selectionParticipant = getSelectionParticipant(part);
- if (selectionParticipant != null) {
- select(selectionParticipant.getSelection());
- }
- }
-
- void hidePart(IWorkbenchPart part) {
- ISelectionParticipant selectionParticipant = getSelectionParticipant(part);
- if ((selectionParticipant != null) && (selectionParticipant.disposeOnHide())) {
- closePart(part);
- }
- }
-
- void closePart(IWorkbenchPart part) {
- ISelectionParticipant selectionParticipant = getSelectionParticipant(part);
- if (selectionParticipant != null) {
- disposePart(part);
- checkForNoEditors();
- }
- }
-
- void disposePart(IWorkbenchPart part) {
- if ((part != null) && (selectionParticipants.containsKey(part))) {
- selectionParticipants.remove(part).dispose();
- }
- }
-
- void checkForNoEditors() {
- IWorkbenchPage activePage = window.getActivePage();
- if ((activePage == null)
- || (activePage.getActiveEditor() == null)) {
- select(Selection.NULL_SELECTION);
- }
- }
-
- /**
- * This may be used to register a part with the selection manager if the part
- * is known to need access to the selection manager before it is ever activated
- * or in the case it may be activated prior to the selection manager being
- * created.
- *
- * It should not be necessary to deregister a part, as that happens when the
- * part is closed.
- */
- public void register(IWorkbenchPart part) {
- initPart(part);
- }
-
- /**
- * Not to be called lightly, this will affect the selection for all interested
- * objects in a window.
- * The newSelection will be selected.
- */
- public void select(Selection newSelection) {
- if (currentSelection.equals(newSelection)) {
- return;
- }
-
- currentSelection = newSelection;
- fireSelectionChange(
- new SelectionEvent(newSelection, SelectionEvent.SELECTION, this)
- );
- }
-
- /**
- * Not to be called lightly, this will affect the selection for all interested
- * objects in a window.
- * The oldSelection will be deselected, iff it matches the current selection.
- */
- public void deselect(Selection oldSelection) {
- if (currentSelection.equals(oldSelection)) {
- currentSelection = Selection.NULL_SELECTION;
- fireSelectionChange(
- new SelectionEvent(oldSelection, SelectionEvent.DESELECTION, this)
- );
- }
- }
-
- private void fireSelectionChange(SelectionEvent event) {
- for (ISelectionParticipant sp : selectionParticipants.values()) {
- sp.selectionChanged(event);
- }
- }
-
- private ISelectionParticipant getSelectionParticipant(IWorkbenchPart part) {
- return selectionParticipants.get(part);
- }
-
- public Selection getCurrentSelection() {
- return currentSelection;
- }
-
- public void dispose() {
- window.removePageListener(pageListener);
- selectionParticipants.clear();
-
- for (Iterator<IWorkbenchPage> stream = new CloneIterator<IWorkbenchPage>(this.pages); stream.hasNext(); ) {
- this.disposePage(stream.next());
- }
-
- for (Iterator<IWorkbenchPart> stream = new CloneIterator<IWorkbenchPart>(selectionParticipants.keySet()); stream.hasNext(); ) {
- this.disposePart(stream.next());
- }
- }
-
-
- private class PageListener implements IPageListener
- {
- public void pageActivated(IWorkbenchPage page) {
- // nop
- }
-
- PageListener() {
- super();
- }
-
- public void pageClosed(IWorkbenchPage page) {
- SelectionManager.this.disposePage(page);
- }
-
- public void pageOpened(IWorkbenchPage page) {
- SelectionManager.this.initPage(page);
- }
- }
-
-
- private class PartListener implements IPartListener2
- {
- PartListener() {
- super();
- }
-
- public void partActivated(IWorkbenchPartReference partRef) {
- IWorkbenchPart part = partRef.getPart(false);
- if (part != null) {
- SelectionManager.this.initPart(part);
- SelectionManager.this.selectPart(part);
- }
- }
-
- public void partBroughtToTop(IWorkbenchPartReference partRef) {
- // nop
- }
-
- public void partClosed(IWorkbenchPartReference partRef) {
- IWorkbenchPart part = partRef.getPart(false);
- if (part != null) {
- SelectionManager.this.closePart(part);
- SelectionManager.this.disposePart(part);
- SelectionManager.this.checkForNoEditors();
- }
- }
-
- public void partDeactivated(IWorkbenchPartReference partRef) {
- // nop
- }
-
- public void partHidden(IWorkbenchPartReference partRef) {
- IWorkbenchPart part = partRef.getPart(false);
- if (part != null) {
- SelectionManager.this.hidePart(part);
- }
- }
-
- public void partInputChanged(IWorkbenchPartReference partRef) {
- // nop
- }
-
- public void partOpened(IWorkbenchPartReference partRef) {
- IWorkbenchPart part = partRef.getPart(false);
- if (part != null) {
- initPart(part);
- }
- }
-
- public void partVisible(IWorkbenchPartReference partRef) {
- IWorkbenchPart part = partRef.getPart(false);
- if (part != null) {
- initPart(part);
- }
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/SelectionManagerFactory.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/SelectionManagerFactory.java
deleted file mode 100644
index 7e96a1807f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/SelectionManagerFactory.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.selection;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.eclipse.ui.IWindowListener;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-
-public class SelectionManagerFactory
-{
- private static SelectionManagerFactory INSTANCE;
-
- private static Object MUTEX = new Object();
-
-
- /**
- * Each <code>IWorkbenchWindow</code> has its own <code>SelectionManager</code>
- * to track the selection events in the <code>IWorkbenchWindow</code>. All
- * <code>ISelectionListener</code>s in the same <code>IWorkbenchWindow</code>
- * share the same <code>SelectionManager</code>.
- *
- * @return The <code>SelectionManager</code> associated with the current
- * <code>IWorkbenchWindow</code>
- */
- public static ISelectionManager getSelectionManager(IWorkbenchWindow window) {
- if (INSTANCE == null) {
- // this is thread safe for now. you never know whats comming
- synchronized (MUTEX) {
- if(INSTANCE == null) {
- INSTANCE = new SelectionManagerFactory();
- // if we do the init inside the constructor we end up in a loop
- // because the addWindowListener(this) does a callback to us
- INSTANCE.init();
- }
- }
- }
- return INSTANCE.internalGetSelectionManager(window);
- }
-
-
- private Map managers;
-
- private WindowListener windowListener;
-
-
- private SelectionManagerFactory() {
- managers = new HashMap();
- windowListener = new WindowListener();
- }
-
- private void init() {
- IWorkbench workbench = PlatformUI.getWorkbench();
- workbench.addWindowListener(windowListener);
- }
-
- /**
- * Returns the SelectionManager for the IWorkbenchWindow.
- * Creates a new one if none exists yet.
- */
- private SelectionManager internalGetSelectionManager(IWorkbenchWindow window) {
- if (window == null) {
- throw new IllegalArgumentException(window.toString());
- }
-
- if (! managers.containsKey(window)) {
- SelectionManager manager = new SelectionManager();
- this.managers.put(window, manager);
- manager.init(window);
- }
-
- return (SelectionManager) managers.get(window);
- }
-
-
- private class WindowListener implements IWindowListener
- {
- public void windowOpened(IWorkbenchWindow aWindow) {}
-
- public void windowClosed(IWorkbenchWindow aWindow) {
- SelectionManager manager = internalGetSelectionManager(aWindow);
- manager.dispose();
- managers.remove(aWindow);
- }
-
- public void windowActivated(IWorkbenchWindow aWindow) {}
-
- public void windowDeactivated(IWorkbenchWindow aWindow) {}
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/SelectionParticipantFactory.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/SelectionParticipantFactory.java
deleted file mode 100644
index 0bd4ca3bee..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/SelectionParticipantFactory.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.selection;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.jpt.ui.internal.views.JpaDetailsView;
-import org.eclipse.jpt.ui.internal.views.JpaStructureView;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.texteditor.ITextEditor;
-
-public class SelectionParticipantFactory
- implements IAdapterFactory
-{
- private static final Class[] ADAPTER_LIST = new Class[] { ISelectionParticipant.class };
-
- public Class[] getAdapterList() {
- return ADAPTER_LIST;
- }
-
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- if (! (adaptableObject instanceof IWorkbenchPart)) {
- return null;
- }
-
- ISelectionManager selectionManager =
- SelectionManagerFactory.getSelectionManager(((IWorkbenchPart) adaptableObject).getSite().getWorkbenchWindow());
- // TODO turn this into extension point
- if (adaptableObject instanceof ITextEditor) {
- return new TextEditorSelectionParticipant(selectionManager, (ITextEditor) adaptableObject);
- }
- else if (adaptableObject instanceof JpaStructureView) {
- return new JpaStructureSelectionParticipant(selectionManager, (JpaStructureView) adaptableObject);
- }
- else if (adaptableObject instanceof JpaDetailsView) {
- return new JpaDetailsSelectionParticipant((JpaDetailsView) adaptableObject);
- }
- else {
- return null;
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/TextEditorSelectionParticipant.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/TextEditorSelectionParticipant.java
deleted file mode 100644
index 3750cb371c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/TextEditorSelectionParticipant.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.selection;
-
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.viewers.IPostSelectionProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jpt.core.internal.IJpaContentNode;
-import org.eclipse.jpt.core.internal.IJpaFile;
-import org.eclipse.jpt.core.internal.ITextRange;
-import org.eclipse.jpt.core.internal.JptCorePlugin;
-import org.eclipse.jpt.ui.internal.views.AbstractJpaView;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IPropertyListener;
-import org.eclipse.ui.texteditor.ITextEditor;
-
-public class TextEditorSelectionParticipant
- implements ISelectionParticipant
-{
- private final ISelectionManager selectionManager;
-
- final ITextEditor textEditor;
-
- private final IPropertyListener editorInputListener;
-
- private final ISelectionChangedListener editorSelectionListener;
-
- private Selection currentSelection;
-
- private boolean forwardSelection = true; // TODO this just smells wrong ~bjv
-
-
- public TextEditorSelectionParticipant(ISelectionManager selectionManager, ITextEditor textEditor) {
- super();
- this.selectionManager = selectionManager;
- this.textEditor = textEditor;
- this.editorInputListener = new EditorInputListener();
- this.textEditor.addPropertyListener(this.editorInputListener);
- this.editorSelectionListener = new EditorSelectionListener();
- this.postSelectionProvider().addPostSelectionChangedListener(this.editorSelectionListener);
- this.currentSelection = this.calculateSelection();
- }
-
- // ********** ISelectionParticipant implementation **********
-
- public Selection getSelection() {
- return this.currentSelection;
- }
-
- public void selectionChanged(SelectionEvent evt) {
- Selection newSelection = evt.getSelection();
-
- if ((newSelection == Selection.NULL_SELECTION)
- || newSelection.equals(this.currentSelection)) {
- return;
- }
-
- this.forwardSelection = false;
- ITextRange textRange = newSelection.getSelectedNode().selectionTextRange();
- if (textRange != null) {
- this.textEditor.selectAndReveal(textRange.getOffset(), textRange.getLength());
- }
- this.forwardSelection = true;
- }
-
- public boolean disposeOnHide() {
- return true;
- }
-
- public void dispose() {
- this.textEditor.removePropertyListener(this.editorInputListener);
- this.postSelectionProvider().removePostSelectionChangedListener(this.editorSelectionListener);
- }
-
-
- // ********** internal methods **********
-
- private Selection calculateSelection() {
- ISelection selection = this.textEditor.getSelectionProvider().getSelection();
- if (! (selection instanceof ITextSelection)) {
- return Selection.NULL_SELECTION;
- }
-
- IJpaFile jpaFile = this.jpaFile();
- if (jpaFile == null) {
- return Selection.NULL_SELECTION;
- }
-
- IJpaContentNode selectedNode = jpaFile.getContentNode(((ITextSelection) selection).getOffset());
- if (selectedNode == null) {
- return Selection.NULL_SELECTION;
- }
-
- return new Selection(selectedNode);
- }
-
- private IJpaFile jpaFile() {
- IEditorInput input = this.textEditor.getEditorInput();
- if ( ! (input instanceof IFileEditorInput)) {
- return null;
- }
- return JptCorePlugin.jpaFile(((IFileEditorInput) input).getFile());
- }
-
- private IPostSelectionProvider postSelectionProvider() {
- return (IPostSelectionProvider) this.textEditor.getSelectionProvider();
- }
-
-
- // ********** listener callbacks **********
-
- void editorInputChanged() {
- Selection newSelection = this.calculateSelection();
- if (newSelection.equals(this.currentSelection)) {
- return;
- }
- this.currentSelection = newSelection;
- if (this.forwardSelection) {
- this.selectionManager.select(newSelection);
- }
- }
-
- void editorSelectionChanged(SelectionChangedEvent event) {
- Selection newSelection = this.calculateSelection();
- if (newSelection.equals(this.currentSelection)) {
- return;
- }
- this.currentSelection = newSelection;
-
- // bug 188344 - won't actively change selection manager selection if
- // a "JPA" view is the active (and presumably selecting) view
- if (this.textEditor.getEditorSite().getPage().getActivePart() instanceof AbstractJpaView) {
- return;
- }
-
- if (this.forwardSelection) {
- this.selectionManager.select(newSelection);
- }
- }
-
-
- // ********** listeners **********
-
- private class EditorInputListener implements IPropertyListener {
- EditorInputListener() {
- super();
- }
- public void propertyChanged(Object source, int propId) {
- if ((source == TextEditorSelectionParticipant.this.textEditor)
- && (propId == IEditorPart.PROP_INPUT)) {
- TextEditorSelectionParticipant.this.editorInputChanged();
- }
- }
- }
-
-
- private class EditorSelectionListener implements ISelectionChangedListener {
- EditorSelectionListener() {
- super();
- }
- public void selectionChanged(SelectionChangedEvent event) {
- TextEditorSelectionParticipant.this.editorSelectionChanged(event);
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/IJpaStructureProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/IJpaStructureProvider.java
deleted file mode 100644
index 90899cac54..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/IJpaStructureProvider.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.structure;
-
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-
-public interface IJpaStructureProvider
-{
-
- String fileContentType();
-
- /**
- * Build an outline content provider.
- */
- ITreeContentProvider buildContentProvider();
-
- /**
- * Build an outline label provider.
- */
- ILabelProvider buildLabelProvider();
-
- void dispose();
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/util/SWTUtil.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/util/SWTUtil.java
deleted file mode 100644
index 1f14002888..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/util/SWTUtil.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jpt.ui.internal.util;
-
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.swt.widgets.Table;
-
-//copied from jdt.internal.ui.util
-public class SWTUtil {
-
- public static int getTableHeightHint(Table table, int rows) {
- if (table.getFont().equals(JFaceResources.getDefaultFont()))
- table.setFont(JFaceResources.getDialogFont());
- int result= table.getItemHeight() * rows + table.getHeaderHeight();
- if (table.getLinesVisible())
- result+= table.getGridLineWidth() * (rows - 1);
- return result;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/util/TableLayoutComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/util/TableLayoutComposite.java
deleted file mode 100644
index cd51349405..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/util/TableLayoutComposite.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.jpt.ui.internal.util;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.Assert;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ControlAdapter;
-import org.eclipse.swt.events.ControlEvent;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-
-import org.eclipse.jface.viewers.ColumnLayoutData;
-import org.eclipse.jface.viewers.ColumnPixelData;
-import org.eclipse.jface.viewers.ColumnWeightData;
-
-/**
- * A special composite to layout columns inside a table. The composite is needed since we have
- * to layout the columns "before" the actual table gets layouted. Hence we can't use a normal
- * layout manager.
- *
- * copied from jdt.internal.ui.util
- */
-public class TableLayoutComposite extends Composite {
-
- /**
- * The number of extra pixels taken as horizontal trim by the table column.
- * To ensure there are N pixels available for the content of the column,
- * assign N+COLUMN_TRIM for the column width.
- *
- * @since 3.1
- */
- private static int COLUMN_TRIM = "carbon".equals(SWT.getPlatform()) ? 24 : 3; //$NON-NLS-1$
-
- private List columns= new ArrayList();
-
- /**
- * Creates a new <code>TableLayoutComposite</code>.
- */
- public TableLayoutComposite(Composite parent, int style) {
- super(parent, style);
- addControlListener(new ControlAdapter() {
- public void controlResized(ControlEvent e) {
- Rectangle area= getClientArea();
- Table table= (Table)getChildren()[0];
- Point preferredSize= computeTableSize(table);
- int width= area.width - 2 * table.getBorderWidth();
- if (preferredSize.y > area.height) {
- // Subtract the scrollbar width from the total column width
- // if a vertical scrollbar will be required
- Point vBarSize = table.getVerticalBar().getSize();
- width -= vBarSize.x;
- }
- layoutTable(table, width, area, table.getSize().x < area.width);
- }
- });
- }
-
- /**
- * Adds a new column of data to this table layout.
- *
- * @param data the column layout data
- */
- public void addColumnData(ColumnLayoutData data) {
- columns.add(data);
- }
-
- //---- Helpers -------------------------------------------------------------------------------------
-
- private Point computeTableSize(Table table) {
- Point result= table.computeSize(SWT.DEFAULT, SWT.DEFAULT);
-
- int width= 0;
- int size= columns.size();
- for (int i= 0; i < size; ++i) {
- ColumnLayoutData layoutData= (ColumnLayoutData) columns.get(i);
- if (layoutData instanceof ColumnPixelData) {
- ColumnPixelData col= (ColumnPixelData) layoutData;
- width += col.width;
- if (col.addTrim) {
- width += COLUMN_TRIM;
- }
- } else if (layoutData instanceof ColumnWeightData) {
- ColumnWeightData col= (ColumnWeightData) layoutData;
- width += col.minimumWidth;
- } else {
- Assert.isTrue(false, "Unknown column layout data"); //$NON-NLS-1$
- }
- }
- if (width > result.x)
- result.x= width;
- return result;
- }
-
- private void layoutTable(Table table, int width, Rectangle area, boolean increase) {
- // XXX: Layout is being called with an invalid value the first time
- // it is being called on Linux. This method resets the
- // Layout to null so we make sure we run it only when
- // the value is OK.
- if (width <= 1)
- return;
-
- TableColumn[] tableColumns= table.getColumns();
- int size= Math.min(columns.size(), tableColumns.length);
- int[] widths= new int[size];
- int fixedWidth= 0;
- int numberOfWeightColumns= 0;
- int totalWeight= 0;
-
- // First calc space occupied by fixed columns
- for (int i= 0; i < size; i++) {
- ColumnLayoutData col= (ColumnLayoutData) columns.get(i);
- if (col instanceof ColumnPixelData) {
- ColumnPixelData cpd= (ColumnPixelData) col;
- int pixels= cpd.width;
- if (cpd.addTrim) {
- pixels += COLUMN_TRIM;
- }
- widths[i]= pixels;
- fixedWidth += pixels;
- } else if (col instanceof ColumnWeightData) {
- ColumnWeightData cw= (ColumnWeightData) col;
- numberOfWeightColumns++;
- // first time, use the weight specified by the column data, otherwise use the actual width as the weight
- // int weight = firstTime ? cw.weight : tableColumns[i].getWidth();
- int weight= cw.weight;
- totalWeight += weight;
- } else {
- Assert.isTrue(false, "Unknown column layout data"); //$NON-NLS-1$
- }
- }
-
- // Do we have columns that have a weight
- if (numberOfWeightColumns > 0) {
- // Now distribute the rest to the columns with weight.
- int rest= width - fixedWidth;
- int totalDistributed= 0;
- for (int i= 0; i < size; ++i) {
- ColumnLayoutData col= (ColumnLayoutData) columns.get(i);
- if (col instanceof ColumnWeightData) {
- ColumnWeightData cw= (ColumnWeightData) col;
- // calculate weight as above
- // int weight = firstTime ? cw.weight : tableColumns[i].getWidth();
- int weight= cw.weight;
- int pixels= totalWeight == 0 ? 0 : weight * rest / totalWeight;
- if (pixels < cw.minimumWidth)
- pixels= cw.minimumWidth;
- totalDistributed += pixels;
- widths[i]= pixels;
- }
- }
-
- // Distribute any remaining pixels to columns with weight.
- int diff= rest - totalDistributed;
- for (int i= 0; diff > 0; ++i) {
- if (i == size)
- i= 0;
- ColumnLayoutData col= (ColumnLayoutData) columns.get(i);
- if (col instanceof ColumnWeightData) {
- ++widths[i];
- --diff;
- }
- }
- }
-
- if (increase) {
- table.setSize(area.width, area.height);
- }
- for (int i= 0; i < size; i++) {
- tableColumns[i].setWidth(widths[i]);
- }
- if (!increase) {
- table.setSize(area.width, area.height);
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/views/AbstractJpaView.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/views/AbstractJpaView.java
deleted file mode 100644
index aaa185b234..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/views/AbstractJpaView.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2006, 2007 Versant. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: Versant and Others. - initial API and implementation
- ********************************************************************************/
-package org.eclipse.jpt.ui.internal.views;
-
-import org.eclipse.jpt.ui.internal.selection.ISelectionManager;
-import org.eclipse.jpt.ui.internal.selection.Selection;
-import org.eclipse.jpt.ui.internal.selection.SelectionManagerFactory;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.part.PageBook;
-import org.eclipse.ui.part.ViewPart;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public abstract class AbstractJpaView extends ViewPart
-{
- protected PageBook pageBook;
-
- protected Composite defaultComposite;
-
-
- /**
- * The string to display when there is no view content
- */
- private String defaultLabel;
-
- private TabbedPropertySheetWidgetFactory widgetFactory;
-
-
- public AbstractJpaView(String aDefaultLabel) {
- super();
- defaultLabel = aDefaultLabel;
- this.widgetFactory = new TabbedPropertySheetWidgetFactory();
- }
-
- public final void createPartControl(Composite parent) {
- pageBook = new PageBook(parent, SWT.NONE);
- defaultComposite = buildDefaultComposite();
- pageBook.showPage(defaultComposite);
-
- subcreatePartControl(parent);
-
- ISelectionManager selectionManager =
- SelectionManagerFactory.getSelectionManager(getViewSite().getWorkbenchWindow());
- selectionManager.register(this);
- select(selectionManager.getCurrentSelection());
- }
-
- protected void subcreatePartControl(Composite parent) {
- // no op - for subclasses to override if wished
- }
-
- private Composite buildDefaultComposite() {
- Composite composite = getWidgetFactory().createComposite(pageBook, SWT.NONE);
- composite.setLayout(new FillLayout(SWT.VERTICAL));
- getWidgetFactory().createLabel(composite, defaultLabel);
- return composite;
- }
-
- public abstract void select(Selection aSelection);
-
- protected void showDefaultPage() {
- pageBook.showPage(defaultComposite);
- }
-
- public void setFocus() {
- pageBook.setFocus();
- }
-
- public TabbedPropertySheetWidgetFactory getWidgetFactory() {
- return this.widgetFactory;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/views/JpaDetailsView.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/views/JpaDetailsView.java
deleted file mode 100644
index 7aaa8548ff..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/views/JpaDetailsView.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.views;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import org.eclipse.jpt.core.internal.IJpaContentNode;
-import org.eclipse.jpt.ui.internal.IJpaPlatformUi;
-import org.eclipse.jpt.ui.internal.JptUiMessages;
-import org.eclipse.jpt.ui.internal.PlatformRegistry;
-import org.eclipse.jpt.ui.internal.details.IJpaDetailsPage;
-import org.eclipse.jpt.ui.internal.details.IJpaDetailsProvider;
-import org.eclipse.jpt.ui.internal.selection.Selection;
-import org.eclipse.jpt.utility.internal.iterators.CloneIterator;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.Composite;
-
-public class JpaDetailsView extends AbstractJpaView
-{
- private Selection currentSelection;
-
- private IJpaDetailsPage currentPage;
-
- /* key: String file content id, value: IJpaDetailsProvider */
- private Map<String, IJpaDetailsProvider> detailsProviders;
-
- /* key: Object content node id, value: Composite page */
- private Map<Object, IJpaDetailsPage> detailsPages;
-
- public JpaDetailsView() {
- super(JptUiMessages.JpaDetailsView_viewNotAvailable);
- this.currentSelection = Selection.NULL_SELECTION;
- this.detailsProviders = new HashMap<String, IJpaDetailsProvider>();
- this.detailsPages = new HashMap<Object, IJpaDetailsPage>();
- }
-
-
- public Selection getSelection() {
- return currentSelection;
- }
-
- public void select(Selection newSelection) {
- if (newSelection.equals(currentSelection)) {
- return;
- }
-
- currentSelection = newSelection;
-
- if (newSelection != Selection.NULL_SELECTION) {
- IJpaContentNode newNode = newSelection.getSelectedNode();
- IJpaDetailsPage newPage = getDetailsPage(newNode);
- setCurrentPage(newPage);
- }
- else if (currentSelection != Selection.NULL_SELECTION) {
- setCurrentPage(null);
- }
- }
-
- private IJpaDetailsPage getDetailsPage(IJpaContentNode contentNode) {
- if (detailsPages.containsKey(contentNode.getId())) {
- IJpaDetailsPage page = detailsPages.get(contentNode.getId());
-
- if ((page != null) &&
- (page.getControl().isDisposed())) {
- detailsPages.remove(contentNode.getId());
- }
- else {
- return page;
- }
- }
-
- return buildDetailsPage(contentNode);
- }
-
- private IJpaDetailsPage buildDetailsPage(IJpaContentNode contentNode) {
- IJpaDetailsProvider detailsProvider =
- getDetailsProvider(contentNode);
-
- if (detailsProvider == null) {
- return null;
- }
- Composite parentComposite = getWidgetFactory().createComposite(pageBook, SWT.NONE);
- parentComposite.setLayout(new FillLayout(SWT.VERTICAL));
- IJpaDetailsPage page =
- detailsProvider.buildDetailsPage(parentComposite, contentNode.getId(), getWidgetFactory());
-
- if (page != null) {
- detailsPages.put(contentNode.getId(), page);
- }
-
- return page;
- }
-
- private IJpaDetailsProvider getDetailsProvider(IJpaContentNode contentNode) {
- String contentId = contentNode.getJpaFile().getContentId();
- IJpaDetailsProvider provider = detailsProviders.get(contentId);
-
- if (provider == null) {
- String platformId = contentNode.jpaPlatform().getId();
- IJpaPlatformUi jpaPlatformUI = PlatformRegistry.instance().jpaPlatform(platformId);
- provider = jpaPlatformUI.detailsProvider(contentId);
-
- //TODO this view and the detailsProviders Map is not created on a per project basis.
- //the detailsProviders and their fileContentTypes could overlap across project, this would cause problems with storing this map.
-
- if (provider != null) {
- detailsProviders.put(contentId, provider);
- }
- }
-
- return provider;
- }
-
- private void setCurrentPage(IJpaDetailsPage newPage) {
- // depopulate old page
- if ((currentPage != null) && (currentPage != newPage)) {
- currentPage.populate(null);
- }
-
- // populate new page
- if (newPage != null) {
- newPage.populate(currentSelection.getSelectedNode());
- }
-
- currentPage = newPage;
-
- // show new page
- if (newPage == null) {
- showDefaultPage();
- }
- else {
- pageBook.showPage(newPage.getControl().getParent());
- }
- }
-
- public void dispose() {
- for (Iterator<String> stream = new CloneIterator<String>(detailsProviders.keySet()); stream.hasNext(); ) {
- String key = stream.next();
- IJpaDetailsProvider provider = detailsProviders.remove(key);
- provider.dispose();
- }
-
- for (Iterator<Object> stream = new CloneIterator<Object>(detailsPages.keySet()); stream.hasNext(); ) {
- Object key = stream.next();
- IJpaDetailsPage detailsPage = detailsPages.remove(key);
- detailsPage.dispose();
- }
-
- currentSelection = Selection.NULL_SELECTION;
- currentPage = null;
-
- super.dispose();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/views/JpaStructureView.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/views/JpaStructureView.java
deleted file mode 100644
index 4df3a6f498..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/views/JpaStructureView.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.views;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ITreeSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jpt.core.internal.IJpaContentNode;
-import org.eclipse.jpt.core.internal.IJpaFile;
-import org.eclipse.jpt.ui.internal.IJpaPlatformUi;
-import org.eclipse.jpt.ui.internal.JptUiMessages;
-import org.eclipse.jpt.ui.internal.PlatformRegistry;
-import org.eclipse.jpt.ui.internal.jface.NullLabelProvider;
-import org.eclipse.jpt.ui.internal.jface.NullTreeContentProvider;
-import org.eclipse.jpt.ui.internal.selection.Selection;
-import org.eclipse.jpt.ui.internal.structure.IJpaStructureProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.ui.IWorkbenchActionConstants;
-
-public class JpaStructureView extends AbstractJpaView
-{
- private StructureComposite structureComposite;
-
-
- public JpaStructureView() {
- super(JptUiMessages.JpaStructureView_viewNotAvailable);
- }
-
-
- @Override
- public void subcreatePartControl(Composite parent) {
- structureComposite =
- new StructureComposite(pageBook, SWT.NULL);
- }
-
- public Selection getSelection() {
- if (structureComposite.isVisible()) {
- return structureComposite.getSelection();
- }
- else {
- return Selection.NULL_SELECTION;
- }
- }
-
- @Override
- public void select(Selection newSelection) {
- Selection currentSelection = getSelection();
-
- if (newSelection.equals(currentSelection)) {
- return;
- }
-
- if (newSelection == Selection.NULL_SELECTION) {
- showDefaultPage();
- }
- else {
- pageBook.showPage(structureComposite);
- }
-
- structureComposite.select(newSelection);
- }
-
-
- public void addSelectionChangedListener(ISelectionChangedListener listener) {
- structureComposite.viewer.addSelectionChangedListener(listener);
- }
-
- public void removeSelectionChangedListener(ISelectionChangedListener listener) {
- structureComposite.viewer.removeSelectionChangedListener(listener);
- }
-
-
- private class StructureComposite extends Composite
- {
- /* key: String file content id, value: IJpaStructureProvider */
- private Map structureProviders;
-
- private TreeViewer viewer;
-
- private StructureComposite(Composite parent, int style) {
- super(parent, style);
-
- structureProviders = new HashMap();
-
- this.setLayout(new FillLayout());
-
- viewer = new TreeViewer(this, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
- viewer.setAutoExpandLevel(2);
- initContextMenu();
- }
-
- protected void initContextMenu() {
- // Create dynamic menu mgr. Dynamic is currently required to
- // support action contributions.
- MenuManager mgr = new MenuManager();
- mgr.setRemoveAllWhenShown(true);
- mgr.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager mgr) {
- fillContextMenu(mgr);
- }
- });
- Menu menu = mgr.createContextMenu(viewer.getControl());
- viewer.getControl().setMenu(menu);
- getSite().registerContextMenu(mgr, viewer);
-
- }
-
- /**
- * Called when the context menu is about to open.
- * Delegates to the action group using the viewer's selection as the action context.
- * @since 2.0
- */
- protected void fillContextMenu(IMenuManager manager) {
- manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- }
-
- private Selection getSelection() {
- ITreeSelection viewerSelection = (ITreeSelection) viewer.getSelection();
-
- if (viewerSelection.isEmpty() || viewerSelection.size() > 1) {
- if (viewer.getInput() == null) {
- return Selection.NULL_SELECTION;
- }
- else {
- return new Selection((IJpaContentNode) viewer.getInput());
- }
- }
-
- else {
- return new Selection((IJpaContentNode) viewerSelection.getFirstElement());
- }
-
- }
-
- private void select(Selection selection) {
- // note: checks for null and equals() selection have already been performed
-
- if (selection.equals(Selection.NULL_SELECTION)) {
- clearViewer();
- return;
- }
-
- Selection currentSelection = getSelection();
- IJpaContentNode newNode = selection.getSelectedNode();
- IJpaFile newFile = newNode.getJpaFile();
- IJpaContentNode currentNode =
- (currentSelection == Selection.NULL_SELECTION) ?
- null : getSelection().getSelectedNode();
- IJpaFile currentFile =
- (currentNode == null) ?
- null : currentNode.getJpaFile();
-
- if (newFile.equals(currentFile)) {
- viewer.setSelection(new StructuredSelection(newNode), true);
- }
- else if (currentFile != null && newFile.getContentId().equals(currentFile.getContentId())) {
- viewer.setInput(newFile.getContent());
- viewer.setSelection(new StructuredSelection(newNode), true);
- }
- else {
- // new content type
- // replace composite and set selection of tree
- IJpaStructureProvider provider = getStructureProvider(newNode);
-
- if (provider == null) {
- clearViewer();
- }
- else {
- viewer.setContentProvider(provider.buildContentProvider());
- viewer.setLabelProvider(provider.buildLabelProvider());
- viewer.setInput(newFile.getContent());
- }
- }
- }
-
- private void clearViewer() {
- viewer.setContentProvider(NullTreeContentProvider.INSTANCE);
- viewer.setLabelProvider(NullLabelProvider.INSTANCE);
- viewer.setInput(null);
- }
-
- private IJpaStructureProvider getStructureProvider(IJpaContentNode contentNode) {
- String contentId = contentNode.getJpaFile().getContentId();
- IJpaStructureProvider provider =
- (IJpaStructureProvider) structureProviders.get(contentId);
-
- if (provider == null) {
- String platformId = contentNode.jpaPlatform().getId();
- IJpaPlatformUi jpaPlatformUI = PlatformRegistry.instance().jpaPlatform(platformId);
- provider = jpaPlatformUI.structureProvider(contentId);
-
- //TODO this view and the detailsProviders Map is not created on a per project basis.
- //the detailsProviders and their fileContentTypes could overlap across project, this would cause problems with storing this map.
- if (provider != null) {
- structureProviders.put(contentId, provider);
- }
- }
-
- return provider;
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/CComboViewer.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/CComboViewer.java
deleted file mode 100644
index 24f1d1f6ba..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/CComboViewer.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.widgets;
-import org.eclipse.jface.viewers.AbstractListViewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-//bug #69254 is why i created this class, it is a copy of ComboViwer but using a CCombo
-
-/**
- * A concrete viewer based on an SWT <code>Combo</code> control. This class is intended
- * as an alternative to the JFace <code>ListViewer</code>, which displays its content
- * in a combo box rather than a list. Wherever possible, this class attempts to behave
- * like ListViewer. <p>
- *
- * This class is designed to be instantiated with a pre-existing SWT combo control
- * and configured with a domain-specific content provider, label provider, element
- * filter (optional), and element sorter (optional).
- * </p>
- *
- * @see org.eclipse.jface.viewers.ListViewer
- * @since 3.0
- */
-public final class CComboViewer extends AbstractListViewer {
-
- /**
- * This viewer's list control.
- */
- private CCombo combo;
-
- /**
- * Creates a combo viewer on a newly-created combo control under the given parent.
- * The viewer has no input, no content provider, a default label provider,
- * no sorter, and no filters.
- *
- * @param parent the parent control
- */
- public CComboViewer(Composite parent) {
- this(parent, SWT.READ_ONLY | SWT.BORDER);
- }
-
- /**
- * Creates a combo viewer on a newly-created combo control under the given parent.
- * The combo control is created using the given SWT style bits.
- * The viewer has no input, no content provider, a default label provider,
- * no sorter, and no filters.
- *
- * @param parent the parent control
- * @param style the SWT style bits
- */
- public CComboViewer(Composite parent, int style) {
- this(new CCombo(parent, style));
- }
-
- /**
- * Creates a combo viewer on the given combo control.
- * The viewer has no input, no content provider, a default label provider,
- * no sorter, and no filters.
- *
- * @param list the combo control
- */
- public CComboViewer(CCombo list) {
- this.combo = list;
- hookControl(list);
- }
-
- @Override
- protected void listAdd(String string, int index) {
- combo.add(string, index);
- }
-
- @Override
- protected void listSetItem(int index, String string) {
- combo.setItem(index, string);
- }
-
- @Override
- protected int[] listGetSelectionIndices() {
- return new int[] { combo.getSelectionIndex() };
- }
-
- @Override
- protected int listGetItemCount() {
- return combo.getItemCount();
- }
-
- @Override
- protected void listSetItems(String[] labels) {
- combo.setItems(labels);
- }
-
- @Override
- protected void listRemoveAll() {
- combo.removeAll();
- }
-
- @Override
- protected void listRemove(int index) {
- combo.remove(index);
- }
-
- /* (non-Javadoc)
- * Method declared on Viewer.
- */
- @Override
- public Control getControl() {
- return combo;
- }
-
- /**
- * Returns this list viewer's list control.
- *
- * @return the list control
- */
- public CCombo getCombo() {
- return combo;
- }
-
- /*
- * Do nothing -- combos only display the selected element, so there is no way
- * we can ensure that the given element is visible without changing the selection.
- * Method defined on StructuredViewer.
- */
- @Override
- public void reveal(Object element) {
- return;
- }
-
- @Override
- protected void listSetSelection(int[] ixs) {
- for (int idx = 0; idx < ixs.length; idx++) {
- combo.select(ixs[idx]);
- }
- }
-
- @Override
- protected void listDeselectAll() {
- combo.deselectAll();
- combo.clearSelection();
- }
-
- @Override
- protected void listShowSelection() {
- // do nothing
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/ScrolledPageContent.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/ScrolledPageContent.java
deleted file mode 100644
index 2d07fe9986..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/ScrolledPageContent.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.widgets;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.forms.FormColors;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.SharedScrolledComposite;
-
-//copied from package org.eclipse.jdt.internal.ui.preferences;
-public class ScrolledPageContent extends SharedScrolledComposite {
-
- private FormToolkit fToolkit;
-
- public ScrolledPageContent(Composite parent) {
- this(parent, SWT.V_SCROLL | SWT.H_SCROLL);
- }
-
- public ScrolledPageContent(Composite parent, int style) {
- super(parent, style);
-
- setFont(parent.getFont());
-
- FormColors colors= new FormColors(parent.getDisplay());
- colors.setBackground(null);
- colors.setForeground(null);
-
- fToolkit= new FormToolkit(colors);
-
- setExpandHorizontal(true);
- setExpandVertical(true);
-
- Composite body= new Composite(this, SWT.NONE);
- body.setFont(parent.getFont());
- setContent(body);
- }
-
- @Override
- public void dispose() {
- fToolkit.dispose();
- super.dispose();
- }
-
- public void adaptChild(Control childControl) {
- fToolkit.adapt(childControl, true, true);
- }
-
- public Composite getBody() {
- return (Composite) getContent();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/DatabaseReconnectWizardPage.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/DatabaseReconnectWizardPage.java
deleted file mode 100644
index 5344c188b7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/DatabaseReconnectWizardPage.java
+++ /dev/null
@@ -1,354 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.wizards;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.jpt.core.internal.IJpaProject;
-import org.eclipse.jpt.db.internal.ConnectionListener;
-import org.eclipse.jpt.db.internal.ConnectionProfile;
-import org.eclipse.jpt.db.internal.ConnectionProfileRepository;
-import org.eclipse.jpt.db.internal.Database;
-import org.eclipse.jpt.db.internal.JptDbPlugin;
-import org.eclipse.jpt.db.internal.Schema;
-import org.eclipse.jpt.db.internal.Table;
-import org.eclipse.jpt.db.ui.internal.DTPUiTools;
-import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.JptUiMessages;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Link;
-import org.eclipse.ui.PlatformUI;
-
-public class DatabaseReconnectWizardPage extends WizardPage {
- private IJpaProject jpaProject;
-
- private ConnectionProfile profile;
- private ConnectionListener connectionListener;
-
- public DatabaseReconnectWizardPage( IJpaProject jpaProject) {
- super( "Database Settings"); //$NON-NLS-1$
- this.jpaProject = jpaProject;
- setTitle( JptUiMessages.DatabaseReconnectWizardPage_databaseConnection);
- setMessage( JptUiMessages.DatabaseReconnectWizardPage_reconnectToDatabase);
- }
-
- public void createControl( Composite parent) {
- this.setPageComplete( false);
- Composite top = this.createTopLevelComposite( parent);
- this.setControl( top);
- }
-
- protected Composite createTopLevelComposite( Composite parent) {
- Composite composite = new Composite( parent, SWT.NULL);
- GridLayout layout = new GridLayout();
- composite.setLayout( layout);
- new DatabaseGroup( composite);
- Dialog.applyDialogFont( parent);
- // TODO Add Help - testing
- PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IJpaHelpContextIds.PROPERTIES_JAVA_PERSISTENCE_CONNECTION);
- return composite;
- }
-
- private Label createLabel( Composite container, int span, String text) {
- Label label = new Label( container, SWT.NONE);
- label.setText( text);
- GridData gd = new GridData();
- gd.horizontalIndent = 30;
- gd.horizontalSpan = span;
- label.setLayoutData( gd);
- return label;
- }
-
- private Combo createCombo( Composite container, boolean fillHorizontal) {
- Combo combo = new Combo( container, SWT.BORDER | SWT.SINGLE);
- if ( fillHorizontal) {
- combo.setLayoutData( new GridData( GridData.FILL_HORIZONTAL));
- }
- else {
- combo.setLayoutData( new GridData());
- }
- return combo;
- }
-
- /**
- * Initialize a grid layout with the default Dialog settings.
- */
- protected GridLayout initGridLayout( GridLayout layout, boolean margins) {
- layout.horizontalSpacing = this.convertHorizontalDLUsToPixels( IDialogConstants.HORIZONTAL_SPACING);
- layout.verticalSpacing = this.convertVerticalDLUsToPixels( IDialogConstants.VERTICAL_SPACING);
- if ( margins) {
- layout.marginWidth = this.convertHorizontalDLUsToPixels( IDialogConstants.HORIZONTAL_MARGIN);
- layout.marginHeight = this.convertVerticalDLUsToPixels( IDialogConstants.VERTICAL_MARGIN);
- }
- else {
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- }
- return layout;
- }
-
- public Collection<Table> getTables() {
- Schema schema = this.getDefaultSchema();
- if ( schema != null && schema.getName() != null) {
- return CollectionTools.collection( schema.tables());
- }
- return Collections.<Table>emptyList();
- }
-
- private void updateGenerateEntitiesPage( Schema schema) {
- GenerateEntitiesWizard generateEntitiesWizard = (( GenerateEntitiesWizard) this.getWizard());
- generateEntitiesWizard.updatePossibleTables( CollectionTools.collection( schema.tables()));
- }
-
- public void dispose() {
- this.removeConnectionListener();
- super.dispose();
- }
-
- private void removeConnectionListener() {
- if ( this.connectionListener != null) {
- if ( this.profile != null) {
- this.profile.removeConnectionListener( this.connectionListener);
- }
- this.connectionListener = null;
- }
- }
-
-
- ConnectionProfile getProjectConnectionProfile() {
- String profileName = this.jpaProject.dataSource().getConnectionProfileName();
- return JptDbPlugin.getDefault().getConnectionProfileRepository().profileNamed( profileName);
- }
-
- Schema getDefaultSchema() {
- ConnectionProfile profile = getProjectConnectionProfile();
- return profile.getDatabase().schemaNamed( profile.getDefaultSchema());
- }
-
- // ********** member classes **********
-
- private final class DatabaseGroup {
- private final Group group;
- private final Combo connectionCombo;
- private final Combo schemaCombo;
-
- private Link addConnectionLink;
- private Link reconnectLink;
-
- public DatabaseGroup( Composite composite) {
- this.group = new Group( composite, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- this.group.setLayout( layout);
- this.group.setLayoutData( new GridData( GridData.FILL_HORIZONTAL));
- this.group.setText( JptUiMessages.DatabaseReconnectWizardPage_database);
- //TODO Add Help
-// PlatformUI.getWorkbench().getHelpSystem().setHelp( this.group, IDaliHelpContextIds.XXX);
- createLabel( this.group, 1, JptUiMessages.DatabaseReconnectWizardPage_connection);
- this.connectionCombo = createCombo( this.group, true);
- this.connectionCombo.addSelectionListener( new SelectionAdapter() {
- public void widgetDefaultSelected( SelectionEvent e) {
- widgetSelected( e);
- }
-
- public void widgetSelected( SelectionEvent e) {
- handleConnectionChange();
- }
- });
- createLabel( this.group, 1, JptUiMessages.DatabaseReconnectWizardPage_schema);
- this.schemaCombo = createCombo( this.group, true);
- this.schemaCombo.addSelectionListener( new SelectionAdapter() {
- public void widgetDefaultSelected( SelectionEvent e) {
- widgetSelected( e);
- }
-
- public void widgetSelected( SelectionEvent e) {
- handleSchemaChange();
- }
- });
- createLabel( this.group, 2, JptUiMessages.DatabaseReconnectWizardPage_schemaInfo);
- this.addConnectionLink = new Link( this.group, SWT.NONE);
- GridData data = new GridData( GridData.END, GridData.CENTER, false, false);
- data.horizontalSpan = 2;
- this.addConnectionLink.setLayoutData( data);
- this.addConnectionLink.setText( JptUiMessages.DatabaseReconnectWizardPage_addConnectionLink);
- this.addConnectionLink.addSelectionListener( new SelectionAdapter() {
- public void widgetSelected( SelectionEvent e) {
- openNewConnectionWizard();
- }
- });
- this.reconnectLink = new Link( this.group, SWT.NONE);
- data = new GridData( GridData.END, GridData.CENTER, false, false);
- data.horizontalSpan = 2;
- this.reconnectLink.setLayoutData( data);
- this.reconnectLink.setText( JptUiMessages.DatabaseReconnectWizardPage_reconnectLink);
- this.reconnectLink.setEnabled( false);
- this.reconnectLink.addSelectionListener( new SelectionAdapter() {
- public void widgetSelected( SelectionEvent e) {
- openConnectionProfileNamed( connectionCombo.getText());
- }
- });
- this.populateConnectionCombo();
- this.populateSchemaCombo();
- }
-
- private ConnectionProfile getConnectionProfileNamed( String profileName) {
- return JptDbPlugin.getDefault().getConnectionProfileRepository().profileNamed( profileName);
- }
-
- private Iterator<String> dtpConnectionProfileNames() {
- return JptDbPlugin.getDefault().getConnectionProfileRepository().profileNames();
- }
-
- private String getProjectConnectionProfileName() {
- return jpaProject.dataSource().getConnectionProfileName();
- }
-
- Schema getDefaultSchema() {
- ConnectionProfile profile = getProjectConnectionProfile();
- return profile.getDatabase().schemaNamed( profile.getDefaultSchema());
- }
-
- private void openConnectionProfileNamed( String connectionProfileName) {
- DatabaseReconnectWizardPage.this.removeConnectionListener();
-
- DatabaseReconnectWizardPage.this.profile = JptDbPlugin.getDefault().getConnectionProfileRepository().profileNamed( connectionProfileName);
- DatabaseReconnectWizardPage.this.profile.connect();
- if( DatabaseReconnectWizardPage.this.profile.isConnected()) {
- this.populateSchemaCombo();
- DatabaseReconnectWizardPage.this.connectionListener = this.buildConnectionListener();
- DatabaseReconnectWizardPage.this.profile.addConnectionListener( DatabaseReconnectWizardPage.this.connectionListener);
- }
- return;
- }
-
- private void populateConnectionCombo() {
- // clear out connection entries from previous login.
- this.connectionCombo.removeAll();
- for ( Iterator<String> i = CollectionTools.sort( this.dtpConnectionProfileNames()); i.hasNext();) {
- this.connectionCombo.add(i.next());
- }
-
- String connectionName = getProjectConnectionProfileName();
- if ( !StringTools.stringIsEmpty( connectionName)) {
- this.connectionCombo.select( connectionCombo.indexOf( connectionName));
- this.reconnectLink.setEnabled( true);
- }
- }
-
- private void handleConnectionChange() {
- this.reconnectLink.setEnabled( true);
- this.populateSchemaCombo();
- }
-
- private void handleSchemaChange() {
- ConnectionProfile connectionProfile = this.getConnectionProfileNamed( getConnectionProfileName());
- Schema schema = connectionProfile.getDatabase().schemaNamed( this.getSchemaName());
- DatabaseReconnectWizardPage.this.updateGenerateEntitiesPage( schema);
- DatabaseReconnectWizardPage.this.setPageComplete( true);
- }
-
- private void populateSchemaCombo() {
- // clear out schema entries from previous connection selection
- this.schemaCombo.removeAll();
- ConnectionProfile connectionProfile = this.getConnectionProfileNamed( getConnectionProfileName());
- for ( Iterator<String> stream = CollectionTools.sort( connectionProfile.getDatabase().schemaNames()); stream.hasNext();) {
- this.schemaCombo.add(stream.next());
- }
- // set login user name as default schema
- Schema schema = this.getDefaultSchema();
- if ( schema != null && schema.getName() != null) {
- schema = connectionProfile.getDatabase().schemaNamed( schema.getName()); // verify schema exist
- if ( schema != null) {
- this.schemaCombo.select( this.schemaCombo.indexOf( schema.getName()));
- updateGenerateEntitiesPage( schema);
- setPageComplete( true);
- }
- }
- }
-
- private String getConnectionProfileName() {
- return this.connectionCombo.getText();
- }
-
- private String getSchemaName() {
- return this.schemaCombo.getText();
- }
-
- private void openNewConnectionWizard() {
- String addedProfileName = DTPUiTools.createNewProfile();
-
- ConnectionProfile addedProfile = ConnectionProfileRepository.instance().profileNamed( addedProfileName);
-
- if( !addedProfile.isNull()) {
- addedProfile.connect();
- this.populateConnectionCombo();
- this.connectionCombo.select( connectionCombo.indexOf( addedProfile.getName()));
- this.handleConnectionChange();
- }
- }
-
- private ConnectionListener buildConnectionListener() {
- return new ConnectionListener() {
-
- public void modified( ConnectionProfile profile) {
- // not interested to this event.
- }
-
- public boolean okToClose( ConnectionProfile profile) {
- // not interested to this event.
- return true;
- }
-
- public void opened( ConnectionProfile profile) {
- if( DatabaseReconnectWizardPage.this.profile.equals( profile)) {
- DatabaseGroup.this.populateSchemaCombo();
- }
- }
-
- public void aboutToClose( ConnectionProfile profile) {
- if( DatabaseReconnectWizardPage.this.profile.equals( profile)) {
- DatabaseReconnectWizardPage.this.removeConnectionListener();
- }
- }
-
- public void closed( ConnectionProfile profile) {
- // not interested to this event.
- }
-
- public void databaseChanged(ConnectionProfile profile, final Database database) {
- // not interested to this event.
- }
-
- public void schemaChanged(ConnectionProfile profile, final Schema schema) {
- // not interested to this event.
- }
-
- public void tableChanged(ConnectionProfile profile, final Table table) {
- // not interested to this event.
- }
- };
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/GenerateEntitiesWizard.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/GenerateEntitiesWizard.java
deleted file mode 100644
index ed1392045c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/GenerateEntitiesWizard.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.wizards;
-
-import java.util.Collection;
-import java.util.Collections;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.jpt.core.internal.IJpaProject;
-import org.eclipse.jpt.db.internal.ConnectionProfile;
-import org.eclipse.jpt.db.internal.Schema;
-import org.eclipse.jpt.db.internal.Table;
-import org.eclipse.jpt.gen.internal.EntityGenerator;
-import org.eclipse.jpt.gen.internal.PackageGenerator;
-import org.eclipse.jpt.ui.internal.JptUiMessages;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-
-public class GenerateEntitiesWizard extends Wizard {
-
- private IJpaProject jpaProject;
-
- private IStructuredSelection selection;
-
- /** this page is only built when the project is not connected to the db */
- private DatabaseReconnectWizardPage dbSettingsPage;
-
- private GenerateEntitiesWizardPage generateEntitiesPage;
-
- private PackageGenerator.Config packageGeneratorConfig;
-
- private EntityGenerator.Config entityGeneratorConfig;
-
- private boolean synchronizePersistenceXml;
-
- private Collection<Table> selectedTables;
-
- public GenerateEntitiesWizard( IJpaProject jpaProject, IStructuredSelection selection) {
- super();
- this.jpaProject = jpaProject;
- this.selection = selection;
- this.packageGeneratorConfig = new PackageGenerator.Config();
- this.entityGeneratorConfig = new EntityGenerator.Config();
- this.setWindowTitle( JptUiMessages.GenerateEntitiesWizard_generateEntities);
- }
-
- public void addPages() {
- super.addPages();
- this.dbSettingsPage = new DatabaseReconnectWizardPage( this.jpaProject);
- this.addPage(this.dbSettingsPage);
- this.generateEntitiesPage = new GenerateEntitiesWizardPage();
- this.addPage( this.generateEntitiesPage);
- this.generateEntitiesPage.init( this.selection);
- }
-
- public boolean performFinish() {
- this.packageGeneratorConfig.setPackageFragment( this.buildPackageFragment());
-
- this.entityGeneratorConfig.setConvertToCamelCase( this.generateEntitiesPage.convertToCamelCase());
- this.entityGeneratorConfig.setFieldAccessType( this.generateEntitiesPage.fieldAccessType());
- this.entityGeneratorConfig.setCollectionTypeName( this.generateEntitiesPage.getCollectionTypeName());
- this.entityGeneratorConfig.setFieldVisibility( this.generateEntitiesPage.getFieldVisibility());
- this.entityGeneratorConfig.setMethodVisibility( this.generateEntitiesPage.getMethodVisibility());
- this.entityGeneratorConfig.setGenerateGettersAndSetters( this.generateEntitiesPage.generateGettersAndSetters());
- this.entityGeneratorConfig.setGenerateDefaultConstructor( this.generateEntitiesPage.generateDefaultConstructor());
- this.entityGeneratorConfig.setSerializable( this.generateEntitiesPage.serializable());
- this.entityGeneratorConfig.setGenerateSerialVersionUID( this.generateEntitiesPage.generateSerialVersionUID());
- this.entityGeneratorConfig.setGenerateEmbeddedIdForCompoundPK( this.generateEntitiesPage.generateEmbeddedIdForCompoundPK());
- this.entityGeneratorConfig.setOverrideEntityNames( this.generateEntitiesPage.getOverrideEntityNames());
-
- this.synchronizePersistenceXml = this.generateEntitiesPage.synchronizePersistenceXml();
-
- this.selectedTables = this.generateEntitiesPage.getSelectedTables();
- return true;
- }
-
- private IPackageFragment buildPackageFragment() {
- IPackageFragmentRoot packageFragmentRoot = this.generateEntitiesPage.getPackageFragmentRoot();
- IPackageFragment packageFragment = this.generateEntitiesPage.getPackageFragment();
-
- if ( packageFragment == null) {
- packageFragment= packageFragmentRoot.getPackageFragment( ""); //$NON-NLS-1$
- }
-
- if ( packageFragment.exists()) {
- return packageFragment;
- }
-
- try {
- return packageFragmentRoot.createPackageFragment( packageFragment.getElementName(), true, null);
- }
- catch ( JavaModelException ex) {
- throw new RuntimeException( ex);
- }
- }
-
- Collection<Table> getPossibleTables() {
- if ( this.dbSettingsPage != null) {
- return this.dbSettingsPage.getTables();
- }
- return ( this.projectDefaultSchemaExists()) ? CollectionTools.collection( this.getDefaultSchema().tables()) : Collections.<Table>emptyList();
- }
-
- ConnectionProfile getProjectConnectionProfile() {
- return this.jpaProject.connectionProfile();
- }
-
- IJpaProject getJpaProject(){
- return this.jpaProject;
- }
-
- Schema getDefaultSchema() {
- ConnectionProfile profile = getProjectConnectionProfile();
- return profile.getDatabase().schemaNamed( profile.getDefaultSchema());
- }
-
- public PackageGenerator.Config getPackageGeneratorConfig() {
- return this.packageGeneratorConfig;
- }
-
- public EntityGenerator.Config getEntityGeneratorConfig() {
- return this.entityGeneratorConfig;
- }
-
- public Collection<Table> getSelectedTables() {
- return this.selectedTables;
- }
-
- public boolean synchronizePersistenceXml(){
- return this.synchronizePersistenceXml;
- }
-
- public boolean canFinish() {
- boolean canFinish = true;
- if ( ! this.generateEntitiesPage.isPageComplete()) {
- canFinish = false;
- }
- return canFinish;
- }
-
- private boolean projectDefaultSchemaExists() {
- return ( this.getDefaultSchema() != null);
- }
-
- /**
- * updatePossibleTables is called when schema’s PossibleTables changed.
- * The dbSettingsPage is mainly the source of changes,
- * and the generateEntitiesPage needs to be kept in sync.
- */
- void updatePossibleTables( Collection<Table> possibleTables) {
- this.generateEntitiesPage.updateTablesListViewer( possibleTables);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/GenerateEntitiesWizardPage.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/GenerateEntitiesWizardPage.java
deleted file mode 100644
index 10e64f2007..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/GenerateEntitiesWizardPage.java
+++ /dev/null
@@ -1,508 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.wizards;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jpt.ui.internal.util.SWTUtil;
-import org.eclipse.jpt.ui.internal.util.TableLayoutComposite;
-import org.eclipse.jdt.ui.wizards.NewTypeWizardPage;
-import org.eclipse.jface.viewers.CheckboxTableViewer;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.IBaseLabelProvider;
-import org.eclipse.jface.viewers.ICellModifier;
-import org.eclipse.jface.viewers.IContentProvider;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TextCellEditor;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.jpt.db.internal.Table;
-import org.eclipse.jpt.gen.internal.EntityGenerator;
-import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.JptUiMessages;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.ui.PlatformUI;
-
-// TODO determine name collisions
-class GenerateEntitiesWizardPage extends NewTypeWizardPage {
-
- CheckboxTableViewer tableTable;
-
- private boolean convertToCamelCase = true;
- private boolean fieldAccessType = true;
- private String collectionTypeName = Set.class.getName();
- private int fieldVisibility = EntityGenerator.Config.PRIVATE;
- private int methodVisibility = EntityGenerator.Config.PUBLIC;
- private boolean generateGettersAndSetters = true;
- private boolean generateDefaultConstructor = true;
- private boolean serializable = true;
- private boolean generateSerialVersionUID = true;
- private boolean generateEmbeddedIdForCompoundPK = true;
- private boolean synchronizePersistenceXml = false;
- private Map<Table, String> overrideEntityNames;
-
- static final String[] TABLE_TABLE_COLUMN_PROPERTIES = { "table", "entityName" };
- private static final int TABLE_COLUMN_INDEX = 0;
- private static final int ENTITY_NAME_COLUMN_INDEX = 1;
-
-
- GenerateEntitiesWizardPage() {
- super(true, "Generate Entities"); //$NON-NLS-1$
- setTitle(JptUiMessages.GenerateEntitiesWizardPage_generateEntities);
- setMessage(JptUiMessages.GenerateEntitiesWizardPage_chooseEntityTable);
- }
-
- // -------- Initialization ---------
- /**
- * The wizard owning this page is responsible for calling this method with the
- * current selection. The selection is used to initialize the fields of the wizard
- * page.
- *
- * @param selection used to initialize the fields
- */
- void init(IStructuredSelection selection) {
- IJavaElement jelem= getInitialJavaElement(selection);
- initContainerPage(jelem);
- initTypePage(jelem);
- doStatusUpdate();
- }
-
- public void createControl(Composite parent) {
- Composite composite = new Composite(parent, SWT.NULL);
- int nColumns= 4;
- GridLayout layout = new GridLayout();
- layout.numColumns = nColumns;
- composite.setLayout(layout);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IJpaHelpContextIds.DIALOG_GENERATE_ENTITIES);
-
- createContainerControls(composite, nColumns);
- createPackageControls(composite, nColumns);
-
- final Button synchronizeClassesCheckBox = new Button(composite, SWT.CHECK);
- synchronizeClassesCheckBox.setText(JptUiMessages.GenerateEntitiesWizardPage_synchronizeClasses);
- synchronizeClassesCheckBox.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- // do nothing
- }
-
- public void widgetSelected(SelectionEvent e) {
- setSynchronizePersistenceXml(synchronizeClassesCheckBox.getSelection());
- }
- });
-
- Group tablesGroup = new Group(composite, SWT.SHADOW_ETCHED_IN);
- tablesGroup.setLayout(new GridLayout(2, false));
- tablesGroup.setText(JptUiMessages.GenerateEntitiesWizardPage_tables);
- GridData data = new GridData();
- data.horizontalSpan = 4;
- data.verticalAlignment = SWT.FILL;
- data.horizontalAlignment = SWT.FILL;
- data.grabExcessHorizontalSpace = true;
- data.grabExcessVerticalSpace = true;
- tablesGroup.setLayoutData(data);
-
- createTablesSelectionControl(tablesGroup);
- createButtonComposite(tablesGroup);
-
- GenerateEntitiesWizard generateEntitiesWizard = ((GenerateEntitiesWizard)this.getWizard());
- Collection<Table> possibleTables = generateEntitiesWizard.getPossibleTables();
- initTablesSelectionControl(possibleTables);
-
- //set initial selection state of the synchronize classes checkbox
- synchronizeClassesCheckBox.setSelection(!generateEntitiesWizard.getJpaProject().discoversAnnotatedClasses());
- setSynchronizePersistenceXml(synchronizeClassesCheckBox.getSelection());
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this.tableTable.getControl(), IJpaHelpContextIds.DIALOG_GENERATE_ENTITIES_TABLES);
-
- setControl(composite);
- this.setPageComplete( false);
- }
-
- private void selectAllTables(){
- this.tableTable.setAllChecked(true);
- doStatusUpdate();
- }
-
- private void deselectAllTables(){
- this.tableTable.setAllChecked(false);
- doStatusUpdate();
- }
-
- private void initTablesSelectionControl(Collection<Table> possibleTables) {
- this.overrideEntityNames = new HashMap<Table, String>(possibleTables.size());
- this.tableTable.setInput(possibleTables);
- }
-
- private void createTablesSelectionControl(Composite parent) {
- TableLayoutComposite layout= new TableLayoutComposite(parent, SWT.NONE);
- addColumnLayoutData(layout);
-
- final org.eclipse.swt.widgets.Table table = new org.eclipse.swt.widgets.Table(layout, SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE | SWT.FULL_SELECTION | SWT.BORDER | SWT.CHECK);
- table.setHeaderVisible(true);
- table.setLinesVisible(true);
-
- TableColumn tableNameColumn = new TableColumn(table, SWT.NONE, TABLE_COLUMN_INDEX);
- tableNameColumn.setText(JptUiMessages.GenerateEntitiesWizardPage_tableColumn);
- tableNameColumn.setResizable(true);
-
- TableColumn entityNameColumn = new TableColumn(table, SWT.NONE, ENTITY_NAME_COLUMN_INDEX);
- entityNameColumn.setText(JptUiMessages.GenerateEntitiesWizardPage_entityNameColumn);
- entityNameColumn.setResizable(true);
-
- GridData gd= new GridData(GridData.FILL_BOTH);
- gd.heightHint= SWTUtil.getTableHeightHint(table, 20);
- gd.widthHint = 600;
- layout.setLayoutData(gd);
-
- this.tableTable = new CheckboxTableViewer(table);
- this.tableTable.setUseHashlookup(true);
- this.tableTable.setLabelProvider(this.buildTableTableLabelProvider());
- this.tableTable.setContentProvider(this.buildTableTableContentProvider());
- this.tableTable.setSorter(new ViewerSorter() {
- public int compare(Viewer viewer, Object e1, Object e2) {
- return ((Table) e1).getName().compareTo(((Table) e2).getName());
- }
- });
-
- this.tableTable.addPostSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- handleTablesListSelectionChanged(event);
- }
- });
-
- table.addKeyListener(new KeyAdapter() {
- public void keyPressed(KeyEvent e) {
- if (e.keyCode == SWT.F2 && e.stateMask == SWT.NONE) {
- editEntityNameIfPossible();
- e.doit= false;
- }
- }
- });
-
- this.addCellEditors();
- }
-
- private void createButtonComposite(Group tablesGroup){
-
- Composite buttonComposite = new Composite(tablesGroup, SWT.NULL);
- GridLayout buttonLayout = new GridLayout(1, false);
- buttonComposite.setLayout(buttonLayout);
- GridData data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.verticalAlignment = GridData.BEGINNING;
- buttonComposite.setLayoutData(data);
-
- Button selectAllButton = new Button(buttonComposite, SWT.PUSH);
- selectAllButton.setText(JptUiMessages.General_selectAll);
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- selectAllButton.setLayoutData(gridData);
- selectAllButton.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- // do nothing
- }
-
- public void widgetSelected(SelectionEvent e) {
- selectAllTables();
-
- }
- });
-
- Button deselectAllButton = new Button(buttonComposite, SWT.PUSH);
- deselectAllButton.setText(JptUiMessages.General_deselectAll);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- deselectAllButton.setLayoutData(gridData);
- deselectAllButton.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- // do nothing
- }
-
- public void widgetSelected(SelectionEvent e) {
- deselectAllTables();
- }
- });
- }
-
-
- private void addColumnLayoutData(TableLayoutComposite layout) {
- layout.addColumnData(new ColumnWeightData(50, true));
- layout.addColumnData(new ColumnWeightData(50, true));
- }
-
- void editEntityNameIfPossible(){
- Object[] selected = ((IStructuredSelection) this.tableTable.getSelection()).toArray();
- if (selected.length != 1) {
- return;
- }
- this.tableTable.editElement(selected[0], ENTITY_NAME_COLUMN_INDEX);
- }
-
- private void addCellEditors() {
- this.tableTable.setColumnProperties(TABLE_TABLE_COLUMN_PROPERTIES);
-
- TextCellEditor[] editors = new TextCellEditor[TABLE_TABLE_COLUMN_PROPERTIES.length];
- editors[ENTITY_NAME_COLUMN_INDEX]= new TextCellEditor(this.tableTable.getTable(), SWT.SINGLE);
-
- this.tableTable.setCellEditors(editors);
- this.tableTable.setCellModifier(this.buildTableTableCellModifier());
- }
-
- void handleTablesListSelectionChanged(SelectionChangedEvent event) {
- this.setPageComplete(true);
- if ( ! this.hasTablesSelected()) {
- this.setPageComplete(false);
- }
- }
-
- private IBaseLabelProvider buildTableTableLabelProvider() {
- return new TableTableLabelProvider();
- }
-
- private IContentProvider buildTableTableContentProvider() {
- return new TableTableContentProvider();
- }
-
- private ICellModifier buildTableTableCellModifier() {
- return new TableTableCellModifier();
- }
-
- Collection<Table> getSelectedTables() {
- ArrayList<Table> selectedTables = new ArrayList<Table>();
- for (Object selectedTable : this.tableTable.getCheckedElements())
- selectedTables.add((Table) selectedTable);
- return selectedTables;
- }
-
- private boolean hasTablesSelected() {
- return (this.tableTable != null) ? (this.getSelectedTables().size() > 0) : false;
- }
-
- void updateTablesListViewer(Collection<Table> possibleTables) {
- if (this.tableTable != null) {
- this.initTablesSelectionControl(possibleTables);
- }
- }
-
- private void doStatusUpdate() {
- // status of all used components
- IStatus[] status= new IStatus[] {
- fContainerStatus,
- fPackageStatus
- };
- // the mode severe status will be displayed and the OK button enabled/disabled.
- this.updateStatus(status);
- }
-
- /**
- * Update the status line and the OK button according to the given status
- */
- protected void updateStatus(IStatus status) {
- super.updateStatus(status);
- if (this.isPageComplete() && ! this.hasTablesSelected()) {
- this.setPageComplete(false);
- }
- }
-
- String entityName(Table table) {
- String overrideEntityName = this.overrideEntityNames.get(table);
- return (overrideEntityName != null) ? overrideEntityName : this.defaultEntityName(table);
- }
-
- private String defaultEntityName(Table table) {
- String entityName = table.shortJavaClassName();
- if (this.convertToCamelCase) {
- entityName = StringTools.convertUnderscoresToCamelCase(entityName);
- }
- return entityName;
- }
-
- void setOverrideEntityName(Table table, String name) {
- if (table.shortJavaClassName().equals(name)) {
- this.overrideEntityNames.remove(table);
- } else {
- this.overrideEntityNames.put(table, name);
- }
- }
-
- boolean convertToCamelCase() {
- return this.convertToCamelCase;
- }
-
- boolean fieldAccessType() {
- return this.fieldAccessType;
- }
-
- String getCollectionTypeName() {
- return this.collectionTypeName;
- }
-
- int getFieldVisibility() {
- return this.fieldVisibility;
- }
-
- int getMethodVisibility() {
- return this.methodVisibility;
- }
-
- boolean generateGettersAndSetters() {
- return this.generateGettersAndSetters;
- }
-
- boolean generateDefaultConstructor() {
- return this.generateDefaultConstructor;
- }
-
- boolean serializable() {
- return this.serializable;
- }
-
- boolean generateSerialVersionUID() {
- return this.generateSerialVersionUID;
- }
-
- boolean generateEmbeddedIdForCompoundPK() {
- return this.generateEmbeddedIdForCompoundPK;
- }
-
- boolean synchronizePersistenceXml() {
- return this.synchronizePersistenceXml;
- }
-
- private void setSynchronizePersistenceXml(boolean synchronizePersistenceXml){
- this.synchronizePersistenceXml = synchronizePersistenceXml;
- }
-
- /**
- * key = table
- * value = override entity name
- */
- Map<Table, String> getOverrideEntityNames() {
- return this.overrideEntityNames;
- }
-
-
- // ********** inner classes **********
-
- private class TableTableLabelProvider extends LabelProvider implements ITableLabelProvider {
-
- TableTableLabelProvider() {
- super();
- }
-
- public String getText(Object element) {
- return ((Table) element).getName();
- }
-
- public Image getColumnImage(Object element, int columnIndex) {
- return null;
- }
-
- public String getColumnText(Object element, int columnIndex) {
- if (element == null) {
- return null;
- }
- switch (columnIndex) {
- case TABLE_COLUMN_INDEX:
- return ((Table) element).getName();
-
- case ENTITY_NAME_COLUMN_INDEX:
- return GenerateEntitiesWizardPage.this.entityName((Table) element);
- }
- throw new IllegalArgumentException("invalid column index: " + columnIndex);
- }
-
- }
-
-
- private class TableTableContentProvider implements IStructuredContentProvider {
-
- TableTableContentProvider() {
- super();
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- // do nothing
- }
-
- public void dispose() {
- // do nothing
- }
-
- public Object[] getElements(Object inputElement) {
- return ((Collection) inputElement).toArray();
- }
-
- }
-
-
- private class TableTableCellModifier implements ICellModifier {
-
- TableTableCellModifier() {
- super();
- }
-
- public boolean canModify(Object element, String property) {
- return property.equals(TABLE_TABLE_COLUMN_PROPERTIES[ENTITY_NAME_COLUMN_INDEX]);
- }
-
- public Object getValue(Object element, String property) {
- if (property.equals(TABLE_TABLE_COLUMN_PROPERTIES[ENTITY_NAME_COLUMN_INDEX])) {
- return GenerateEntitiesWizardPage.this.entityName((Table) element);
- }
- return null;
- }
-
- public void modify(Object element, String property, Object value) {
- if (element instanceof TableItem) {
- element= ((TableItem) element).getData();
- }
- if ( ! (element instanceof Table)) {
- return;
- }
-
- boolean unchanged = false;
- Table table = (Table) element;
- if (property.equals(TABLE_TABLE_COLUMN_PROPERTIES[ENTITY_NAME_COLUMN_INDEX])) {
- unchanged = GenerateEntitiesWizardPage.this.entityName(table).equals(value);
- GenerateEntitiesWizardPage.this.setOverrideEntityName(table, (String) value);
- }
- if (! unchanged) {
- GenerateEntitiesWizardPage.this.tableTable.update(table, new String[] { property });
- }
- }
-
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/JpaFacetWizardPage.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/JpaFacetWizardPage.java
deleted file mode 100644
index 5d695081d7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/JpaFacetWizardPage.java
+++ /dev/null
@@ -1,494 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.wizards;
-
-import java.util.Iterator;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jdt.internal.ui.preferences.UserLibraryPreferencePage;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.preference.PreferenceDialog;
-import org.eclipse.jface.viewers.ComboViewer;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jpt.core.internal.JpaPlatformRegistry;
-import org.eclipse.jpt.core.internal.facet.IJpaFacetDataModelProperties;
-import org.eclipse.jpt.db.internal.ConnectionProfileRepository;
-import org.eclipse.jpt.db.ui.internal.DTPUiTools;
-import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.JptUiIcons;
-import org.eclipse.jpt.ui.internal.JptUiMessages;
-import org.eclipse.jpt.ui.internal.JptUiPlugin;
-import org.eclipse.jpt.ui.internal.prefs.JpaPreferencePage;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-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.Group;
-import org.eclipse.swt.widgets.Link;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.PreferencesUtil;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelEvent;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelListener;
-import org.eclipse.wst.common.project.facet.core.IFacetedProjectWorkingCopy;
-import org.eclipse.wst.common.project.facet.core.events.IFacetedProjectEvent;
-import org.eclipse.wst.common.project.facet.core.events.IFacetedProjectListener;
-import org.eclipse.wst.common.project.facet.ui.ModifyFacetedProjectWizard;
-import org.eclipse.wst.web.ui.internal.wizards.DataModelFacetInstallPage;
-
-public class JpaFacetWizardPage
- extends DataModelFacetInstallPage
- implements IJpaFacetDataModelProperties
-{
-
- public JpaFacetWizardPage() {
- super("jpt.jpa.facet.install.page"); //$NON-NLS-1$
- setTitle(JptUiMessages.JpaFacetWizardPage_title);
- setDescription(JptUiMessages.JpaFacetWizardPage_description);
- setImageDescriptor(JptUiPlugin.getPlugin().getImageDescriptor(JptUiIcons.JPA_WIZ_BANNER));
- }
-
-
- @Override
- protected Composite createTopLevelComposite(Composite parent) {
- Composite composite = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
- composite.setLayout(layout);
-
- new PlatformGroup(composite);
- new ConnectionGroup(composite);
- new ClasspathConfigGroup(composite);
- new PersistentClassManagementGroup(composite);
- new OrmXmlGroup(composite);
-
- setUpRuntimeListener();
-
- Dialog.applyDialogFont(parent);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IJpaHelpContextIds.DIALOG_JPA_FACET);
-
- return composite;
- }
-
- private void setUpRuntimeListener() {
- final IFacetedProjectWorkingCopy wc = ( (ModifyFacetedProjectWizard) getWizard() ).getFacetedProjectWorkingCopy();
- // must do it manually the first time
- model.setProperty(RUNTIME, wc.getPrimaryRuntime());
- wc.addListener(
- new IFacetedProjectListener() {
- public void handleEvent( final IFacetedProjectEvent event ) {
- model.setProperty(RUNTIME, wc.getPrimaryRuntime());
- }
- },
- IFacetedProjectEvent.Type.PRIMARY_RUNTIME_CHANGED
- );
- }
-
- private Button createButton(Composite container, int span, String text, int style) {
- Button button = new Button(container, SWT.NONE | style);
- button.setText(text);
- GridData gd = new GridData();
- gd.horizontalSpan = span;
- button.setLayoutData(gd);
- return button;
- }
-
- private Combo createCombo(Composite container, int span, boolean fillHorizontal) {
- Combo combo = new Combo(container, SWT.BORDER | SWT.SINGLE | SWT.READ_ONLY);
- GridData gd;
- if (fillHorizontal) {
- gd = new GridData(GridData.FILL_HORIZONTAL);
- }
- else {
- gd = new GridData();
- }
- gd.horizontalSpan = span;
- combo.setLayoutData(gd);
- return combo;
- }
-
- @Override
- protected String[] getValidationPropertyNames() {
- return new String[] {
- PLATFORM_ID,
- CONNECTION,
- USE_SERVER_JPA_IMPLEMENTATION,
- JPA_LIBRARY,
- DISCOVER_ANNOTATED_CLASSES
- };
- }
-
- @Override
- public boolean isPageComplete() {
- if (! super.isPageComplete()) {
- return false;
- }
- else {
- return (model.validate().getSeverity() != IStatus.ERROR);
- }
- }
-
- @Override
- public void setVisible(boolean visible) {
- super.setVisible(visible);
- if (visible) {
- setErrorMessage();
- }
- }
-
-
- private final class PlatformGroup
- {
- private final ComboViewer platformCombo;
-
-
- public PlatformGroup(Composite composite) {
- Group group = new Group(composite, SWT.NONE);
- group.setText(JptUiMessages.JpaFacetWizardPage_platformLabel);
- group.setLayout(new GridLayout());
- group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- PlatformUI.getWorkbench().getHelpSystem().setHelp(group, IJpaHelpContextIds.DIALOG_JPA_PLATFORM);
-
- platformCombo = new ComboViewer(createCombo(group, 1, true));
- platformCombo.setContentProvider(
- new IStructuredContentProvider() {
- public Object[] getElements(Object inputElement) {
- return CollectionTools.array(JpaPlatformRegistry.instance().jpaPlatformIds());
- }
-
- public void dispose() {}
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
- }
- );
- platformCombo.setLabelProvider(
- new ILabelProvider() {
- public Image getImage(Object element) {
- return null;
- }
-
- public String getText(Object element) {
- return JpaPlatformRegistry.instance().jpaPlatformLabel((String) element);
- }
-
- public void addListener(ILabelProviderListener listener) {}
-
- public void removeListener(ILabelProviderListener listener) {}
-
- public void dispose() {}
-
- public boolean isLabelProperty(Object element, String property) {
- return true;
- }
- }
- );
- platformCombo.addSelectionChangedListener(
- new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- model.setProperty(PLATFORM_ID, ((StructuredSelection) event.getSelection()).getFirstElement());
- }
- }
- );
- // we need some input here, even if it means absolutely nothing
- platformCombo.setInput("null input");
- if (platformCombo.getElementAt(0) != null) {
- platformCombo.setSelection(new StructuredSelection(platformCombo.getElementAt(0)));
- }
- }
- }
-
-
- private final class ConnectionGroup
- {
- private final Combo connectionCombo;
-
- private Link connectionLink;
-
-
- public ConnectionGroup(Composite composite) {
- Group group = new Group(composite, SWT.NONE);
- group.setText(JptUiMessages.JpaFacetWizardPage_connectionLabel);
- group.setLayout(new GridLayout());
- group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- PlatformUI.getWorkbench().getHelpSystem().setHelp(group, IJpaHelpContextIds.NEW_JPA_PROJECT_CONTENT_PAGE_DATABASE);
-
- connectionCombo = createCombo(group, 1, true);
- connectionCombo.addSelectionListener(
- new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- model.setProperty(CONNECTION, connectionCombo.getItem(connectionCombo.getSelectionIndex()));
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
- }
- );
- fillConnections();
- if (connectionCombo.getItemCount() > 0) {
- connectionCombo.select(0);
- model.setProperty(CONNECTION, connectionCombo.getItem(0));
- }
- else {
- connectionCombo.clearSelection();
- model.setProperty(CONNECTION, null);
- }
-
- connectionLink = new Link(group, SWT.NONE);
- GridData data = new GridData(GridData.END, GridData.CENTER, false, false);
- data.horizontalSpan = 2;
- connectionLink.setLayoutData(data);
- connectionLink.setText(JptUiMessages.JpaFacetWizardPage_connectionLink);
- connectionLink.addSelectionListener(
- new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- openNewConnectionWizard();
- }
- }
- );
- }
-
- private void fillConnections() {
- //clear out connection entries from previous login.
- connectionCombo.removeAll();
-
- for (Iterator stream = ConnectionProfileRepository.instance().profileNames(); stream.hasNext(); ) {
- connectionCombo.add((String) stream.next());
- }
- }
-
- private void openNewConnectionWizard() {
- String connectionName = DTPUiTools.createNewProfile();
- if (connectionName != null) {
- fillConnections();
- model.setProperty(CONNECTION, connectionName);
- connectionCombo.select(connectionCombo.indexOf(connectionName));
- }
- }
- }
-
-
- private final class ClasspathConfigGroup
- {
- private final Button useServerLibButton;
-
- private final Button specifyLibButton;
-
- private final Combo jpaLibCombo;
-
- private final Link jpaPrefsLink;
-
- private final Link userLibsLink;
-
-
-
- public ClasspathConfigGroup(Composite composite) {
- Group group = new Group(composite, SWT.NONE);
- group.setText(JptUiMessages.JpaFacetWizardPage_jpaImplementationLabel);
- group.setLayout(new GridLayout(2, false));
- group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- PlatformUI.getWorkbench().getHelpSystem().setHelp(group, IJpaHelpContextIds.NEW_JPA_PROJECT_CONTENT_PAGE_CLASSPATH);
-
- boolean useServerLib = model.getBooleanProperty(USE_SERVER_JPA_IMPLEMENTATION);
-
- useServerLibButton = createButton(group, 2, JptUiMessages.JpaFacetWizardPage_userServerLibLabel, SWT.RADIO);
- useServerLibButton.setSelection(useServerLib);
- useServerLibButton.addSelectionListener(
- new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
-
- public void widgetSelected(SelectionEvent e) {
- model.setBooleanProperty(USE_SERVER_JPA_IMPLEMENTATION, true);
- }
- }
- );
-
- specifyLibButton = createButton(group, 1, JptUiMessages.JpaFacetWizardPage_specifyLibLabel, SWT.RADIO);
- specifyLibButton.setSelection(! useServerLib);
- specifyLibButton.addSelectionListener(
- new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
-
- public void widgetSelected(SelectionEvent e) {
- model.setBooleanProperty(USE_SERVER_JPA_IMPLEMENTATION, false);
- }
- }
- );
-
- jpaLibCombo = createCombo(group, 1, true);
- synchHelper.synchCombo(jpaLibCombo, JPA_LIBRARY, null);
-
- model.addListener(
- new IDataModelListener() {
- public void propertyChanged(DataModelEvent event) {
- if (USE_SERVER_JPA_IMPLEMENTATION.equals(event.getPropertyName())) {
- boolean useServerLib = (Boolean) event.getProperty();
- useServerLibButton.setSelection(useServerLib);
- specifyLibButton.setSelection(! useServerLib);
- jpaLibCombo.setEnabled(! useServerLib);
- }
- }
- }
- );
-
- jpaPrefsLink = new Link(group, SWT.NONE);
- GridData data = new GridData(GridData.END, GridData.CENTER, false, false);
- data.horizontalSpan = 2;
- jpaPrefsLink.setLayoutData(data);
- jpaPrefsLink.setText(JptUiMessages.JpaFacetWizardPage_jpaPrefsLink);
- jpaPrefsLink.addSelectionListener(
- new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- promptToConfigJpaPrefs();
- }
- }
- );
-
- userLibsLink = new Link(group, SWT.NONE);
- data = new GridData(GridData.END, GridData.CENTER, false, false);
- data.horizontalSpan = 2;
- userLibsLink.setLayoutData(data);
- userLibsLink.setText(JptUiMessages.JpaFacetWizardPage_userLibsLink);
- userLibsLink.addSelectionListener(
- new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- promptToConfigUserLibraries();
- }
- }
- );
- }
-
- private void promptToConfigJpaPrefs() {
- PreferenceDialog dlg =
- PreferencesUtil.createPreferenceDialogOn(
- getShell(),
- JpaPreferencePage.ID,
- new String[] {JpaPreferencePage.ID},
- null);
- dlg.open();
- model.notifyPropertyChange(JPA_LIBRARY, IDataModel.VALID_VALUES_CHG);
- model.notifyPropertyChange(JPA_LIBRARY, IDataModel.DEFAULT_CHG);
- }
-
- private void promptToConfigUserLibraries() {
- PreferenceDialog dlg =
- PreferencesUtil.createPreferenceDialogOn(
- getShell(),
- UserLibraryPreferencePage.ID,
- new String[] {UserLibraryPreferencePage.ID},
- null);
- dlg.open();
- model.notifyPropertyChange(JPA_LIBRARY, IDataModel.VALID_VALUES_CHG);
- }
- }
-
-
- private final class PersistentClassManagementGroup
- {
- private final Button discoverClassesButton;
-
- private final Button listClassesButton;
-
-
- public PersistentClassManagementGroup(Composite composite) {
- Group group = new Group(composite, SWT.NONE);
- group.setText(JptUiMessages.JpaFacetWizardPage_persistentClassManagementLabel);
- group.setLayout(new GridLayout());
- group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- PlatformUI.getWorkbench().getHelpSystem().setHelp(group, IJpaHelpContextIds.NEW_JPA_PROJECT_CONTENT_PAGE_CLASSPATH);
-
- boolean discoverClasses = model.getBooleanProperty(DISCOVER_ANNOTATED_CLASSES);
-
- discoverClassesButton = createButton(group, 1, JptUiMessages.JpaFacetWizardPage_discoverClassesButton, SWT.RADIO);
- discoverClassesButton.setSelection(discoverClasses);
- discoverClassesButton.addSelectionListener(
- new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
-
- public void widgetSelected(SelectionEvent e) {
- model.setBooleanProperty(DISCOVER_ANNOTATED_CLASSES, true);
- }
- }
- );
-
- listClassesButton = createButton(group, 1, JptUiMessages.JpaFacetWizardPage_listClassesButton, SWT.RADIO);
- listClassesButton.setSelection(! discoverClasses);
- listClassesButton.addSelectionListener(
- new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
-
- public void widgetSelected(SelectionEvent e) {
- model.setBooleanProperty(DISCOVER_ANNOTATED_CLASSES, false);
- }
- }
- );
-
- model.addListener(
- new IDataModelListener() {
- public void propertyChanged(DataModelEvent event) {
- if (DISCOVER_ANNOTATED_CLASSES.equals(event.getPropertyName())) {
- boolean discoverClasses = (Boolean) event.getProperty();
- discoverClassesButton.setSelection(discoverClasses);
- listClassesButton.setSelection(! discoverClasses);
- }
- }
- }
- );
- }
- }
-
-
- private final class OrmXmlGroup
- {
- private final Button createOrmXmlButton;
-
-
- public OrmXmlGroup(Composite composite) {
- Composite group = new Composite(composite, SWT.NONE);
- group.setLayout(new GridLayout());
- group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- PlatformUI.getWorkbench().getHelpSystem().setHelp(group, IJpaHelpContextIds.DIALOG_CREATE_ORM);
-
- createOrmXmlButton = new Button(group, SWT.CHECK);
- createOrmXmlButton.setText(JptUiMessages.JpaFacetWizardPage_createOrmXmlButton);
- createOrmXmlButton.setSelection(model.getBooleanProperty(CREATE_ORM_XML));
- createOrmXmlButton.addSelectionListener(
- new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
-
- public void widgetSelected(SelectionEvent e) {
- model.setBooleanProperty(CREATE_ORM_XML, createOrmXmlButton.getSelection());
- }
- }
- );
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/NewJpaProjectFirstPage.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/NewJpaProjectFirstPage.java
deleted file mode 100644
index 299d2ebb06..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/NewJpaProjectFirstPage.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.wizards;
-
-import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.JptUiMessages;
-import org.eclipse.jst.j2ee.ui.project.facet.UtilityProjectFirstPage;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-public class NewJpaProjectFirstPage extends UtilityProjectFirstPage
-{
- public NewJpaProjectFirstPage(IDataModel dataModel, String pageName) {
- super(dataModel, pageName);
- setTitle(JptUiMessages.NewJpaProjectWizard_firstPage_title);
- setDescription(JptUiMessages.NewJpaProjectWizard_firstPage_description);
- setInfopopID(IJpaHelpContextIds.NEW_JPA_PROJECT);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/NewJpaProjectWizard.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/NewJpaProjectWizard.java
deleted file mode 100644
index d5f83a3b49..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/NewJpaProjectWizard.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.wizards;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jpt.ui.internal.JptUiIcons;
-import org.eclipse.jpt.ui.internal.JptUiMessages;
-import org.eclipse.jpt.ui.internal.JptUiPlugin;
-import org.eclipse.jst.j2ee.ui.project.facet.UtilityProjectWizard;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.project.facet.core.IFacetedProjectTemplate;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-
-public class NewJpaProjectWizard extends UtilityProjectWizard {
-
- public NewJpaProjectWizard() {
- super();
- setWindowTitle(JptUiMessages.NewJpaProjectWizard_title);
- }
-
- public NewJpaProjectWizard(IDataModel model) {
- super(model);
- setWindowTitle(JptUiMessages.NewJpaProjectWizard_title);
- }
-
- // TODO - when we have a data model to add
-// protected IDataModel createDataModel() {
-// return DataModelFactory.createDataModel(new UtilityProjectCreationDataModelProvider());
-// }
-
- protected ImageDescriptor getDefaultPageImageDescriptor() {
- return JptUiPlugin.getPlugin().getImageDescriptor(JptUiIcons.JPA_WIZ_BANNER);
- }
-
- protected IFacetedProjectTemplate getTemplate() {
- return ProjectFacetsManager.getTemplate("jpt.jpa.template");
- }
-
- protected IWizardPage createFirstPage() {
- return new NewJpaProjectFirstPage(model, "first.page"); //$NON-NLS-1$
- }
-
- protected String getFinalPerspectiveID() {
- return "org.eclipse.jpt.ui.jpaPerspective";
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/JptUiXmlMessages.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/JptUiXmlMessages.java
deleted file mode 100644
index c6804dd5a9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/JptUiXmlMessages.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.xml;
-
-import org.eclipse.osgi.util.NLS;
-
-public class JptUiXmlMessages
-{
- private static final String BUNDLE_NAME = "jpt_ui_xml"; //$NON-NLS-1$
-
- public static String PersistentTypePage_javaClassLabel;
- public static String PersistentTypePage_MetadataCompleteLabel;
- public static String PersistentTypePage_AccessLabel;
-
- public static String PersistenceUnitMetadataSection_SchemaDefault;
- public static String PersistenceUnitMetadataSection_CatalogDefault;
-
- public static String PersistentAttributePage_javaAttributeLabel;
-
- public static String XMLEntityMappingsPage_XmlMappingMetadataCompleteCheckBox;
- public static String XMLEntityMappingsPage_CascadePersistCheckBox;
- public static String XMLEntityMappingsPage_PersistenceUnitSection;
- public static String XMLEntityMappingsPage_SchemaDefault;
- public static String XMLEntityMappingsPage_SchemaNoDefaultSpecified;
- public static String XMLEntityMappingsPage_CatalogDefault;
- public static String XMLEntityMappingsPage_CatalogNoDefaultSpecified;
-
- public static String XmlSchemaChooser_SchemaChooser;
- public static String XmlCatalogChooser_CatalogChooser;
-
- public static String XmlJavaClassChooser_XmlJavaClassDialog_title;
- public static String XmlJavaClassChooser_XmlJavaClassDialog_message;
- public static String XmlPackageChooser_PackageDialog_title;
- public static String XmlPackageChooser_PackageDialog_message;
-
-
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, JptUiXmlMessages.class);
- }
-
- private JptUiXmlMessages() {
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/AccessTypeComboViewer.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/AccessTypeComboViewer.java
deleted file mode 100644
index 2bdf0b0231..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/AccessTypeComboViewer.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.xml.details;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jface.viewers.IBaseLabelProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jpt.core.internal.AccessType;
-import org.eclipse.jpt.ui.internal.details.BaseJpaController;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.widgets.CComboViewer;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class AccessTypeComboViewer extends BaseJpaController
-{
- private AccessHolder accessHolder;
- private Adapter accessHolderListener;
-
- private CComboViewer comboViewer;
-
-
- public AccessTypeComboViewer(Composite parent, CommandStack theCommandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, theCommandStack, widgetFactory);
- buildAccessHolderListener();
- }
-
-
- private void buildAccessHolderListener() {
- this.accessHolderListener = new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- accessHolderChanged(notification);
- }
- };
- }
-
- @Override
- protected void buildWidget(Composite parent) {
- CCombo combo = getWidgetFactory().createCCombo(parent);
- this.comboViewer = new CComboViewer(combo);
- this.comboViewer.setLabelProvider(buildAccessTypeLabelProvider());
- this.comboViewer.add(AccessType.VALUES.toArray());
-
- this.comboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- AccessTypeComboViewer.this.accessTypeSelectionChanged(event.getSelection());
- }
- });
- }
-
- private IBaseLabelProvider buildAccessTypeLabelProvider() {
- return new LabelProvider() {
- @Override
- public String getText(Object element) {
- if (element == AccessType.DEFAULT) {
- return JptUiMappingsMessages.AccessTypeCombo_default;
- }
- return super.getText(element);
- }
- };
- }
-
- void accessTypeSelectionChanged(ISelection selection) {
- if (selection instanceof IStructuredSelection) {
- AccessType access = (AccessType) ((IStructuredSelection) selection).getFirstElement();
- if ( ! this.accessHolder.getAccess().equals(access)) {
- this.accessHolder.setAccess(access);
- }
- }
- }
-
- private void accessHolderChanged(Notification notification) {
- if (notification.getFeatureID(this.accessHolder.featureClass()) ==
- this.accessHolder.featureId()) {
- Display.getDefault().asyncExec(
- new Runnable() {
- public void run() {
- populate();
- }
- });
- }
- }
-
- @Override
- protected void engageListeners() {
- if (this.accessHolder != null && this.accessHolder.wrappedObject() != null) {
- this.accessHolder.wrappedObject().eAdapters().add(this.accessHolderListener);
- }
- }
-
- @Override
- protected void disengageListeners() {
- if (this.accessHolder != null && this.accessHolder.wrappedObject() != null) {
- this.accessHolder.wrappedObject().eAdapters().remove(this.accessHolderListener);
- }
- }
-
- public final void populate(AccessHolder accessHolder) {
- super.populate(accessHolder);
- }
-
- @Override
- public void doPopulate(EObject obj) {
- this.accessHolder = (AccessHolder) obj;
- populateCombo();
- }
-
- @Override
- protected void doPopulate() {
- populateCombo();
- }
-
- private void populateCombo() {
- if (this.accessHolder.wrappedObject() == null) {
- return;
- }
-
- AccessType access = this.accessHolder.getAccess();
-
- if (((IStructuredSelection) this.comboViewer.getSelection()).getFirstElement() != access) {
- this.comboViewer.setSelection(new StructuredSelection(access));
- }
- }
-
-
- @Override
- public Control getControl() {
- return this.comboViewer.getCombo();
- }
-
- /**
- * An interface to wrap an object that supports accessType
- * An object of this type must be passed in to populate(EObject)
- */
- public static interface AccessHolder extends EObject {
- /**
- * Return the AccessType from the wrapped object
- * @return
- */
- AccessType getAccess();
-
- /**
- * Set the AccessType on the wrapped object
- * @param accessType
- */
- void setAccess(AccessType accessType);
-
- /**
- * Return the Class of the wrapped object
- * @return
- */
- Class featureClass();
-
- /**
- * Return the feature id of accessType on the wrapped object
- * @return
- */
- int featureId();
-
- /**
- * The wrapped EObject that the accessType is stored on
- * @return
- */
- EObject wrappedObject();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/CascadePersistCheckBox.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/CascadePersistCheckBox.java
deleted file mode 100644
index 332079a3f8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/CascadePersistCheckBox.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.xml.details;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
-import org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaults;
-import org.eclipse.jpt.ui.internal.details.BaseJpaController;
-import org.eclipse.jpt.ui.internal.xml.JptUiXmlMessages;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-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.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class CascadePersistCheckBox extends BaseJpaController
-{
- private PersistenceUnitDefaults persistenceUnitDefaults;
- private Adapter persistenceUnitDefaultsListener;
-
- private Button button;
-
-
- public CascadePersistCheckBox(Composite parent, CommandStack theCommandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, theCommandStack, widgetFactory);
- buildPeristenceUnitDefaultsListener();
- }
-
- private void buildPeristenceUnitDefaultsListener() {
- this.persistenceUnitDefaultsListener = new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- persistenceUnitDefaultsChanged(notification);
- }
- };
- }
-
- @Override
- protected void buildWidget(Composite parent) {
- this.button = getWidgetFactory().createButton(
- parent,
- JptUiXmlMessages.XMLEntityMappingsPage_CascadePersistCheckBox,
- SWT.CHECK);
-
- this.button.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent event) {
- CascadePersistCheckBox.this.cascadePersistSelectionChanged();
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- CascadePersistCheckBox.this.cascadePersistSelectionChanged();
- }
- });
- }
-
- void cascadePersistSelectionChanged() {
- boolean cascadePersist = this.button.getSelection();
- if (this.persistenceUnitDefaults.isCascadePersist() != cascadePersist) {
- this.persistenceUnitDefaults.setCascadePersist(cascadePersist);
- }
- }
-
- private void persistenceUnitDefaultsChanged(Notification notification) {
- if (notification.getFeatureID(PersistenceUnitDefaults.class) ==
- OrmPackage.PERSISTENCE_UNIT_DEFAULTS__CASCADE_PERSIST) {
- Display.getDefault().asyncExec(
- new Runnable() {
- public void run() {
- populate();
- }
- });
- }
- }
-
- @Override
- protected void engageListeners() {
- if (this.persistenceUnitDefaults != null) {
- this.persistenceUnitDefaults.eAdapters().add(this.persistenceUnitDefaultsListener);
- }
- }
-
- @Override
- protected void disengageListeners() {
- if (this.persistenceUnitDefaults != null) {
- this.persistenceUnitDefaults.eAdapters().remove(this.persistenceUnitDefaultsListener);
- }
- }
-
- @Override
- public void doPopulate(EObject obj) {
- this.persistenceUnitDefaults = (PersistenceUnitDefaults) obj;
- populateButton();
- }
-
- @Override
- protected void doPopulate() {
- populateButton();
- }
-
- private void populateButton() {
- boolean cascadePersist = false;
- if (this.persistenceUnitDefaults != null) {
- cascadePersist = this.persistenceUnitDefaults.isCascadePersist();
- }
-
- if (this.button.getSelection() != cascadePersist) {
- this.button.setSelection(cascadePersist);
- }
- }
-
-
- @Override
- public Control getControl() {
- return this.button;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/CommonWidgets.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/CommonWidgets.java
deleted file mode 100644
index 01e5c21461..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/CommonWidgets.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.xml.details;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.jpt.ui.internal.mappings.details.StringWithDefaultChooser;
-import org.eclipse.jpt.ui.internal.xml.JptUiXmlMessages;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class CommonWidgets
-{
- public static Label buildJavaClassLabel(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory) {
- Label label = widgetFactory.createLabel(parent, JptUiXmlMessages.PersistentTypePage_javaClassLabel);
- return label;
- }
-
- public static XmlJavaClassChooser buildJavaClassChooser(
- Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return new XmlJavaClassChooser(parent, commandStack, widgetFactory);
- }
-
- public static Label buildJavaAttributeNameLabel(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory) {
- Label label = widgetFactory.createLabel(parent, JptUiXmlMessages.PersistentAttributePage_javaAttributeLabel);
- return label;
- }
-
- public static XmlJavaAttributeChooser buildJavaAttributeChooser(
- Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return new XmlJavaAttributeChooser(parent, commandStack, widgetFactory);
- }
-
-
- public static Label buildAccessLabel(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory) {
- return widgetFactory.createLabel(parent, JptUiXmlMessages.PersistentTypePage_AccessLabel);
- }
-
- public static AccessTypeComboViewer buildAccessTypeComboViewer(
- Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return new AccessTypeComboViewer(parent, commandStack, widgetFactory);
- }
-
-
- public static Label buildCatalogLabel(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory) {
- return widgetFactory.createLabel(parent, JptUiXmlMessages.XmlCatalogChooser_CatalogChooser);
- }
-
- public static StringWithDefaultChooser buildCatalogChooser(
- Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return new StringWithDefaultChooser(parent, commandStack, widgetFactory);
- }
-
-
- public static Label buildSchemaLabel(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory) {
- return widgetFactory.createLabel(parent, JptUiXmlMessages.XmlSchemaChooser_SchemaChooser);
- }
-
- public static StringWithDefaultChooser buildSchemaChooser(
- Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return new StringWithDefaultChooser(parent, commandStack, widgetFactory);
- }
-
-
- public static Label buildPackageLabel(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory) {
- return widgetFactory.createLabel(parent, "Package:");
- }
-
- public static XmlPackageChooser buildXmlPackageChooser(
- Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return new XmlPackageChooser(parent, commandStack, widgetFactory);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/MetaDataCompleteComboViewer.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/MetaDataCompleteComboViewer.java
deleted file mode 100644
index d2243b618e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/MetaDataCompleteComboViewer.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.xml.details;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jface.viewers.IBaseLabelProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
-import org.eclipse.jpt.core.internal.content.orm.XmlTypeMapping;
-import org.eclipse.jpt.core.internal.mappings.DefaultFalseBoolean;
-import org.eclipse.jpt.ui.internal.details.BaseJpaController;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.widgets.CComboViewer;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class MetaDataCompleteComboViewer extends BaseJpaController
-{
- private XmlTypeMapping mapping;
- private Adapter typeMappingListener;
-
- private CComboViewer comboViewer;
-
-
- public MetaDataCompleteComboViewer(Composite parent, CommandStack theCommandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, theCommandStack, widgetFactory);
- buildTypeMappingListener();
- }
-
-
- private void buildTypeMappingListener() {
- this.typeMappingListener = new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- typeMappingChanged(notification);
- }
- };
- }
-
- @Override
- protected void buildWidget(Composite parent) {
- CCombo combo = getWidgetFactory().createCCombo(parent);
- this.comboViewer = new CComboViewer(combo);
- this.comboViewer.setLabelProvider(buildLabelProvider());
- this.comboViewer.add(DefaultFalseBoolean.VALUES.toArray());
- this.comboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- MetaDataCompleteComboViewer.this.metadataCompleteSelectionChanged(event.getSelection());
- }
- });
- }
- private IBaseLabelProvider buildLabelProvider() {
- return new LabelProvider() {
- @Override
- public String getText(Object element) {
- if (element == DefaultFalseBoolean.DEFAULT) {
- //TODO need to move this to the model, don't want hardcoded String
- return NLS.bind(JptUiMappingsMessages.MetaDataCompleteCombo_Default, "False");
- }
- return super.getText(element);
- }
- };
- }
-
- void metadataCompleteSelectionChanged(ISelection selection) {
- if (selection instanceof IStructuredSelection) {
- DefaultFalseBoolean metadataComplete = (DefaultFalseBoolean) ((IStructuredSelection) selection).getFirstElement();
- if ( ! this.mapping.getMetadataComplete().equals(metadataComplete)) {
- this.mapping.setMetadataComplete(metadataComplete);
-// this.editingDomain.getCommandStack().execute(
-// SetCommand.create(
-// this.editingDomain,
-// this.basicMapping,
-// OrmPackage.eINSTANCE.getBasicMapping_Optional(),
-// optional
-// )
-// );
- }
- }
- }
-
- private void typeMappingChanged(Notification notification) {
- if (notification.getFeatureID(XmlTypeMapping.class) ==
- OrmPackage.XML_TYPE_MAPPING__METADATA_COMPLETE) {
- Display.getDefault().asyncExec(
- new Runnable() {
- public void run() {
- populate();
- }
- });
- }
- }
-
- @Override
- protected void engageListeners() {
- if (this.mapping != null) {
- this.mapping.eAdapters().add(this.typeMappingListener);
- }
- }
-
- @Override
- protected void disengageListeners() {
- if (this.mapping != null) {
- this.mapping.eAdapters().remove(this.typeMappingListener);
- }
- }
-
- @Override
- public void doPopulate(EObject obj) {
- this.mapping = (XmlTypeMapping) obj;
- populateCombo();
- }
-
- @Override
- protected void doPopulate() {
- populateCombo();
- }
-
- private void populateCombo() {
- if (this.mapping == null) {
- return;
- }
-
- DefaultFalseBoolean metadataComplete = this.mapping.getMetadataComplete();
-
- if (((IStructuredSelection) this.comboViewer.getSelection()).getFirstElement() != metadataComplete) {
- this.comboViewer.setSelection(new StructuredSelection(metadataComplete));
- }
- }
-
-
- @Override
- public Control getControl() {
- return this.comboViewer.getCombo();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/PersistenceUnitMetadataSection.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/PersistenceUnitMetadataSection.java
deleted file mode 100644
index 253d9c91c4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/PersistenceUnitMetadataSection.java
+++ /dev/null
@@ -1,285 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.xml.details;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.AccessType;
-import org.eclipse.jpt.core.internal.XmlEObject;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
-import org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaults;
-import org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsInternal;
-import org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadata;
-import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.details.BaseJpaController;
-import org.eclipse.jpt.ui.internal.mappings.details.StringWithDefaultChooser;
-import org.eclipse.jpt.ui.internal.mappings.details.StringWithDefaultChooser.StringHolder;
-import org.eclipse.jpt.ui.internal.xml.JptUiXmlMessages;
-import org.eclipse.jpt.ui.internal.xml.details.AccessTypeComboViewer.AccessHolder;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.forms.widgets.ExpandableComposite;
-import org.eclipse.ui.forms.widgets.Section;
-import org.eclipse.ui.help.IWorkbenchHelpSystem;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class PersistenceUnitMetadataSection extends BaseJpaController
-{
-
- private Section section;
- private XmlMappingMetadataCompleteCheckBox xmlMappingMetadataCompleteCheckBox;
- private StringWithDefaultChooser xmlSchemaChooser;
- private StringWithDefaultChooser xmlCatalogChooser;
- private AccessTypeComboViewer accessComboViewer;
- private CascadePersistCheckBox cascadePersistCheckBox;
-
- public PersistenceUnitMetadataSection(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, commandStack, widgetFactory);
- }
-
- @Override
- protected void buildWidget(Composite parent) {
- IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
- this.section = getWidgetFactory().createSection(parent, SWT.FLAT | ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR);
- this.section.setText(JptUiXmlMessages.XMLEntityMappingsPage_PersistenceUnitSection);
-
- Composite persistenceUnitComposite = getWidgetFactory().createComposite(this.section);
- this.section.setClient(persistenceUnitComposite);
-
- GridLayout layout = new GridLayout(2, false);
- layout.marginWidth = 1;
- persistenceUnitComposite.setLayout(layout);
-
-
- this.xmlMappingMetadataCompleteCheckBox = buildXmlMappingMetadataCompleteCheckBox(persistenceUnitComposite);
- GridData gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- gridData.horizontalSpan = 2;
- this.xmlMappingMetadataCompleteCheckBox.getControl().setLayoutData(gridData);
- helpSystem.setHelp(xmlMappingMetadataCompleteCheckBox.getControl(), IJpaHelpContextIds.ENTITY_ORM_XML);
-
- CommonWidgets.buildSchemaLabel(persistenceUnitComposite, getWidgetFactory());
-
- this.xmlSchemaChooser = CommonWidgets.buildSchemaChooser(persistenceUnitComposite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.xmlSchemaChooser.getCombo().setLayoutData(gridData);
- helpSystem.setHelp(xmlSchemaChooser.getControl(), IJpaHelpContextIds.ENTITY_ORM_SCHEMA);
-
- CommonWidgets.buildCatalogLabel(persistenceUnitComposite, getWidgetFactory());
-
- this.xmlCatalogChooser = CommonWidgets.buildCatalogChooser(persistenceUnitComposite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.xmlCatalogChooser.getCombo().setLayoutData(gridData);
- helpSystem.setHelp(xmlCatalogChooser.getControl(), IJpaHelpContextIds.ENTITY_ORM_CATALOG);
-
- CommonWidgets.buildAccessLabel(persistenceUnitComposite, getWidgetFactory());
-
- this.accessComboViewer = CommonWidgets.buildAccessTypeComboViewer(persistenceUnitComposite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.accessComboViewer.getControl().setLayoutData(gridData);
- helpSystem.setHelp(accessComboViewer.getControl(), IJpaHelpContextIds.ENTITY_ORM_ACCESS);
-
-
- this.cascadePersistCheckBox = buildCascadePersistCheckBox(persistenceUnitComposite);
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- gridData.horizontalSpan = 2;
- this.cascadePersistCheckBox.getControl().setLayoutData(gridData);
- helpSystem.setHelp(cascadePersistCheckBox.getControl(), IJpaHelpContextIds.ENTITY_ORM_CASCADE);
-
- }
-
- private XmlMappingMetadataCompleteCheckBox buildXmlMappingMetadataCompleteCheckBox(Composite parent) {
- return new XmlMappingMetadataCompleteCheckBox(parent, this.commandStack, getWidgetFactory());
- }
-
- private CascadePersistCheckBox buildCascadePersistCheckBox(Composite parent) {
- return new CascadePersistCheckBox(parent, this.commandStack, getWidgetFactory());
- }
-
- @Override
- protected void engageListeners() {
- }
-
- @Override
- protected void disengageListeners() {
- }
-
- @Override
- public void doPopulate(EObject obj) {
- PersistenceUnitMetadata persistenceUnitMetadata = (PersistenceUnitMetadata) obj;
- this.xmlMappingMetadataCompleteCheckBox.populate(persistenceUnitMetadata);
- if (persistenceUnitMetadata != null) {
- this.accessComboViewer.populate(new MyAccessHolder(persistenceUnitMetadata.getPersistenceUnitDefaults()));
- this.xmlSchemaChooser.populate(new SchemaHolder(persistenceUnitMetadata.getPersistenceUnitDefaults()));
- this.xmlCatalogChooser.populate(new CatalogHolder(persistenceUnitMetadata.getPersistenceUnitDefaults()));
- this.cascadePersistCheckBox.populate(persistenceUnitMetadata.getPersistenceUnitDefaults());
- }
- else {
- this.accessComboViewer.populate(new MyAccessHolder(null));
- this.xmlSchemaChooser.populate(new SchemaHolder(null));
- this.xmlCatalogChooser.populate(new CatalogHolder(null));
- this.cascadePersistCheckBox.populate(null);
- }
- }
- private class MyAccessHolder extends XmlEObject implements AccessHolder{
-
- private PersistenceUnitDefaultsInternal persistenceUnitDefaults;
- MyAccessHolder(PersistenceUnitDefaults persistenceUnitDefaultsInternal) {
- super();
- this.persistenceUnitDefaults = (PersistenceUnitDefaultsInternal) persistenceUnitDefaultsInternal;
- }
- public void setAccess(AccessType accessType) {
- persistenceUnitDefaults.setAccess(accessType);
- }
-
- public AccessType getAccess() {
- return persistenceUnitDefaults.getAccess();
- }
-
- public Class featureClass() {
- return PersistenceUnitDefaults.class;
- }
-
- public int featureId() {
- return OrmPackage.PERSISTENCE_UNIT_DEFAULTS__ACCESS;
- }
-
- public EObject wrappedObject() {
- return this.persistenceUnitDefaults;
- }
- }
-
- private class SchemaHolder extends XmlEObject implements StringHolder {
- private PersistenceUnitDefaults persistenceUnitDefaults;
- SchemaHolder(PersistenceUnitDefaults persistenceUnitDefaults) {
- super();
- this.persistenceUnitDefaults = persistenceUnitDefaults;
- }
-
- public Class featureClass() {
- return PersistenceUnitDefaults.class;
- }
-
- public int featureId() {
- return OrmPackage.PERSISTENCE_UNIT_DEFAULTS__SCHEMA;
- }
-
- public boolean supportsDefault() {
- return false;
- }
-
- public int defaultFeatureId() {
- throw new UnsupportedOperationException();
- }
-
- public String defaultItem() {
- return JptUiXmlMessages.PersistenceUnitMetadataSection_SchemaDefault;
- }
-
- public String getString() {
- return this.persistenceUnitDefaults.getSchema();
- }
-
- public void setString(String newSchema) {
- this.persistenceUnitDefaults.setSchema(newSchema);
- }
-
- public EObject wrappedObject() {
- return this.persistenceUnitDefaults;
- }
- }
-
- private class CatalogHolder extends XmlEObject implements StringHolder {
- private PersistenceUnitDefaults persistenceUnitDefaults;
- CatalogHolder(PersistenceUnitDefaults persistenceUnitDefaults) {
- super();
- this.persistenceUnitDefaults = persistenceUnitDefaults;
- }
-
- public Class featureClass() {
- return PersistenceUnitDefaults.class;
- }
-
- public int featureId() {
- return OrmPackage.PERSISTENCE_UNIT_DEFAULTS__CATALOG;
- }
-
- public boolean supportsDefault() {
- return false;
- }
-
- public int defaultFeatureId() {
- throw new UnsupportedOperationException();
- }
-
- public String defaultItem() {
- return JptUiXmlMessages.PersistenceUnitMetadataSection_CatalogDefault;
- }
-
- public String getString() {
- return this.persistenceUnitDefaults.getCatalog();
- }
-
- public void setString(String string) {
- this.persistenceUnitDefaults.setCatalog(string);
- }
-
- public EObject wrappedObject() {
- return this.persistenceUnitDefaults;
- }
-
- }
-
- @Override
- protected void doPopulate() {
- this.xmlMappingMetadataCompleteCheckBox.populate();
- this.xmlSchemaChooser.populate();
- this.xmlCatalogChooser.populate();
- this.accessComboViewer.populate();
- this.cascadePersistCheckBox.populate();
- }
-
- @Override
- public void dispose() {
- this.xmlMappingMetadataCompleteCheckBox.dispose();
- this.xmlSchemaChooser.dispose();
- this.xmlCatalogChooser.dispose();
- this.accessComboViewer.dispose();
- this.cascadePersistCheckBox.dispose();
- super.dispose();
- }
-
- public Section getSection() {
- return this.section;
- }
-
- @Override
- public Control getControl() {
- return getSection();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlDetailsProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlDetailsProvider.java
deleted file mode 100644
index 0bcd70ded8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlDetailsProvider.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.xml.details;
-
-import org.eclipse.jpt.core.internal.JptCorePlugin;
-import org.eclipse.jpt.core.internal.content.orm.IXmlContentNodes;
-import org.eclipse.jpt.ui.internal.details.IJpaDetailsPage;
-import org.eclipse.jpt.ui.internal.details.IJpaDetailsProvider;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class XmlDetailsProvider
- implements IJpaDetailsProvider
-{
- public XmlDetailsProvider() {
- super();
- }
-
- public String fileContentType() {
- return JptCorePlugin.ORM_XML_CONTENT_TYPE;
- }
-
- public IJpaDetailsPage buildDetailsPage(
- Composite parentComposite, Object contentNodeId, TabbedPropertySheetWidgetFactory widgetFactory) {
- if (contentNodeId.equals(IXmlContentNodes.ENTITY_MAPPINGS_ID)) {
- return new XmlEntityMappingsDetailsPage(parentComposite, widgetFactory);
- }
- else if (contentNodeId.equals(IXmlContentNodes.PERSISTENT_TYPE_ID)) {
- return new XmlPersistentTypeDetailsPage(parentComposite, widgetFactory);
- }
- else if (contentNodeId.equals(IXmlContentNodes.PERSISTENT_ATTRIBUTE_ID)) {
- return new XmlPersistentAttributeDetailsPage(parentComposite, widgetFactory);
- }
-
- return null;
- }
-
- public void dispose() {
- // no op ... for now
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlEntityMappingsDetailsPage.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlEntityMappingsDetailsPage.java
deleted file mode 100644
index b70bde8825..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlEntityMappingsDetailsPage.java
+++ /dev/null
@@ -1,274 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.xml.details;
-
-import org.eclipse.emf.common.command.BasicCommandStack;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.AccessType;
-import org.eclipse.jpt.core.internal.IJpaContentNode;
-import org.eclipse.jpt.core.internal.XmlEObject;
-import org.eclipse.jpt.core.internal.content.orm.EntityMappings;
-import org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
-import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.details.BaseJpaDetailsPage;
-import org.eclipse.jpt.ui.internal.mappings.details.StringWithDefaultChooser;
-import org.eclipse.jpt.ui.internal.mappings.details.StringWithDefaultChooser.StringHolder;
-import org.eclipse.jpt.ui.internal.xml.JptUiXmlMessages;
-import org.eclipse.jpt.ui.internal.xml.details.AccessTypeComboViewer.AccessHolder;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.help.IWorkbenchHelpSystem;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class XmlEntityMappingsDetailsPage extends BaseJpaDetailsPage
-{
- private EntityMappings entityMappings;
-
- private XmlPackageChooser xmlPackageChooser;
-
- private StringWithDefaultChooser xmlSchemaChooser;
-
- private StringWithDefaultChooser xmlCatalogChooser;
-
- private AccessTypeComboViewer accessComboViewer;
-
- private PersistenceUnitMetadataSection persistenceUnitMetadataSection;
-
- public XmlEntityMappingsDetailsPage(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, new BasicCommandStack(), widgetFactory);
- }
-
- @Override
- protected void initializeLayout(Composite composite) {
- IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
- GridLayout layout = new GridLayout(2, false);
- layout.horizontalSpacing = 6;
- composite.setLayout(layout);
-
- GridData gridData;
-
- CommonWidgets.buildPackageLabel(composite, getWidgetFactory());
-
- this.xmlPackageChooser = CommonWidgets.buildXmlPackageChooser(composite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.xmlPackageChooser.getControl().setLayoutData(gridData);
- helpSystem.setHelp(xmlPackageChooser.getControl(), IJpaHelpContextIds.ENTITY_ORM_PACKAGE);
-
-
- CommonWidgets.buildSchemaLabel(composite, getWidgetFactory());
-
- this.xmlSchemaChooser = CommonWidgets.buildSchemaChooser(composite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.xmlSchemaChooser.getCombo().setLayoutData(gridData);
- helpSystem.setHelp(xmlSchemaChooser.getControl(), IJpaHelpContextIds.ENTITY_ORM_SCHEMA);
-
-
- CommonWidgets.buildCatalogLabel(composite, getWidgetFactory());
-
- this.xmlCatalogChooser = CommonWidgets.buildCatalogChooser(composite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.xmlCatalogChooser.getCombo().setLayoutData(gridData);
- helpSystem.setHelp(xmlCatalogChooser.getControl(), IJpaHelpContextIds.ENTITY_ORM_CATALOG);
-
-
- CommonWidgets.buildAccessLabel(composite, getWidgetFactory());
-
- this.accessComboViewer = CommonWidgets.buildAccessTypeComboViewer(composite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.accessComboViewer.getControl().setLayoutData(gridData);
- helpSystem.setHelp(accessComboViewer.getControl(), IJpaHelpContextIds.ENTITY_ORM_ACCESS);
-
- this.persistenceUnitMetadataSection = new PersistenceUnitMetadataSection(composite, this.commandStack, getWidgetFactory());
-
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- gridData.horizontalSpan = 2;
- this.persistenceUnitMetadataSection.getSection().setLayoutData(gridData);
- }
-
-
- @Override
- protected void doPopulate(IJpaContentNode contentNode) {
- this.entityMappings = (EntityMappings) contentNode;
- this.xmlPackageChooser.populate(this.entityMappings);
- this.xmlSchemaChooser.populate(new SchemaHolder(this.entityMappings));
- this.xmlCatalogChooser.populate(new CatalogHolder(this.entityMappings));
- this.accessComboViewer.populate(new MyAccessHolder(this.entityMappings));
- if (this.entityMappings != null) {
- this.persistenceUnitMetadataSection.populate(this.entityMappings.getPersistenceUnitMetadata());
- }
- else {
- this.persistenceUnitMetadataSection.populate(null);
- }
- }
-
- @Override
- protected void doPopulate() {
- this.xmlPackageChooser.populate();
- this.xmlSchemaChooser.populate();
- this.xmlCatalogChooser.populate();
- this.accessComboViewer.populate();
- this.persistenceUnitMetadataSection.populate();
- }
-
- @Override
- public void dispose() {
- this.xmlPackageChooser.dispose();
- this.xmlSchemaChooser.dispose();
- this.xmlCatalogChooser.dispose();
- this.accessComboViewer.dispose();
- this.persistenceUnitMetadataSection.dispose();
- super.dispose();
- }
-
- @Override
- protected void engageListeners() {
- }
-
- @Override
- protected void disengageListeners() {
- }
-
-
- private class MyAccessHolder extends XmlEObject implements AccessHolder{
-
- private EntityMappingsInternal entityMappings;
- MyAccessHolder(EntityMappings entityMappings) {
- super();
- this.entityMappings = (EntityMappingsInternal) entityMappings;
- }
- public void setAccess(AccessType accessType) {
- entityMappings.setSpecifiedAccess(accessType);
- }
-
- public AccessType getAccess() {
- return entityMappings.getSpecifiedAccess();
- }
-
- public Class featureClass() {
- return EntityMappingsInternal.class;
- }
-
- public int featureId() {
- return OrmPackage.ENTITY_MAPPINGS_INTERNAL__SPECIFIED_ACCESS;
- }
-
- public EObject wrappedObject() {
- return this.entityMappings;
- }
-
- }
-
- private class SchemaHolder extends XmlEObject implements StringHolder {
- private EntityMappingsInternal entityMappings;
- SchemaHolder(EntityMappings entityMappings) {
- super();
- this.entityMappings = (EntityMappingsInternal) entityMappings;
- }
-
- public Class featureClass() {
- return EntityMappingsInternal.class;
- }
-
- public int featureId() {
- return OrmPackage.ENTITY_MAPPINGS_INTERNAL__SPECIFIED_SCHEMA;
- }
-
- public boolean supportsDefault() {
- return true;
- }
-
- public int defaultFeatureId() {
- return OrmPackage.ENTITY_MAPPINGS_INTERNAL__DEFAULT_SCHEMA;
- }
-
- public String defaultItem() {
- String defaultSchema = this.entityMappings.getDefaultSchema();
- if (defaultSchema != null) {
- return NLS.bind(JptUiXmlMessages.XMLEntityMappingsPage_SchemaDefault, defaultSchema);
- }
- return JptUiXmlMessages.XMLEntityMappingsPage_SchemaNoDefaultSpecified;
- }
-
- public String getString() {
- return this.entityMappings.getSpecifiedSchema();
- }
-
- public void setString(String newSchema) {
- this.entityMappings.setSpecifiedSchema(newSchema);
- }
-
- public EObject wrappedObject() {
- return this.entityMappings;
- }
- }
-
- private class CatalogHolder extends XmlEObject implements StringHolder {
- private EntityMappingsInternal entityMappings;
- CatalogHolder(EntityMappings entityMappings) {
- super();
- this.entityMappings = (EntityMappingsInternal) entityMappings;
- }
-
- public Class featureClass() {
- return EntityMappingsInternal.class;
- }
-
- public int featureId() {
- return OrmPackage.ENTITY_MAPPINGS_INTERNAL__SPECIFIED_CATALOG;
- }
-
- public boolean supportsDefault() {
- return true;
- }
-
- public int defaultFeatureId() {
- return OrmPackage.ENTITY_MAPPINGS_INTERNAL__DEFAULT_CATALOG;
- }
-
- public String defaultItem() {
- String defaultCatalog = this.entityMappings.getDefaultCatalog();
- if (defaultCatalog != null) {
- return NLS.bind(JptUiXmlMessages.XMLEntityMappingsPage_CatalogDefault, defaultCatalog);
- }
- return JptUiXmlMessages.XMLEntityMappingsPage_CatalogNoDefaultSpecified;
- }
-
- public String getString() {
- return this.entityMappings.getSpecifiedCatalog();
- }
-
- public void setString(String newCatalog) {
- this.entityMappings.setSpecifiedCatalog(newCatalog);
- }
-
- public EObject wrappedObject() {
- return this.entityMappings;
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlJavaAttributeChooser.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlJavaAttributeChooser.java
deleted file mode 100644
index 8f58be68b4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlJavaAttributeChooser.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.xml.details;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
-import org.eclipse.jpt.core.internal.content.orm.XmlAttributeMapping;
-import org.eclipse.jpt.core.internal.content.orm.XmlPersistentAttribute;
-import org.eclipse.jpt.ui.internal.details.BaseJpaController;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class XmlJavaAttributeChooser extends BaseJpaController
-{
- private XmlPersistentAttribute attribute;
- private Adapter persistentAttributeListener;
-
- private Text text;
-
-
- public XmlJavaAttributeChooser(Composite parent, CommandStack theCommandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, theCommandStack, widgetFactory);
- buildPersistentAttributeListener();
- }
-
-
- private void buildPersistentAttributeListener() {
- this.persistentAttributeListener = new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- persistentAttributeChanged(notification);
- }
- };
- }
-
- @Override
- protected void buildWidget(Composite parent) {
- text = getWidgetFactory().createText(parent, "");
- text.addModifyListener(
- new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- textModified(e);
- }
- });
- }
-
- private void textModified(ModifyEvent e) {
- if (isPopulating()) {
- return;
- }
-
- String text = ((Text) e.getSource()).getText();
- attribute.setName(text);
-
- // TODO Does this need to be done?
- //this.editingDomain.getCommandStack().execute(SetCommand.create(this.editingDomain, this.entity, MappingsPackage.eINSTANCE.getEntity_SpecifiedName(), text));
- }
-
- private void persistentAttributeChanged(Notification notification) {
- if (notification.getFeatureID(XmlAttributeMapping.class) ==
- OrmPackage.XML_PERSISTENT_ATTRIBUTE__NAME) {
- Display.getDefault().asyncExec(
- new Runnable() {
- public void run() {
- populate();
- }
- });
- }
- }
-
- @Override
- protected void engageListeners() {
- if (attribute != null) {
- attribute.eAdapters().add(persistentAttributeListener);
- }
- }
-
- @Override
- protected void disengageListeners() {
- if (attribute != null) {
- attribute.eAdapters().remove(persistentAttributeListener);
- }
- }
-
- @Override
- public void doPopulate(EObject obj) {
- attribute = (obj == null) ? null : ((XmlAttributeMapping) obj).getPersistentAttribute();
- populateText();
- }
-
- @Override
- protected void doPopulate() {
- populateText();
- }
-
- private void populateText() {
- if (attribute == null) {
- text.clearSelection();
- return;
- }
-
- String name = attribute.getName();
-
- if (name == null) {
- name = "";
- }
- setTextData(name);
- }
-
- private void setTextData(String textData) {
- if (! textData.equals(text.getText())) {
- text.setText(textData);
- }
- }
-
- public Control getControl() {
- return text;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlJavaClassChooser.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlJavaClassChooser.java
deleted file mode 100644
index 3485245d26..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlJavaClassChooser.java
+++ /dev/null
@@ -1,250 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.xml.details;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.search.IJavaSearchScope;
-import org.eclipse.jdt.core.search.SearchEngine;
-import org.eclipse.jdt.internal.ui.refactoring.contentassist.ControlContentAssistHelper;
-import org.eclipse.jdt.internal.ui.refactoring.contentassist.JavaTypeCompletionProcessor;
-import org.eclipse.jdt.ui.IJavaElementSearchConstants;
-import org.eclipse.jdt.ui.JavaUI;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
-import org.eclipse.jpt.core.internal.content.orm.XmlPersistentType;
-import org.eclipse.jpt.core.internal.content.orm.XmlTypeMapping;
-import org.eclipse.jpt.ui.internal.JptUiPlugin;
-import org.eclipse.jpt.ui.internal.details.BaseJpaController;
-import org.eclipse.jpt.ui.internal.xml.JptUiXmlMessages;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-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.Text;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.SelectionDialog;
-import org.eclipse.ui.progress.IProgressService;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-//TODO possibly help the user and if they have chosen a package at the entity-mappings level
-//only insert the class name in the xml file if they choose a class from the package.
-//Not sure if this should be driven by the UI or by ui api in the model
-public class XmlJavaClassChooser extends BaseJpaController
-{
- private XmlPersistentType persistentType;
- private Adapter persistentTypeListener;
-
- private Composite composite;
- private Text text;
- private JavaTypeCompletionProcessor javaTypeCompletionProcessor;
-
- public XmlJavaClassChooser(Composite parent, CommandStack theCommandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, theCommandStack, widgetFactory);
- buildPersistentTypeListener();
- }
-
-
- private void buildPersistentTypeListener() {
- persistentTypeListener = new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- persistentTypeChanged(notification);
- }
- };
- }
-
- @Override
- protected void buildWidget(Composite parent) {
- this.composite = getWidgetFactory().createComposite(parent);
- GridLayout gridLayout = new GridLayout();
- gridLayout.marginHeight = 0;
- gridLayout.marginWidth = 1;
- gridLayout.numColumns = 2;
- this.composite.setLayout(gridLayout);
-
- text = getWidgetFactory().createText(this.composite, "");
- GridData data = new GridData();
- data.grabExcessHorizontalSpace = true;
- data.horizontalAlignment = GridData.FILL;
- this.text.setLayoutData(data);
- text.addModifyListener(
- new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- textModified(e);
- }
- });
-
- //TODO bug 156185 - when this is fixed there should be api for this
- this.javaTypeCompletionProcessor = new JavaTypeCompletionProcessor(false, false);
- ControlContentAssistHelper.createTextContentAssistant(this.text, this.javaTypeCompletionProcessor);
-
-
- Button browseButton = getWidgetFactory().createButton(this.composite, "Browse...", SWT.FLAT);
- data = new GridData();
- browseButton.setLayoutData(data);
- browseButton.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- IType type = chooseType();
- if (type != null) {
- text.setText(type.getFullyQualifiedName());
- }
- }
- public void widgetDefaultSelected(SelectionEvent e) {
- IType type = chooseType();
- if (type != null) {
- text.setText(type.getFullyQualifiedName());
- }
- }
- });
-
- }
-
- private void textModified(ModifyEvent e) {
- if (isPopulating()) {
- return;
- }
-
- String text = ((Text) e.getSource()).getText();
- persistentType.setClass(text);
-
- // TODO Does this need to be done?
- //this.editingDomain.getCommandStack().execute(SetCommand.create(this.editingDomain, this.entity, MappingsPackage.eINSTANCE.getEntity_SpecifiedName(), text));
- }
-
-
- protected IType chooseType() {
- IPackageFragmentRoot root= getPackageFragmentRoot();
- if (root == null) {
- return null;
- }
-
- IJavaElement[] elements= new IJavaElement[] { root.getJavaProject() };
- IJavaSearchScope scope= SearchEngine.createJavaSearchScope(elements);
- IProgressService service = PlatformUI.getWorkbench().getProgressService();
-
- SelectionDialog typeSelectionDialog;
- try {
- typeSelectionDialog = JavaUI.createTypeDialog(this.text.getShell(), service, scope, IJavaElementSearchConstants.CONSIDER_CLASSES, false, getType());
- }
- catch (JavaModelException e) {
- JptUiPlugin.log(e);
- throw new RuntimeException(e);
- }
- typeSelectionDialog.setTitle(JptUiXmlMessages.XmlJavaClassChooser_XmlJavaClassDialog_title);
- typeSelectionDialog.setMessage(JptUiXmlMessages.XmlJavaClassChooser_XmlJavaClassDialog_message);
-
- if (typeSelectionDialog.open() == Window.OK) {
- return (IType) typeSelectionDialog.getResult()[0];
- }
- return null;
- }
-
- private String getType() {
- return this.text.getText();
- }
-
- private IPackageFragmentRoot getPackageFragmentRoot() {
- IProject project = this.persistentType.getJpaProject().project();
- IJavaProject root = JavaCore.create(project);
- try {
- return root.getAllPackageFragmentRoots()[0];
- }
- catch (JavaModelException e) {
- JptUiPlugin.log(e);
- }
- return null;
- }
-
- private void persistentTypeChanged(Notification notification) {
- if (notification.getFeatureID(XmlPersistentType.class) ==
- OrmPackage.XML_PERSISTENT_TYPE__CLASS) {
- Display.getDefault().asyncExec(
- new Runnable() {
- public void run() {
- populate();
- }
- });
- }
- }
-
- @Override
- protected void engageListeners() {
- if (persistentType != null) {
- persistentType.eAdapters().add(persistentTypeListener);
- }
- }
-
- @Override
- protected void disengageListeners() {
- if (persistentType != null) {
- persistentType.eAdapters().remove(persistentTypeListener);
- }
- }
-
- @Override
- public void doPopulate(EObject obj) {
- persistentType = (obj == null) ? null : ((XmlTypeMapping) obj).getPersistentType();
- populateText();
- }
-
- @Override
- protected void doPopulate() {
- populateText();
- }
-
- private void populateText() {
- if (persistentType == null) {
- text.clearSelection();
- return;
- }
-
- IPackageFragmentRoot root = getPackageFragmentRoot();
- if (root != null) {
- this.javaTypeCompletionProcessor.setPackageFragment(root.getPackageFragment(""));
- }
-
-
- String javaClass = persistentType.getClass_();
-
- if (javaClass == null) {
- setTextData("");
- }
- else {
- setTextData(javaClass);
- }
- }
-
- private void setTextData(String textData) {
- if (! textData.equals(text.getText())) {
- text.setText(textData);
- }
- }
-
- public Control getControl() {
- return this.composite;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlMappingMetadataCompleteCheckBox.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlMappingMetadataCompleteCheckBox.java
deleted file mode 100644
index 5cdd03801e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlMappingMetadataCompleteCheckBox.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.xml.details;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
-import org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadata;
-import org.eclipse.jpt.ui.internal.details.BaseJpaController;
-import org.eclipse.jpt.ui.internal.xml.JptUiXmlMessages;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-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.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class XmlMappingMetadataCompleteCheckBox extends BaseJpaController
-{
- private PersistenceUnitMetadata persistenceUnitMetadata;
- private Adapter persistenceUnitMetadataListener;
-
- private Button button;
-
-
- public XmlMappingMetadataCompleteCheckBox(Composite parent, CommandStack theCommandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, theCommandStack, widgetFactory);
- buildPeristenceUnitMetadataListener();
- }
-
- private void buildPeristenceUnitMetadataListener() {
- this.persistenceUnitMetadataListener = new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- persistenceUnitMetadataChanged(notification);
- }
- };
- }
-
- @Override
- protected void buildWidget(Composite parent) {
- this.button = getWidgetFactory().createButton(
- parent,
- JptUiXmlMessages.XMLEntityMappingsPage_XmlMappingMetadataCompleteCheckBox,
- SWT.CHECK);
-
- this.button.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent event) {
- XmlMappingMetadataCompleteCheckBox.this.xmlMappingMetadataCompleteSelectionChanged();
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- XmlMappingMetadataCompleteCheckBox.this.xmlMappingMetadataCompleteSelectionChanged();
- }
- });
- }
-
- void xmlMappingMetadataCompleteSelectionChanged() {
- boolean xmlMappingMetadataComplete = this.button.getSelection();
- if (this.persistenceUnitMetadata.isXmlMappingMetadataComplete() != xmlMappingMetadataComplete) {
- this.persistenceUnitMetadata.setXmlMappingMetadataComplete(xmlMappingMetadataComplete);
- }
- }
-
- private void persistenceUnitMetadataChanged(Notification notification) {
- if (notification.getFeatureID(PersistenceUnitMetadata.class) ==
- OrmPackage.PERSISTENCE_UNIT_METADATA__XML_MAPPING_METADATA_COMPLETE) {
- Display.getDefault().asyncExec(
- new Runnable() {
- public void run() {
- populate();
- }
- });
- }
- }
-
- @Override
- protected void engageListeners() {
- if (this.persistenceUnitMetadata != null) {
- this.persistenceUnitMetadata.eAdapters().add(this.persistenceUnitMetadataListener);
- }
- }
-
- @Override
- protected void disengageListeners() {
- if (this.persistenceUnitMetadata != null) {
- this.persistenceUnitMetadata.eAdapters().remove(this.persistenceUnitMetadataListener);
- }
- }
-
- @Override
- public void doPopulate(EObject obj) {
- this.persistenceUnitMetadata = (PersistenceUnitMetadata) obj;
- populateButton();
- }
-
- @Override
- protected void doPopulate() {
- populateButton();
- }
-
- private void populateButton() {
- boolean xmlMappingMetadataComplete = false;
- if (this.persistenceUnitMetadata != null) {
- xmlMappingMetadataComplete = this.persistenceUnitMetadata.isXmlMappingMetadataComplete();
- }
-
- if (this.button.getSelection() != xmlMappingMetadataComplete) {
- this.button.setSelection(xmlMappingMetadataComplete);
- }
- }
-
-
- @Override
- public Control getControl() {
- return this.button;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlPackageChooser.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlPackageChooser.java
deleted file mode 100644
index 2800947b8b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlPackageChooser.java
+++ /dev/null
@@ -1,256 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.xml.details;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.internal.ui.refactoring.contentassist.ControlContentAssistHelper;
-import org.eclipse.jdt.internal.ui.refactoring.contentassist.JavaPackageCompletionProcessor;
-import org.eclipse.jdt.ui.JavaElementLabelProvider;
-import org.eclipse.jdt.ui.JavaUI;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jpt.core.internal.XmlEObject;
-import org.eclipse.jpt.core.internal.content.orm.EntityMappings;
-import org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
-import org.eclipse.jpt.ui.internal.JptUiPlugin;
-import org.eclipse.jpt.ui.internal.details.BaseJpaController;
-import org.eclipse.jpt.ui.internal.xml.JptUiXmlMessages;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-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.Text;
-import org.eclipse.ui.dialogs.SelectionDialog;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class XmlPackageChooser extends BaseJpaController
-{
- private EntityMappingsInternal entityMappings;
- private Adapter entityMappingsListener;
- private IContentAssistProcessor contentAssistProcessor;
-
- private Composite composite;
- private Text text;
-
-
- public XmlPackageChooser(Composite parent, CommandStack theCommandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, theCommandStack, widgetFactory);
- buildSchemaHolderListener();
- }
-
-
- private void buildSchemaHolderListener() {
- this.entityMappingsListener = new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- entityMappingsChanged(notification);
- }
- };
- }
-
- @Override
- protected void buildWidget(Composite parent) {
- this.composite = getWidgetFactory().createComposite(parent);
- GridLayout gridLayout = new GridLayout();
- gridLayout.marginHeight = 0;
- gridLayout.marginWidth = 1;
- gridLayout.numColumns = 2;
- this.composite.setLayout(gridLayout);
- this.text = getWidgetFactory().createText(this.composite, "");
- GridData data = new GridData();
- data.grabExcessHorizontalSpace = true;
- data.horizontalAlignment = GridData.FILL;
- this.text.setLayoutData(data);
- this.contentAssistProcessor = new JavaPackageCompletionProcessor(new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_ROOT));
- ControlContentAssistHelper.createTextContentAssistant(this.text, this.contentAssistProcessor);
-
- this.text.addModifyListener(
- new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- textModified(e);
- }
- });
-
- Button browseButton = getWidgetFactory().createButton(this.composite, "Browse...", SWT.FLAT);
- data = new GridData();
- browseButton.setLayoutData(data);
- browseButton.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- IPackageFragment packageFragment = choosePackage();
- if (packageFragment != null) {
- text.setText(packageFragment.getElementName());
- }
- }
- public void widgetDefaultSelected(SelectionEvent e) {
- IPackageFragment packageFragment = choosePackage();
- if (packageFragment != null) {
- text.setText(packageFragment.getElementName());
- }
- }
- });
- }
-
- private void textModified(ModifyEvent e) {
- if (isPopulating()) {
- return;
- }
-
- String text = ((Text) e.getSource()).getText();
- this.entityMappings.setPackage(text);
- //TODO set a JEM Package??
- //.setJavaClass(JavaRefFactory.eINSTANCE.createClassRef(text));
-
- // TODO Does this need to be done?
- //this.editingDomain.getCommandStack().execute(SetCommand.create(this.editingDomain, this.entity, MappingsPackage.eINSTANCE.getEntity_SpecifiedName(), text));
- }
-
- private void entityMappingsChanged(Notification notification) {
- if (notification.getFeatureID(EntityMappings.class) ==
- OrmPackage.ENTITY_MAPPINGS__PACKAGE) {
- Display.getDefault().asyncExec(
- new Runnable() {
- public void run() {
- populate();
- }
- });
- }
- }
-
- @Override
- protected void engageListeners() {
- if (this.entityMappings != null) {
- entityMappings.eAdapters().add(this.entityMappingsListener);
- }
- }
-
- @Override
- protected void disengageListeners() {
- if (this.entityMappings != null) {
- this.entityMappings.eAdapters().remove(this.entityMappingsListener);
- }
- }
-
- @Override
- public void doPopulate(EObject obj) {
- this.entityMappings = (EntityMappingsInternal) obj;
- populateText();
- }
-
- @Override
- protected void doPopulate() {
- populateText();
- }
-
- private void populateText() {
- if (entityMappings == null) {
- text.clearSelection();
- return;
- }
-
- IPackageFragmentRoot root = getPackageFragmentRoot();
- if (root != null) {
- ((JavaPackageCompletionProcessor)this.contentAssistProcessor).setPackageFragmentRoot(root);
- }
-
- String package_ = this.entityMappings.getPackage();
-
- if (package_ == null) {
- setTextData("");
- }
- else {
- setTextData(package_);
- }
- }
-
- private IPackageFragmentRoot getPackageFragmentRoot() {
- IProject project = ((XmlEObject) this.entityMappings).getJpaProject().project();
- IJavaProject root = JavaCore.create(project);
- try {
- return root.getAllPackageFragmentRoots()[0];
- }
- catch (JavaModelException e) {
- JptUiPlugin.log(e);
- }
- return null;
- }
-
- private void setTextData(String textData) {
- if (! textData.equals(text.getText())) {
- text.setText(textData);
- }
- }
-
- @Override
- public Control getControl() {
- return this.composite;
- }
-
- /**
- * Opens a selection dialog that allows to select a package.
- *
- * @return returns the selected package or <code>null</code> if the dialog has been canceled.
- * The caller typically sets the result to the package input field.
- * <p>
- * Clients can override this method if they want to offer a different dialog.
- * </p>
- *
- * @since 3.2
- */
- protected IPackageFragment choosePackage() {
- SelectionDialog selectionDialog;
- try {
- selectionDialog = JavaUI.createPackageDialog(text.getShell(), getPackageFragmentRoot());
- }
- catch (JavaModelException e) {
- JptUiPlugin.log(e);
- throw new RuntimeException(e);
- }
- selectionDialog.setTitle(JptUiXmlMessages.XmlPackageChooser_PackageDialog_title);
- selectionDialog.setMessage(JptUiXmlMessages.XmlPackageChooser_PackageDialog_message);
- selectionDialog.setHelpAvailable(false);
- IPackageFragment pack= getPackageFragment();
- if (pack != null) {
- selectionDialog.setInitialSelections(new Object[] { pack });
- }
-
- if (selectionDialog.open() == Window.OK) {
- return (IPackageFragment) selectionDialog.getResult()[0];
- }
- return null;
- }
-
- /**
- * Returns the package fragment corresponding to the current input.
- *
- * @return a package fragment or <code>null</code> if the input
- * could not be resolved.
- */
- public IPackageFragment getPackageFragment() {
- String packageString = this.text.getText();
- return getPackageFragmentRoot().getPackageFragment(packageString);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlPersistentAttributeDetailsPage.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlPersistentAttributeDetailsPage.java
deleted file mode 100644
index 66aaf7fab7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlPersistentAttributeDetailsPage.java
+++ /dev/null
@@ -1,223 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.xml.details;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.jpt.core.internal.IJpaContentNode;
-import org.eclipse.jpt.core.internal.IPersistentAttribute;
-import org.eclipse.jpt.core.internal.IPersistentType;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
-import org.eclipse.jpt.core.internal.content.orm.XmlAttributeMapping;
-import org.eclipse.jpt.core.internal.content.orm.XmlPersistentAttribute;
-import org.eclipse.jpt.core.internal.content.orm.XmlPersistentType;
-import org.eclipse.jpt.ui.internal.details.PersistentAttributeDetailsPage;
-import org.eclipse.jpt.ui.internal.java.details.IAttributeMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.mappings.properties.BasicMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.mappings.properties.EmbeddedIdMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.mappings.properties.EmbeddedMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.mappings.properties.IdMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.mappings.properties.ManyToManyMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.mappings.properties.ManyToOneMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.mappings.properties.OneToManyMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.mappings.properties.OneToOneMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.mappings.properties.TransientMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.mappings.properties.VersionMappingUiProvider;
-import org.eclipse.jpt.ui.internal.widgets.CComboViewer;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-import org.eclipse.jpt.utility.internal.iterators.EmptyListIterator;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.part.PageBook;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class XmlPersistentAttributeDetailsPage
- extends PersistentAttributeDetailsPage
-{
- private XmlJavaAttributeChooser javaAttributeChooser;
-
- private Adapter persistentTypeListener;
-
- private IPersistentType persistentType;
-
- private List<IAttributeMappingUiProvider> attributeMappingUiProviders;
-
- public XmlPersistentAttributeDetailsPage(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, widgetFactory);
- buildPersistentTypeListener();
- }
-
- private void buildPersistentTypeListener() {
- this.persistentTypeListener = new AdapterImpl() {
- @Override
- public void notifyChanged(Notification notification) {
- persistentTypeChanged(notification);
- }
- };
- }
-
- void persistentTypeChanged(Notification notification) {
- if (notification.getFeatureID(XmlPersistentType.class) ==
- OrmPackage.XML_PERSISTENT_TYPE__SPECIFIED_ATTRIBUTE_MAPPINGS) {
- Display.getDefault().asyncExec(
- new Runnable() {
- public void run() {
- updateEnbabledState();
- }
- });
- }
- }
-
- @Override
- public ListIterator<IAttributeMappingUiProvider> attributeMappingUiProviders() {
- if (this.attributeMappingUiProviders == null) {
- this.attributeMappingUiProviders = new ArrayList<IAttributeMappingUiProvider>();
- this.addAttributeMappingUiProvidersTo(this.attributeMappingUiProviders);
- }
- return new CloneListIterator<IAttributeMappingUiProvider>(this.attributeMappingUiProviders);
-
- }
-
- protected void addAttributeMappingUiProvidersTo(List<IAttributeMappingUiProvider> providers) {
- providers.add(BasicMappingUiProvider.instance());
- providers.add(EmbeddedMappingUiProvider.instance());
- providers.add(EmbeddedIdMappingUiProvider.instance());
- providers.add(IdMappingUiProvider.instance());
- providers.add(ManyToManyMappingUiProvider.instance());
- providers.add(ManyToOneMappingUiProvider.instance());
- providers.add(OneToManyMappingUiProvider.instance());
- providers.add(OneToOneMappingUiProvider.instance());
- providers.add(TransientMappingUiProvider.instance());
- providers.add(VersionMappingUiProvider.instance());
- }
-
- @Override
- protected ListIterator<IAttributeMappingUiProvider> defaultAttributeMappingUiProviders() {
- return EmptyListIterator.instance();
- }
-
- @Override
- protected IAttributeMappingUiProvider defaultAttributeMappingUiProvider(String key) {
- throw new UnsupportedOperationException("Xml attributeMappings should not be default");
- }
-
- @Override
- //bug 192035 - no default mapping option in xml
- protected IAttributeMappingUiProvider[] attributeMappingUiProvidersFor(IPersistentAttribute persistentAttribute) {
- return CollectionTools.array(attributeMappingUiProviders(), new IAttributeMappingUiProvider[CollectionTools.size(attributeMappingUiProviders())]);
- }
-
- @Override
- protected void initializeLayout(Composite composite) {
- composite.setLayout(new GridLayout(2, false));
-
- GridData gridData;
-
- CommonWidgets.buildJavaAttributeNameLabel(composite, getWidgetFactory());
-
- this.javaAttributeChooser = CommonWidgets.buildJavaAttributeChooser(composite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.javaAttributeChooser.getControl().setLayoutData(gridData);
-
-
- buildMappingLabel(composite);
-
- CComboViewer mappingCombo = buildMappingCombo(composite);
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- mappingCombo.getCombo().setLayoutData(gridData);
-
- PageBook book = buildMappingPageBook(composite);
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- gridData.horizontalSpan = 2;
- book.setLayoutData(gridData);
- }
-
- @Override
- protected void engageListeners() {
- super.engageListeners();
- if (getAttribute() != null) {
- this.persistentType = getAttribute().typeMapping().getPersistentType();
- this.persistentType.eAdapters().add(this.persistentTypeListener);
- }
- }
-
- @Override
- protected void disengageListeners() {
- if (this.persistentType != null) {
- this.persistentType.eAdapters().remove(this.persistentTypeListener);
- this.persistentType = null;
- }
- super.disengageListeners();
- }
-
- @Override
- protected void doPopulate(IJpaContentNode persistentAttributeNode) {
- super.doPopulate(persistentAttributeNode);
- if (persistentAttributeNode == null) {
- this.javaAttributeChooser.populate(null);
- }
- else {
- XmlAttributeMapping mapping = ((XmlPersistentAttribute) persistentAttributeNode).getMapping();
- this.javaAttributeChooser.populate(mapping);
- updateEnbabledState();
- }
- }
-
- @Override
- protected void doPopulate() {
- super.doPopulate();
- this.javaAttributeChooser.populate();
- updateEnbabledState();
- }
-
- @Override
- public void dispose() {
- this.javaAttributeChooser.dispose();
- super.dispose();
- }
-
- public void updateEnbabledState() {
- if (getAttribute() == null || getAttribute().eContainer() == null) {
- return;
- }
- boolean enabled = !((XmlPersistentAttribute) getAttribute()).isVirtual();
- updateEnabledState(enabled, getControl());
- }
-
- public void updateEnabledState(boolean enabled, Control control) {
- control.setEnabled(enabled);
- if (control instanceof Composite) {
- for (Iterator<Control> i = new ArrayIterator<Control>(((Composite) control).getChildren()); i.hasNext(); ) {
- updateEnabledState(enabled, i.next());
- }
- }
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlPersistentTypeDetailsPage.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlPersistentTypeDetailsPage.java
deleted file mode 100644
index 0c21e16c81..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlPersistentTypeDetailsPage.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.xml.details;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.ListIterator;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.AccessType;
-import org.eclipse.jpt.core.internal.IJpaContentNode;
-import org.eclipse.jpt.core.internal.XmlEObject;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
-import org.eclipse.jpt.core.internal.content.orm.XmlPersistentType;
-import org.eclipse.jpt.core.internal.content.orm.XmlTypeMapping;
-import org.eclipse.jpt.ui.internal.details.PersistentTypeDetailsPage;
-import org.eclipse.jpt.ui.internal.java.details.ITypeMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.mappings.properties.EmbeddableUiProvider;
-import org.eclipse.jpt.ui.internal.java.mappings.properties.EntityUiProvider;
-import org.eclipse.jpt.ui.internal.java.mappings.properties.MappedSuperclassUiProvider;
-import org.eclipse.jpt.ui.internal.widgets.CComboViewer;
-import org.eclipse.jpt.ui.internal.xml.JptUiXmlMessages;
-import org.eclipse.jpt.ui.internal.xml.details.AccessTypeComboViewer.AccessHolder;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.part.PageBook;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class XmlPersistentTypeDetailsPage extends PersistentTypeDetailsPage
-{
- private XmlJavaClassChooser javaClassChooser;
-
- private MetaDataCompleteComboViewer metadataCompleteComboViewer;
-
- private AccessTypeComboViewer accessComboViewer;
-
- //Storing these here instead of querying IJpaPlatformUI, because the orm.xml schema
- //is not extensible. We only need to support extensibility for java
- private List<ITypeMappingUiProvider> xmlTypeMappingUiProviders;
-
- public XmlPersistentTypeDetailsPage(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, widgetFactory);
- }
-
- public ListIterator<ITypeMappingUiProvider> typeMappingUiProviders() {
- if (this.xmlTypeMappingUiProviders == null) {
- this.xmlTypeMappingUiProviders = new ArrayList<ITypeMappingUiProvider>();
- this.addXmlTypeMappingUiProvidersTo(this.xmlTypeMappingUiProviders);
- }
- return new CloneListIterator<ITypeMappingUiProvider>(this.xmlTypeMappingUiProviders);
- }
-
- protected void addXmlTypeMappingUiProvidersTo(Collection<ITypeMappingUiProvider> providers) {
- providers.add(EntityUiProvider.instance());
- providers.add(MappedSuperclassUiProvider.instance());
- providers.add(EmbeddableUiProvider.instance());
- }
-
- @Override
- protected void initializeLayout(Composite composite) {
- composite.setLayout(new GridLayout(2, false));
-
- GridData gridData;
-
- CommonWidgets.buildJavaClassLabel(composite, getWidgetFactory());
-
- this.javaClassChooser = CommonWidgets.buildJavaClassChooser(composite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.javaClassChooser.getControl().setLayoutData(gridData);
-
- buildTypeMappingLabel(composite);
-
- CComboViewer typeMappingCombo = buildTypeMappingCombo(composite);
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- typeMappingCombo.getCombo().setLayoutData(gridData);
-
- buildMetadataCompleteLabel(composite);
- this.metadataCompleteComboViewer = new MetaDataCompleteComboViewer(composite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.metadataCompleteComboViewer.getControl().setLayoutData(gridData);
-
- CommonWidgets.buildAccessLabel(composite, getWidgetFactory());
- this.accessComboViewer = CommonWidgets.buildAccessTypeComboViewer(composite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.accessComboViewer.getControl().setLayoutData(gridData);
-
- PageBook typeMappingPageBook = buildTypeMappingPageBook(composite);
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- gridData.horizontalSpan = 2;
- typeMappingPageBook.setLayoutData(gridData);
- }
-
- private Label buildMetadataCompleteLabel(Composite parent ) {
- return getWidgetFactory().createLabel(parent, JptUiXmlMessages.PersistentTypePage_MetadataCompleteLabel);
- }
-
- @Override
- protected void doPopulate(IJpaContentNode persistentTypeNode) {
- super.doPopulate(persistentTypeNode);
- if (persistentTypeNode == null) {
- this.javaClassChooser.populate(null);
- this.metadataCompleteComboViewer.populate(null);
- this.accessComboViewer.populate(new MyAccessHolder(null));
- }
- else {
- XmlTypeMapping mapping = ((XmlPersistentType) persistentTypeNode).getMapping();
- this.javaClassChooser.populate(mapping);
- this.metadataCompleteComboViewer.populate(mapping);
- this.accessComboViewer.populate(new MyAccessHolder(mapping));
- }
- }
-
- @Override
- protected void doPopulate() {
- super.doPopulate();
- this.javaClassChooser.populate();
- this.metadataCompleteComboViewer.populate();
- this.accessComboViewer.populate();
- }
-
- @Override
- public void dispose() {
- this.javaClassChooser.dispose();
- this.metadataCompleteComboViewer.dispose();
- this.accessComboViewer.dispose();
- super.dispose();
- }
-
-
- private class MyAccessHolder extends XmlEObject implements AccessHolder{
-
- private XmlTypeMapping xmlTypeMapping;
- MyAccessHolder(XmlTypeMapping xmlTypeMapping) {
- super();
- this.xmlTypeMapping = xmlTypeMapping;
- }
- public void setAccess(AccessType accessType) {
- xmlTypeMapping.setSpecifiedAccess(accessType);
- }
-
- public AccessType getAccess() {
- return xmlTypeMapping.getSpecifiedAccess();
- }
-
- public Class featureClass() {
- return XmlTypeMapping.class;
- }
-
- public int featureId() {
- return OrmPackage.XML_TYPE_MAPPING__SPECIFIED_ACCESS;
- }
-
- public EObject wrappedObject() {
- return this.xmlTypeMapping;
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/structure/EntityMappingsItemProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/structure/EntityMappingsItemProvider.java
deleted file mode 100644
index 171664b153..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/structure/EntityMappingsItemProvider.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.xml.structure;
-
-import java.util.Collection;
-import org.eclipse.emf.common.notify.AdapterFactory;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
-import org.eclipse.emf.edit.provider.IItemLabelProvider;
-import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
-import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
-import org.eclipse.emf.edit.provider.ItemProviderAdapter;
-import org.eclipse.emf.edit.provider.ViewerNotification;
-import org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsImages;
-
-public class EntityMappingsItemProvider extends ItemProviderAdapter
- implements IEditingDomainItemProvider,
- IStructuredItemContentProvider,
- ITreeItemContentProvider,
- IItemLabelProvider
-{
- public EntityMappingsItemProvider(AdapterFactory adapterFactory) {
- super(adapterFactory);
- }
-
- @Override
- public Collection getChildrenFeatures(Object object) {
- if (childrenFeatures == null) {
- super.getChildrenFeatures(object);
- childrenFeatures.add(OrmPackage.Literals.ENTITY_MAPPINGS_INTERNAL__PERSISTENT_TYPES);
- }
- return childrenFeatures;
- }
-
- @Override
- public Object getParent(Object object) {
- return null;
- }
-
- @Override
- public Object getImage(Object object) {
- return JptUiMappingsImages.getImage(JptUiMappingsImages.ENTITY_MAPPINGS);
- }
-
- @Override
- public String getText(Object object) {
- // TODO
- return "EntityMappings";
- }
-
- @Override
- public void notifyChanged(Notification notification) {
- updateChildren(notification);
-
- switch (notification.getFeatureID(EntityMappingsInternal.class)) {
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__PERSISTENT_TYPES:
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__TYPE_MAPPINGS:
- fireNotifyChanged(
- new ViewerNotification(
- notification, notification.getNotifier(), true, false));
- return;
- }
- super.notifyChanged(notification);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/structure/JpaCoreXmlItemProviderAdapterFactory.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/structure/JpaCoreXmlItemProviderAdapterFactory.java
deleted file mode 100644
index a79c0ffa0b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/structure/JpaCoreXmlItemProviderAdapterFactory.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.xml.structure;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.Notifier;
-import org.eclipse.emf.edit.provider.ChangeNotifier;
-import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
-import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
-import org.eclipse.emf.edit.provider.IChangeNotifier;
-import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
-import org.eclipse.emf.edit.provider.IItemLabelProvider;
-import org.eclipse.emf.edit.provider.INotifyChangedListener;
-import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
-import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
-import org.eclipse.jpt.core.internal.content.orm.util.OrmAdapterFactory;
-import org.eclipse.ui.services.IDisposable;
-
-/**
- * This is the factory that is used to provide the interfaces needed to support Viewers.
- * The adapters generated by this factory convert EMF adapter notifications into calls to {@link #fireNotifyChanged fireNotifyChanged}.
- * The adapters also support Eclipse property sheets.
- * Note that most of the adapters are shared among multiple instances.
- */
-public class JpaCoreXmlItemProviderAdapterFactory
- extends OrmAdapterFactory
- implements ComposeableAdapterFactory,
- IChangeNotifier,
- IDisposable
-{
- /**
- * This keeps track of the root adapter factory that delegates to this adapter factory.
- */
- protected ComposedAdapterFactory parentAdapterFactory;
-
- /**
- * This is used to implement {@link org.eclipse.emf.edit.provider.IChangeNotifier}.
- */
- protected IChangeNotifier changeNotifier = new ChangeNotifier();
-
- /**
- * This keeps track of all the supported types checked by {@link #isFactoryForType isFactoryForType}.
- */
- protected Collection supportedTypes = new ArrayList();
-
- public JpaCoreXmlItemProviderAdapterFactory() {
- supportedTypes.add(IEditingDomainItemProvider.class);
- supportedTypes.add(IStructuredItemContentProvider.class);
- supportedTypes.add(ITreeItemContentProvider.class);
- supportedTypes.add(IItemLabelProvider.class);
- }
-
-
- protected XmlRootContentNodeItemProvider xmlRootContentNodeItemProvider;
-
- public Adapter createXmlRootContentNodeAdapter() {
- if (xmlRootContentNodeItemProvider == null) {
- xmlRootContentNodeItemProvider = new XmlRootContentNodeItemProvider(this);
- }
-
- return xmlRootContentNodeItemProvider;
- }
-
- protected EntityMappingsItemProvider entityMappingsItemProvider;
-
- /**
- * This creates an adapter for a {@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsImpl}.
- */
- public Adapter createEntityMappingsAdapter() {
- if (entityMappingsItemProvider == null) {
- entityMappingsItemProvider = new EntityMappingsItemProvider(this);
- }
-
- return entityMappingsItemProvider;
- }
-
- /**
- * This keeps track of the one adapter used for all {@link org.eclipse.jpt.core.internal.content.orm.XmlPersistentType} instances.
- */
- protected XmlPersistentTypeItemProvider xmlPersistentTypeItemProvider;
-
- /**
- * This creates an adapter for a {@link org.eclipse.jpt.core.internal.content.orm.XmlPersistentType}.
- */
- public Adapter createXmlPersistentTypeAdapter() {
- if (xmlPersistentTypeItemProvider == null) {
- xmlPersistentTypeItemProvider = new XmlPersistentTypeItemProvider(
- this);
- }
-
- return xmlPersistentTypeItemProvider;
- }
-
- /**
- * This keeps track of the one adapter used for all {@link org.eclipse.jpt.core.internal.content.orm.XmlPersistentAttribute} instances.
- */
- protected XmlPersistentAttributeItemProvider xmlPersistentAttributeItemProvider;
-
- /**
- * This creates an adapter for a {@link org.eclipse.jpt.core.internal.content.orm.XmlPersistentAttribute}.
- */
- public Adapter createXmlPersistentAttributeAdapter() {
- if (xmlPersistentAttributeItemProvider == null) {
- xmlPersistentAttributeItemProvider = new XmlPersistentAttributeItemProvider(
- this);
- }
-
- return xmlPersistentAttributeItemProvider;
- }
-
- /**
- * This returns the root adapter factory that contains this factory.
- */
- public ComposeableAdapterFactory getRootAdapterFactory() {
- return parentAdapterFactory == null ? this : parentAdapterFactory
- .getRootAdapterFactory();
- }
-
- /**
- * This sets the composed adapter factory that contains this factory.
- */
- public void setParentAdapterFactory(
- ComposedAdapterFactory parentAdapterFactory) {
- this.parentAdapterFactory = parentAdapterFactory;
- }
-
- public boolean isFactoryForType(Object type) {
- return supportedTypes.contains(type) || super.isFactoryForType(type);
- }
-
- /**
- * This implementation substitutes the factory itself as the key for the adapter.
- */
- public Adapter adapt(Notifier notifier, Object type) {
- return super.adapt(notifier, this);
- }
-
- public Object adapt(Object object, Object type) {
- if (isFactoryForType(type)) {
- Object adapter = super.adapt(object, type);
- if (!(type instanceof Class)
- || (((Class) type).isInstance(adapter))) {
- return adapter;
- }
- }
-
- return null;
- }
-
- /**
- * This adds a listener.
- */
- public void addListener(INotifyChangedListener notifyChangedListener) {
- changeNotifier.addListener(notifyChangedListener);
- }
-
- /**
- * This removes a listener.
- */
- public void removeListener(INotifyChangedListener notifyChangedListener) {
- changeNotifier.removeListener(notifyChangedListener);
- }
-
- /**
- * This delegates to {@link #changeNotifier} and to {@link #parentAdapterFactory}.
- */
- public void fireNotifyChanged(Notification notification) {
- changeNotifier.fireNotifyChanged(notification);
-
- if (parentAdapterFactory != null) {
- parentAdapterFactory.fireNotifyChanged(notification);
- }
- }
-
- /**
- * This disposes all of the item providers created by this factory.
- */
- public void dispose() {
- if (xmlRootContentNodeItemProvider != null)
- xmlRootContentNodeItemProvider.dispose();
- if (entityMappingsItemProvider != null)
- entityMappingsItemProvider.dispose();
- if (xmlPersistentTypeItemProvider != null)
- xmlPersistentTypeItemProvider.dispose();
- if (xmlPersistentAttributeItemProvider != null)
- xmlPersistentAttributeItemProvider.dispose();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/structure/XmlPersistentAttributeItemProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/structure/XmlPersistentAttributeItemProvider.java
deleted file mode 100644
index e9f4260b1f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/structure/XmlPersistentAttributeItemProvider.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 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.ui.internal.xml.structure;
-
-import org.eclipse.draw2d.ImageUtilities;
-import org.eclipse.emf.common.notify.AdapterFactory;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
-import org.eclipse.emf.edit.provider.IItemLabelProvider;
-import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
-import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
-import org.eclipse.emf.edit.provider.ItemProviderAdapter;
-import org.eclipse.emf.edit.provider.ViewerNotification;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
-import org.eclipse.jpt.core.internal.content.orm.XmlAttributeMapping;
-import org.eclipse.jpt.core.internal.content.orm.XmlPersistentAttribute;
-import org.eclipse.jpt.core.internal.mappings.IBasic;
-import org.eclipse.jpt.core.internal.mappings.IEmbedded;
-import org.eclipse.jpt.core.internal.mappings.IEmbeddedId;
-import org.eclipse.jpt.core.internal.mappings.IId;
-import org.eclipse.jpt.core.internal.mappings.IManyToMany;
-import org.eclipse.jpt.core.internal.mappings.IManyToOne;
-import org.eclipse.jpt.core.internal.mappings.IOneToMany;
-import org.eclipse.jpt.core.internal.mappings.IOneToOne;
-import org.eclipse.jpt.core.internal.mappings.ITransient;
-import org.eclipse.jpt.core.internal.mappings.IVersion;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsImages;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.ImageData;
-
-public class XmlPersistentAttributeItemProvider extends ItemProviderAdapter
- implements IEditingDomainItemProvider,
- IStructuredItemContentProvider,
- ITreeItemContentProvider,
- IItemLabelProvider
-{
- public XmlPersistentAttributeItemProvider(AdapterFactory adapterFactory) {
- super(adapterFactory);
- }
-
- @Override
- public Object getImage(Object object) {
- XmlAttributeMapping mapping = ((XmlPersistentAttribute) object).getMapping();
-
- Image image;
- if (mapping instanceof IBasic) {
- image = JptUiMappingsImages.getImage(JptUiMappingsImages.BASIC);
- }
- else if (mapping instanceof IId) {
- image = JptUiMappingsImages.getImage(JptUiMappingsImages.ID);
- }
- else if (mapping instanceof IVersion) {
- image = JptUiMappingsImages.getImage(JptUiMappingsImages.VERSION);
- }
- else if (mapping instanceof IEmbedded) {
- image = JptUiMappingsImages.getImage(JptUiMappingsImages.EMBEDDED);
- }
- else if (mapping instanceof IEmbeddedId) {
- image = JptUiMappingsImages.getImage(JptUiMappingsImages.EMBEDDED_ID);
- }
- else if (mapping instanceof IOneToOne) {
- image = JptUiMappingsImages.getImage(JptUiMappingsImages.ONE_TO_ONE);
- }
- else if (mapping instanceof IOneToMany) {
- image = JptUiMappingsImages.getImage(JptUiMappingsImages.ONE_TO_MANY);
- }
- else if (mapping instanceof IManyToOne) {
- image = JptUiMappingsImages.getImage(JptUiMappingsImages.MANY_TO_ONE);
- }
- else if (mapping instanceof IManyToMany) {
- image = JptUiMappingsImages.getImage(JptUiMappingsImages.MANY_TO_MANY);
- }
- else if (mapping instanceof ITransient) {
- image = JptUiMappingsImages.getImage(JptUiMappingsImages.TRANSIENT);
- }
- else {
- image = JptUiMappingsImages.getImage(JptUiMappingsImages.NULL_ATTRIBUTE_MAPPING);
- }
-
- // apply "ghosting"
- if (mapping.isVirtual()) {
- Color offwhite = new Color(image.getDevice(), 250, 250, 250);
- ImageData imageData = ImageUtilities.createShadedImage(image, offwhite);
- image = new Image(image.getDevice(), imageData);
- }
-
- return image;
- }
-
- @Override
- public String getText(Object object) {
- return ((XmlPersistentAttribute) object).getName();
- }
-
- @Override
- public void notifyChanged(Notification notification) {
- updateChildren(notification);
-
- switch (notification.getFeatureID(XmlPersistentAttribute.class)) {
- case OrmPackage.XML_PERSISTENT_ATTRIBUTE__MAPPING:
- case OrmPackage.XML_PERSISTENT_ATTRIBUTE__NAME:
- fireNotifyChanged(new ViewerNotification(notification, notification
- .getNotifier(), false, true));
- return;
- }
- super.notifyChanged(notification);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/structure/XmlPersistentTypeItemProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/structure/XmlPersistentTypeItemProvider.java
deleted file mode 100644
index f87750ae2b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/structure/XmlPersistentTypeItemProvider.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.xml.structure;
-
-import java.util.Collection;
-import org.eclipse.emf.common.notify.AdapterFactory;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
-import org.eclipse.emf.edit.provider.IItemLabelProvider;
-import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
-import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
-import org.eclipse.emf.edit.provider.ItemProviderAdapter;
-import org.eclipse.emf.edit.provider.ViewerNotification;
-import org.eclipse.jpt.core.internal.IPersistentType;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.core.internal.JpaCorePackage;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
-import org.eclipse.jpt.core.internal.content.orm.XmlPersistentType;
-import org.eclipse.jpt.core.internal.mappings.IEmbeddable;
-import org.eclipse.jpt.core.internal.mappings.IEntity;
-import org.eclipse.jpt.core.internal.mappings.IMappedSuperclass;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsImages;
-
-public class XmlPersistentTypeItemProvider extends ItemProviderAdapter
- implements IEditingDomainItemProvider,
- IStructuredItemContentProvider,
- ITreeItemContentProvider,
- IItemLabelProvider
-{
- public XmlPersistentTypeItemProvider(AdapterFactory adapterFactory) {
- super(adapterFactory);
- }
-
-
- @Override
- protected Collection getChildrenFeatures(Object object) {
- if (childrenFeatures == null) {
- super.getChildrenFeatures(object);
- childrenFeatures.add(OrmPackage.Literals.XML_PERSISTENT_TYPE__SPECIFIED_PERSISTENT_ATTRIBUTES);
- childrenFeatures.add(OrmPackage.Literals.XML_PERSISTENT_TYPE__VIRTUAL_PERSISTENT_ATTRIBUTES);
- }
- return childrenFeatures;
- }
-
- @Override
- public Object getImage(Object object) {
- ITypeMapping mapping = ((IPersistentType) object).getMapping();
-
- if (mapping instanceof IEntity) {
- return JptUiMappingsImages.getImage(JptUiMappingsImages.ENTITY);
- }
- else if (mapping instanceof IEmbeddable) {
- return JptUiMappingsImages.getImage(JptUiMappingsImages.EMBEDDABLE);
- }
- else if (mapping instanceof IMappedSuperclass) {
- return JptUiMappingsImages.getImage(JptUiMappingsImages.MAPPED_SUPERCLASS);
- }
- else {
- return null;
- }
- }
-
- @Override
- public String getText(Object object) {
- return ((XmlPersistentType) object).getClass_();
- }
-
- @Override
- public void notifyChanged(Notification notification) {
- updateChildren(notification);
-
- switch (notification.getFeatureID(XmlPersistentType.class)) {
- case JpaCorePackage.IPERSISTENT_TYPE__MAPPING_KEY:
- case OrmPackage.XML_PERSISTENT_TYPE__CLASS:
- fireNotifyChanged(
- new ViewerNotification(
- notification, notification.getNotifier(), false, true));
- return;
-
- case OrmPackage.XML_PERSISTENT_TYPE__SPECIFIED_PERSISTENT_ATTRIBUTES:
- case OrmPackage.XML_PERSISTENT_TYPE__VIRTUAL_PERSISTENT_ATTRIBUTES:
- fireNotifyChanged(
- new ViewerNotification(
- notification, notification.getNotifier(), true, false));
- return;
- }
-
- super.notifyChanged(notification);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/structure/XmlRootContentNodeItemProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/structure/XmlRootContentNodeItemProvider.java
deleted file mode 100644
index 969c7c8407..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/structure/XmlRootContentNodeItemProvider.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.xml.structure;
-
-import java.util.Collection;
-import org.eclipse.emf.common.notify.AdapterFactory;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
-import org.eclipse.emf.edit.provider.IItemLabelProvider;
-import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
-import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
-import org.eclipse.emf.edit.provider.ItemProviderAdapter;
-import org.eclipse.emf.edit.provider.ViewerNotification;
-import org.eclipse.jpt.core.internal.content.orm.EntityMappings;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
-
-public class XmlRootContentNodeItemProvider extends ItemProviderAdapter
- implements IEditingDomainItemProvider,
- IStructuredItemContentProvider,
- ITreeItemContentProvider,
- IItemLabelProvider
-{
- public XmlRootContentNodeItemProvider(AdapterFactory adapterFactory) {
- super(adapterFactory);
- }
-
- @Override
- public Collection getChildrenFeatures(Object object) {
- if (childrenFeatures == null) {
- super.getChildrenFeatures(object);
- childrenFeatures.add(OrmPackage.Literals.XML_ROOT_CONTENT_NODE__ENTITY_MAPPINGS);
- }
- return childrenFeatures;
- }
-
- @Override
- public void notifyChanged(Notification notification) {
- updateChildren(notification);
-
- switch (notification.getFeatureID(EntityMappings.class)) {
- case OrmPackage.XML_ROOT_CONTENT_NODE__ENTITY_MAPPINGS:
- fireNotifyChanged(
- new ViewerNotification(
- notification, notification.getNotifier(), true, false));
- return;
- }
- super.notifyChanged(notification);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/structure/XmlStructureProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/structure/XmlStructureProvider.java
deleted file mode 100644
index ca7dddcceb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/structure/XmlStructureProvider.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License 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.ui.internal.xml.structure;
-
-import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
-import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jpt.core.internal.JptCorePlugin;
-import org.eclipse.jpt.ui.internal.structure.IJpaStructureProvider;
-
-public class XmlStructureProvider implements IJpaStructureProvider {
-
- public String fileContentType() {
- return JptCorePlugin.ORM_XML_CONTENT_TYPE;
- }
-
- public ITreeContentProvider buildContentProvider() {
- return new AdapterFactoryContentProvider(new JpaCoreXmlItemProviderAdapterFactory());
- }
-
- public ILabelProvider buildLabelProvider() {
- return new AdapterFactoryLabelProvider(new JpaCoreXmlItemProviderAdapterFactory());
- }
-
- public void dispose() {
- // TODO Auto-generated method stub
-
- }
-}

Back to the top